[systemd-devel] rootnfs + rootovl (diskless client shutdown problem)

Matteo Guglielmi Matteo.Guglielmi at dalco.ch
Thu Oct 31 20:26:16 UTC 2019


Sorry for the imprecision there,


it's not a kernel panic but a complete

freeze of the system during a reboot or

shutdown (almost 10/20% of the time).


The error message that appears on the

screen is about missing libraries, which

I could later locate in /usr/lib64 (I do

not remember their name right now).


Concerning the .mount file, there is NOT

ONE associated to /live/image.


Instead, all others form /etc/fstab are

created:


cat etc/fstab

live:/srv/live/root /root nfs intr,nolock 0 0
live:/srv/live/home /home nfs intr,nolock 0 0
live:/srv/live/opt  /opt  nfs intr,nolock 0 0

each nfs entry has a corresponding .mount file.



The most important kernel options are:


root=172.16.16.38:/srv/live/cos8 rootovl

where 'rootovl' is the option provided by
the 90overlay-root dracut module (imported
from debian buster, see here below).

Should I modify overlay-mount.sh?

Thank you.

###########################################################
### cat /usr/lib/dracut/modules.d/90overlay-root/README ###
###########################################################

dracut rootfs overlayfs module

Make any rootfs ro, but writable via overlayfs.
This is convenient, if for example using an ro-nfs-mount.

Add the parameter "rootovl" to the kernel, to activate this feature

This happens pre-pivot. Therefore the final root file system is already
mounted. It will be set ro, and turned into an overlayfs mount with an
underlying tmpfs.

The original root and the tmpfs will be mounted at /live/image and
/live/cow in the final rootfs.


####################################################################
### cat /usr/lib/dracut/modules.d/90overlay-root/module-setup.sh ###
####################################################################

#!/bin/bash

check() {
    # do not add modules if the kernel does not have overlayfs support
    [ -d /lib/modules/$kernel/kernel/fs/overlayfs ] || return 1
}

depends() {
    # We do not depend on any modules - just some root
    return 0
}

# called by dracut
installkernel() {
    instmods overlay
}

install() {
    inst_hook pre-pivot 10 "$moddir/overlay-mount.sh"
}


#####################################################################
### cat /usr/lib/dracut/modules.d/90overlay-root/overlay-mount.sh ###
#####################################################################

#!/bin/sh

# make a read-only nfsroot writeable by using overlayfs
# the nfsroot is already mounted to $NEWROOT
# add the parameter rootovl to the kernel, to activate this feature

. /lib/dracut-lib.sh

if ! getargbool 0 rootovl ; then
    return
fi

modprobe overlay

# a little bit tuning
mount -o remount,nolock,noatime $NEWROOT

# Move root
# --move does not always work. Google >mount move "wrong fs"< for
#     details
mkdir -p /live/image
mount --bind $NEWROOT /live/image
umount $NEWROOT

# Create tmpfs
mkdir /cow
mount -n -t tmpfs -o mode=0755 tmpfs /cow
mkdir /cow/work /cow/rw

# Merge both to new Filesystem
mount -t overlay -o noatime,lowerdir=/live/image,upperdir=/cow/rw,workdir=/cow/work,default_permissions overlay $NEWROOT

# Let filesystems survive pivot
mkdir -p $NEWROOT/live/cow
mkdir -p $NEWROOT/live/image
mount --bind /cow/rw $NEWROOT/live/cow
umount /cow
mount --bind /live/image $NEWROOT/live/image
umount /live/image




________________________________
From: Lennart Poettering <lennart at poettering.net>
Sent: Thursday, October 31, 2019 6:34:15 PM
To: Matteo Guglielmi
Cc: systemd-devel at lists.freedesktop.org
Subject: Re: [systemd-devel] rootnfs + rootovl (diskless client shutdown problem)

On Mo, 28.10.19 09:47, Matteo Guglielmi (Matteo.Guglielmi at dalco.ch) wrote:

>
> almost 20% of the time I get a kernel panic error
> due to a bunch of missing libraries.

A kernel panic? because of "missing libraries"? that doesn't sound
right. The kernel doesn't need "libraries".

iirc it's totally fine to unmount the backing fs after you mounted the
overlayfs, the file systems remain pinned in the background by the overlayfs.

>
>
> How can I instruct systemd to avoid unmounting
>
> /live/image (or postpone it to a later moment)?

You can extend the .mount unit file for /live/image and add an
explicit dep: i.e. create
/etc/systemd/system/live-image.mount.d/50-my-drop-in.conf, then add:

   [Unit]
   After=some-other.mount

You get the idea...

Lennart

--
Lennart Poettering, Berlin


More information about the systemd-devel mailing list