dracut
dracut copied to clipboard
rd.live.overlay.overlayfs doesn't seem to work when $DRACUT_SYSTEMD=1
Describe the bug I'm attempting to boot into a squashfs image with an overlayfs overlay. The switch root fails, here are some relevant lines from my rdsosreport.txt:
[ 36.385975] localhost systemctl[782]: Got message type=error sender=org.freedesktop.systemd1 destination=n/a path=n/a interface=n/a member=n/a cookie=1 reply_cookie=1 signature=s error-name=org.freedesktop.DBus.Error.InvalidArgs error-message=Specified switch root path '/sysroot' does not seem to be an OS tree. os-release file is missing.
[ 36.385975] localhost systemctl[782]: Failed to switch root: Specified switch root path '/sysroot' does not seem to be an OS tree. os-release file is missing.
[ 36.385975] localhost systemctl[782]: Bus n/a: changing state RUNNING → CLOSED
[ 36.386080] localhost systemd[1]: Failed to process message type=method_call sender=n/a destination=org.freedesktop.systemd1 path=/org/freedesktop/systemd1 interface=org.freedesktop.systemd1.Manager member=SwitchRoot cookie=1 reply_cookie=0 signature=ss error-name=n/a error-message=n/a: Specified switch root path '/sysroot' does not seem to be an OS tree. os-release file is missing.
If I remove or alter the line here: https://github.com/dracutdevs/dracut/blob/master/modules.d/90dmsquash-live/dmsquash-live-root.sh#L394 to add the overlayfs even with DRACUT_SYSTEMD is not zero then my system boots exactly how I would expect it to.
Is this conditional necessary? Is systemd not doing something that dracut assumes it should do?
Distribution used Ubuntu 22.04
Dracut version
dracut --version
reports only dracut
. apt info dracut
reports version 051-1. Was installed via apt.
Init system systemd
To Reproduce My dracut.conf:
hostonly=no
hostonly_cmdline="root=live:UUID=xxxxxxx-xxxx debug mitigations=auto rd.live.debug=1 rd.live.overlay.overlayfs=1 rd.shell"
compress=xz
uefi=yes
uefi_stub=/usr/lib/...........
add_dracutmodules+=" dmsquash-live "
/LiveOS/squashfs.img is a squashfs image containing a flat ubuntu root fs.
Expected behavior Should set up an overlayfs fs over the squashfs image
Also noticed same issue with dracut 053 using livenet, however starting
systemctl start sysroot.mount
mounts /sysroot
@jdharms If you do not actually need systemd in your initramfs, you can disable it and just specify the dracut modules you actually need, e.g.
dracutmodules+="dmsquash-live"
There is a PR up for review for a test case that uses this technique and it is passing (against latest upstream) - https://github.com/dracutdevs/dracut/pull/1813/files#diff-6aa993c0ff374636137737561ae60ed7e576e1891e210e322680f9662ebdef13R110
Also seems like its related to systemd version. Like a issue #1822. I found old version of live image with dracut 053 and systemd 249 and it works with same setup, however systemd 250+ stopped working
@jdharms Please adjust dmsquash-live-root.sh
lines 9-13 to
if getargbool 0 rd.live.debug -n -y rdlivedebug; then
[ -z "$DRACUT_SYSTEMD" ] && exec > /run/initramfs/liveroot.$$.out 2>&1
set -x
export RD_DEBUG=yes
[ "$BASH" ] && export \
PS4='+ (${BASH_SOURCE}@${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
fi
and then report the relevant journal section or /run/initramfs/liveroot.$$.out
.
(Notice that if your flat rootfs does not contain the empty directory /proc
, the test at line 304
elif [ -d /run/initramfs/squashfs/proc ]; then
will fail.)
I think this (or similar) issue can be reproduced by running test-16 with the following change in the source tree
--- a/test/TEST-16-DMSQUASH/test.sh
+++ b/test/TEST-16-DMSQUASH/test.sh
@@ -136,8 +136,8 @@ SUBSYSTEM=="block", ENV{ID_FS_TYPE}=="ntfs", ENV{ID_FS_TYPE}="ntfs3"
EOF
"$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
- --modules "test dash dmsquash-live qemu" \
+ --modules "test dash dmsquash-live qemu dracut-systemd" \