So one of the guys at our office somehow ended up with two Raspberry Pi's
from the first batch, as one was enough for him to play with he offered the other one up, and I turned out to be the only person in the office who wasn't so lazy as to not walk over to the other building where he was to borrow for the weekend.
Here's a bunch of useful things that you probably want to do with the default Debian installation to make it more usable.
First, please don't give the foundation guys flack for any of these issues, a decent distro is hard, and I've paid hundreds of times more then this and gotten a horrific hack-job of (usually) debian (often with a kernel already years out of date, istead of one from this year). This really isn't too bad for a first go.
If you're using the pi on a network, or in a public place there are a few things to consider, it's actually pretty good compared to most embedded images I've seen.
Regenerate SSH keys
The pi already has SSH keys on the image, this is a security issue as it makes you a very easy target for MITM attacks.
As root run:
Note this enables SSH server on boot, so disable it if you want, see the note below about NFS, just use "ssh
" as the service. If you've used SSH before this you'll need to delete your existing entry on your client before SSH will let you connect due to the new keys.
Consider disabling NFS client (the sole open services by default)
Other then the ports being open this has no security implication, but it does save a lot of boot time.
update-rc.d portmap disable
update-rc.d nfs-common disable
Delete the pi user
Or at least change its password. If you create another admin user consider removing pi
" has an invalid password (same as Mac OS, Ubuntu, etc.). The users "tli
" and "pnd
" exist in /etc/shadow
with passwords (but not /etc/passwd
). The user "suse
" also has full root by sudo
, but doesn't exist.
Most of us don't use UK keyboards, you can switch to your local layout by running "dpkg-reconfigure keyboard-configuration
". you may want at least a qwerty (if not UK English) layout keyboard for this step, will be hard without one.
I think the concept of a "British Summer" is an oxymoron so I want to change the timezone to something more relevant to me.
You can do that by running "dpkg-reconfigure tzset" (again, sudo for root if needed)
If you're using a pi as a server you might want to disable console blanking so if you connect a monitor you don't need to hit a key to wake it up (which you might not be able to do if you've somehow crashed it).
To do this edit /etc/kbd/config
and change BLANK_TIME
You may wish to change to a local debian mirror by editing /etc/apt/sources.list and changing "uk
" to the appropriate two letter code (debian mirror list
), then as with all apt based systems, "apt-get update
" to find new packages, apt-get dist-upgrade
to upgrade to them (you should be careful what you install unless you've expanded the filesystem as there's not much free space).
I'd actually suggest the following as a good base debian apt set, these include security updates:
# Main, the core of debian
deb http://ftp.us.debian.org/debian/ squeeze main contrib non-free
#deb-src http://ftp.us.debian.org/debian/ squeeze main contrib non-free
# Security updates
deb http://security.debian.org/ squeeze/updates main contrib non-free
#deb-src http://security.debian.org/ squeeze/updates main contrib non-free
# Other important updates before point releases
deb http://ftp.us.debian.org/debian/ squeeze-updates main contrib non-free
#deb-src http://ftp.us.debian.org/debian/ squeeze-updates main contrib non-free
The commented out lines are for source packages, unless you plan to do debian package development on the board itself they're not worth it
You can (but probably shouldn't unless you like killing SD cards) enable swap by uncommenting the swap line in /etc/fstab
and rebooting or running "swapon -a
Expanding the filesystem to use all (or just more) of your SD card
*WARNING* This is only applicable to the 19/April/2012 Debian build, it's very easy to destroy data by doing this wrong.
I installed on an 8GB card (as it was all I had lying about) and wanted to use all the space available. If you're going to expand the filesystem I'd suggest doing it straight away so you won't feel bad if you stuff up and destroy the OS on the card.
All of this procedure needs to be run as root.
First, change the partition size:
use these commands:
- Type "p" and press enter, note the "Start" number of p2 (in this image, 1233)
- Delete the swap partition with "d" then "3"
- Delete the root partition with "d" then "2"Recreate the root partition with "n" then "2", then start cylinder (1233 for mine), then either press enter for all the card, or follow the instructions for otherwise (using anything less then the old End cylinder of p2 will break your system)</li>
- Verify things look ok by printing the table again ("p")
- If they're all good use "w" to finish.
Once the system is back to finish expansion run:
(This took several minutes on my 8GB card)
You can verify the result with "df -h