So a while back I wrote about setting up Mandriva for network boot and I'm still running a similar configuration albeit upgraded every six months or so as new Mandriva releases come out.
Well as I'm now mostly running Mageia, I decided it was worth posting a follow up article. Read on if you're interested in the nitty gritty of how such a system works.
So most of the details in that previous article still stand true, although thankfully it's now much simpler and requires very little in the way of patching of system files etc.
The Mandriva and Mageia rc.sysinit files both support the "early local" script (like rc.local, but executed much earlier in the boot process) which allows us to inject the necessary tweaks.
What are those necessary tweaks? Well primarily it's for setting up some tmpfs files and some unionfs or aufs2 mounts. The standard system init does actually do quite a lot towards getting this working automatically, but I've never had much success with that and there are a still a few things missing (related to dbus) so I prefer to keep things simple!
When I first upgraded my chroot to Mageia, the first hurdle was that mkinitrd-net was not available for Mageia. Thankfully I already had this installed from Mandriva days and the package still works fine. I'll make sure we import this package into Mageia so this won't be a problem ongoing. The second problem was that when booting with the latest kernel, the kernel panicked quite quickly relating to unionfs. It seems unionfs+nfs don't really agree that much. So I reverted back to the old Mandriva kernel which worked fine. So with a little research, I found out that aufs2 is basically replacing unionfs these days. With a couple of checks I was able to add aufs2 support to my rc.early.local script easily enough. This allowed the boot to work without any issues.
In actual fact, even with unionfs and the old kernel, things didn't work perfectly and relied on various tmpfs mounts done by the standard rc.sysinit. Without these, I found various issues relating to kernel panics and general slow performance. With aufs2 these problems don't seem to exist anymore and I can bypass these mounts for a simpler mount setup which is all rather nice.
So once things booted the second problem turned out to be related to keyboard support... I can't quite remember what this was, but I suspect it just related to me not having evdev installed... my memory is sketchy tho'. It certainly wasn't a big problem. What was a big problem was that my user had no rights to various hardware devices. I quickly realised that this related to console kit not marking my login (which was via the autologin package) as "active". This took a little more sleuthing but I finally realised this was down to not bringing the autologin package up to date with the recent(ish) changes in console kit, namely the pam ck connector. With a little bit of patching of the /etc/pam.d/autologin file, I was up and running again! I've reported this to the Mageia devel list. Hopefully someone who knows this stuff better than me can comment and we can push an update soon now the updates and QA processes are in place.
So without further ado, here is the contents of my rc.early.local. The comments should mean the file kinda speaks for itself.
# This file is sourced early on in rc.sysinit and this means
# we can do some very early setup for the read only / filesystem.
# Firstly, we need some writable directories.
# We do this using unionfs or aufs to combine the readonly versions with
# a tmpfs location to provide writable space.
USE_AUFS=$(uname -r | grep -v 2.6.33 | wc -l)
if [ $USE_AUFS -gt 0 ]; then
# Mount somewhere we can use in ram
mount -t tmpfs none $TMPFS -o size=2g
for fs in etc var tmp root; do
echo "Mounting $UFS on /$fs to make it writable (any changes will not be saved)"
mkdir -p $TMPFS/$UFS/$fs
mount -t $UFS -o dirs=$TMPFS/$UFS/$fs=rw:/$fs=ro none /$fs
# Rather than have the stupid mounts done by rc.sysinit
# our aufs stuff above is much cleaner. But we need to
# tell rc.sysinit that we are READONLY all the same.
echo "READONLY=yes" >>/etc/sysconfig/readonly-root
if [ $USE_AUFS -gt 0 ]; then
# If we use aufs all is well and we don't need stateful dirs
# Or the complexity of copying over files from the underlying filesystem
# to our stateful directories. So we just nuke rwtab and rc.sysinit
# will do mostly nothing.
echo -n "">/etc/rwtab
# We also fudge the code in rc.sysinit to not mount it's own tmpfs
# space seeing as we already do that above. There is no combo of
# options to let this happen so we just create a fake mount point
[ -z "$RW_MOUNT" ] && RW_MOUNT=/var/lib/stateless/writable
mkdir -p $TMPFS/ignore-me $RW_MOUNT
echo "$TMPFS/ignore-me $RW_MOUNT noauto bind 0 0" >>/etc/fstab
# Sadly if we are using unionfs, the module is simply not
# reliable enough to work properly, thus we must use the tmpfs
# approach built in to rc.sysinit.
# Sadly, the official version of this file forgets about keeping
# the dbus machine-id file consistent (which is used by PulseAudio
# to store setup info) so we have to manually add this here.
echo "files /var/lib/dbus" >>/etc/rwtab
# We need dev to have ACL support for Console Kit, but
# unionfs does not support this, so we just mount a clean
# /dev. When aufs is used rather than unionfs, we can just
# include this in the above.
mkdir -p $TMPFS/dev
mount -o bind $TMPFS/dev /dev
# Mark /tmp as temp
chmod ugo+rwxt /tmp
# Mount the correct config directory for our hostname
if [ -d /var/configs/$HN ]; then
mount /var/configs/$HN /var/config -o bind
echo "Warning: Config directory /var/configs/$HN does not exist"
# Fake an eth0 configuration
cat >/etc/sysconfig/network-scripts/ifcfg-eth0 <
If anyone has any suggestions for improvements or wants to discuss any of the bits in detail, just leave a comment!