Raspberry reinstall

Exactly two months ago, on 23 August I posted about munin not creating html pages and that I had to reinstall libxrender1, because the file libXrender.so.1.3.0 was corrupt, but I have not checked the root cause. Well, I should have gone deeper into it, because it turned out that the flash drive was about to break down. So at the end I had to reinstall the whole system. It was not a big deal, but here is how I did it for future reference:

I did a normal install on an SD Card. Then I took a new flash drive, created a single ext4 partition, and read out the DOS disklabel (it has a DOS disklabel, not a GPT) with fdisk -l. The installation creates two partitions on the SD Card, a boot and a root, so I just copied the content of root over to the flashdrive. One last thing to make the system use the flashdrive as root partition is to update /cmdline.txt on the boot partition:

// DOS Disklabel of the flash drive: 0xabcd1234
// Partition number of the root partion on the flash drive: 01
// this needs to be added to the root= parameter
console=serial0,115200 console=tty1 root=PARTUUID=abcd1234-01 rootfstype=ext4 fsck.repair=yes rootwait

During the installation I chose minimal, I also enabled ssh, set the password, and the IP address is assigned via DHCP, so after these steps, I had the basic working setup. I just needed a few more things to have my monitoring stuff with munin. Luckily the old flash drive was not completely broken, so I could save munin configuration (/etc/munin) my custom scripts and plugins (/usr/local/bin and /usr/local/lib/munin) as well as the RRDtool database files (/var/lib/munin), so I copied them onto the new root filesystem before installing munin.

To get munin up and running, I just needed to install lighttpd and munin, and as I read the heating system data via the ModBus protocol, also a small tool called mbpoll. Furthermore, lighttpd needed two lines in the config:

alias.url += ("/munin-static" => "/etc/munin/static" )
alias.url += ("/munin"        => "/var/cache/munin/www/" )

Also for convenience I also installed vim and mc. That’s it.