Possible Bug using $FAI_DEBMIRROR

C. V. list-user at backenhoernchen.de
Sun May 15 22:09:55 CEST 2016


I was setting up a new FAI system with Debian Jessie. Using a NFS mounted debian mirror (previously debmirror, now fai-mirror) I noticed that it is never mounted. 

After researching I found a possible bug that already exists for some time according to the github history.

In jessie '/etc/init/rcS' is running on boot, in the newest FAI version it is the 'fai' (https://github.com/faiproject/fai/blob/365641dc57c54b1aee733730b1c740b65c7cb8e7/bin/fai). The following is always executed starting from line 67(https://github.com/faiproject/fai/blob/365641dc57c54b1aee733730b1c740b65c7cb8e7/bin/fai#L67).

    if [ -d /media/mirror ]; then   # we are booting from fai cd or USB stick
        FAI_DEBMIRROR="--bind /media/mirror"

It basically means if '/media/mirror' exists, a defined 'FAI_DEBMIRROR' in '/etc/fai/fai.conf' has no effect. Already wondering about this check and the comment about CD or USB, I naturally also found this path in my 'NFSROOT'.

Checking 'fai-make-nfsroot' surely, as i remembered from previous installations time ago, 'fai-make-nfsroot' is using $FAI_DEBMIRROR when running and it is also creating - at least in this instance - the directory '/media/mirror' (https://github.com/faiproject/fai/blob/master/bin/fai-make-nfsroot#L350).

    if [ -n "$FAI_DEBMIRROR" ]; then
        [ "$verbose" ] && echo "Mounting $FAI_DEBMIRROR to $NFSROOT/$MNTPOINT."
        mkdir -p $NFSROOT/$MNTPOINT
        mount -o ro,noatime $FAI_DEBMIRROR $NFSROOT/$MNTPOINT || \
                die 1 "Can't mount $FAI_DEBMIRROR to $NFSROOT/$MNTPOINT."

Since this path persists, the FAI boot script assumes that it is being booted from CD or USB and not from network. Hence FAI_DEBMIRROR is overwritten.

In version 3.4.7, the check at boot time was different:

    if [ -f /etc/RUNNING_FROM_FAICD ]; then    # we are booting from fai cd

I would appreciate if someone could have a look into it.
I guess a fix for this would be using a check such as in /usr/lib/fai/subrutines at line 570 (https://github.com/faiproject/fai/blob/master/lib/subroutines#L570) for checking if FAI is booted from CD.



More information about the linux-fai mailing list