FAIUbuntuAndVarRunVarLockProblem

From FAIWiki

Jump to: navigation, search

Getting rid of boot problems because of missing /var/run and /var/lock on ROOT partition before overlayed with a /var partition

Just use this hook script:

$FAI/hooks/mountdisks.<CLASS>:

#!/bin/bash

[ ! -f $LOGDIR/fstab ] && die "No $LOGDIR/fstab created." 

# portions taken from mount2dir
(
    while read device mountpoint fstype mopt dummy; do 
        case $mopt in
            *noauto*) continue ;;
        esac   

        [ "$mountpoint" == "none" ]  && continue
        [ "$fstype" == "swap" ]  && continue
        [ "$fstype" == "proc" ]  && continue
        [ "$fstype" == "usbfs" ]  && continue
        [ "$fstype" == "sysfs" ]  && continue
        [ "$fstype" == "tmpfs" ]  && continue
        [ "$fstype" == "devpts" ]  && continue
        
        if [ "$mountpoint" == "/" ]; then
            mkdir $target$mountpoint
            mount -t $fstype -o noatime -o $mopt $device $target$mountpoint
        # special ubuntu settings
            mkdir -p $target/var/run
            mkdir -p $target/var/lock
            umount $target$mountpoint
        fi
    done 
) < $LOGDIR/fstab

# DO NOT SKIPTASK MOUNTDISKS