Setup 2 – More tweaks to save precious RAM

October 2012:

Note: These pages are somewhat dated now, but I’ll keep them here as they may be of use to someone…


 Carrying on from the last page, here is a few more things you can do to maximise the RAM availability on the Pi. A side-effect of this is that it will boot marginally faster too.

Note that some of these actions might seem trivial – only freeing up a megabyte of SD space, or the same RAM, but I feel that every byte counts here and if we can do our utmost to keep the systems as lightweight as possible without sacrificing full functionality, then we should.

Note: Some of these hare already been dropped from Wheezy, so you may be OK there.

I don’t know why xinetd is installed, but it’s not needed and it’ll just take up RAM and potentially allow for DoS attacks. Purge it:

sudo apt-get purge xinetd
sudo apt-get autoremove

Do you use NFS? Do you know what NFS is? If the answer is No, then lets get rid of a couple of the NFS helper applications:

sudo apt-get purge portmap

This will likely suggest installing one or 2 new packages, but will remove the nfs-common package too (which is fine). Follow this up with

sudo apt-get autoremove

Virtual consoles – Do you know what they are? Do you use them? It’s often handy to have 1 or 2, but the Raspberry Pi Debian comes with six. You need to edit a system file sudo nano /etc/inittab and scroll down to near the bottom, looking for lines that resemble:

4:23:respawn:/sbin/getty 115200 tty4

and comment these out by putting a # symbol at the start of the line. Do this for the 3 lines tty4, tty5 and tty6. If you are never going to connect a serial terminal to the Raspberry Pi (additional hardware required!) then also comment out the line that has ttyAMA0 on it.

Write the file and issue the command: sudo kill -1 1 or reboot. This will kill-off the extra getty processes and save a little bit of RAM. It’s not much, but every byte counts here!

NTFS: Are you ever likely to use it? Probably the only time would be plugging in a USB data key or hard drive that was formatted with NTFS on a Windows PC… If you’re never going to use it then we can free-up a little bit more RAM and disk space:

sudo apt-get purge fuse-utils
sudo apt-get purge libfuse2
sudo apt-get purge libntfs10

That will unload the fuse module from RAM, giving you back a few more bytes and free up another megabyte of SD space.

GDM: This is the Gnome Display Manager. It’s been disabled and people seem to be encouraged to type startx to get into X windows mode.

sudo apt-get autoremove gdm
sudo apt-get autoremove

and it’s gone.

Comments

Setup 2 – More tweaks to save precious RAM — 7 Comments

  1. WVDIAL does not work on Rasberry Pi. There is a known problem with the ARM architecture and WVDIAL since 2009. This breaks lots of great ideas, and making it work is non trivial. Too bad, because this would enable a lot of things.

  2. Hi Gordon,

    Thanks for all the useful advice. I’ve got the Pelican crossing up and working – not used my breadboard for years 🙂

    However, I also followed your tweaks above to reduce space and now the screensaver doesn’t work and wallpaper (raspberry) has disappeared. I tried reinstalling GDM, but no change.

    More serious I’ve also lost internet access (via browser) – I just get a name not resolved error.

    Any suggestions?

    • Glad you got the board going – I’ve replied in email about the other stuff though. Bit of a concern, but I’m sure we can get you sorted out.
      -Gordon

  3. After commenting out the virtual consoles you don’t have to reboot. You can type “init q” instead.

    • Hi,
      Yup. My favourite from the old days was
      kill -1 1
      too.

      But sometimes it’s easier to just give-in and do the reboot – it’s what a lot of people expect these days!

      Cheers,
      -Gordon

  4. Thank you for an interesting blog post.

    It seems that the Raspbian image has taken a leaf out of your book – only one of these (libfuse2) is installed as standard. Nice work!

    • Oh I don’t really know – there was a lot of thoughts, experiments and so on when building the early rasbpian images. I’m a sort of minimalist person too, but I can see why they might leave the fuse stuff in – to help people who might want to mount ntfs via usb disk or somesort!

      Cheers,
      -Gordon