Dracut overlayfs missing?

I cloned the grub-btrfs repo and installed it that way, which enabled booting with the kernel parameter. However:

This was my experience as well. The environment wasn’t the actual overlay environment, it was just a read-only filesystem.

Also, LightDM still wouldn’t load but I discovered if you hit Enter when it hangs on the black screen with the sporadically blinking cursor, then you can switch to a TTY to login and run startxfce4. Weird, but okay.

I started wondering why this setup works fine on Garuda Linux, where I have an XFCE install that uses dracut/ grub-btrfs/ snapper/ snap-pac. After some poking around on the Garuda install, I found a 91btrfs-snapshot-overlay directory in /usr/lib/dracut/modules.d/, with these two scripts inside:

exa -1 /usr/lib/dracut/modules.d/91btrfs-snapshot-overlay/
module-setup.sh
snapshot-overlay.sh

I took a peek and discovered they are just a couple small bash scripts.

cat /usr/lib/dracut/modules.d/91btrfs-snapshot-overlay/module-setup.sh
File: /usr/lib/dracut/modules.d/91btrfs-snapshot-overlay/module-setup.sh
#!/bin/bash

# called by dracut
check() {
    dracut_module_included btrfs || return 1
    return 0
}

# called by dracut
depends() {
    return 0
}

# called by dracut
install() {
    inst mktemp
    hostonly='' instmods overlay
    inst_hook pre-pivot 000 "$moddir/snapshot-overlay.sh"
}
cat /usr/lib/dracut/modules.d/91btrfs-snapshot-overlay/snapshot-overlay.sh
File: /usr/lib/dracut/modules.d/91btrfs-snapshot-overlay/snapshot-overlay.sh
#!/bin/bash
function mount_snapshot_overlay() {
    local root_mnt="$NEWROOT"
    if [[ "$(findmnt --mountpoint "$root_mnt" -o FSTYPE -n)" = "btrfs" ]] && [[ "$(btrfs property get ${root_mnt} ro)" != "ro=false" ]]; then
        local ram_dir=$(mktemp -d -p /)
        mount -t tmpfs cowspace ${ram_dir}
        mkdir -p ${ram_dir}/{upper,work}
        mount -t overlay -o lowerdir=${root_mnt},upperdir=${ram_dir}/upper,workdir=${ram_dir}/work rootfs ${root_mnt}
    fi
}

mount_snapshot_overlay

I added this directory and the two scripts to usr/lib/dracut/modules.d/ on my Endeavour XFCE and ran sudo dracut-rebuild, then installed a package to generate a snapshot for testing.

And it works! I am able to boot the snapshot, LightDM loads normally, and the environment is the proper overlay (not the read-only filesystem).

I’m not sure who made these scripts and I don’t fully understand the significance of what they do, but they do seem to resolve this particular issue.@jfabernathy I guess you were right, it seems like it’s a dracut thing after all.