dracut icon indicating copy to clipboard operation
dracut copied to clipboard

Boot Existing, Usual Linux Installation from Hard Disk in Live Mode / read-only mode with dracut

Open adrelanos opened this issue 3 years ago • 1 comments

Feature request. What I would like to do:

  1. Install Debian to HDD with encrypted lvm using the usual installer.
  2. Make any persistent changes normally.
  3. Add dracut parameters to boot into non-persistent live mode. (add an additional grub boot menu entry for ease of use to have a choice to boot into persistent mode or live (read-only) mode)

Similar to this (alternative way to phrase this question).

Is this already possible with dracut?

By comparison, this is possible with initramfs-tools and grub.

adrelanos avatar Jul 19 '21 17:07 adrelanos

Figured it out thanks to dracut-grub-live @friedrich12.

/etc/dracut.conf.d/30-grub-live.conf

filesystems+=overlay

And kernel boot parameter rootovl.

grub-live is now compatible with dracut.

adrelanos avatar Sep 03 '21 09:09 adrelanos

And kernel boot parameter rootovl.

rootovl is only available on the Debian fork of dracut.

Here upstream there is an overlayfs drcaut module that works similarly to rootovl and it is now also available in Debian as well.

Perhaps you can help testing this solution so that it works with all distro

LaszloGombos avatar Feb 28 '23 03:02 LaszloGombos

Figured it out thanks to dracut-grub-live @friedrich12.

/etc/dracut.conf.d/30-grub-live.conf

filesystems+=overlay
  • This was required for Debian bullseye.
  • This breaks Debian bookworm, but
    • This is no longer required for Debian bookworm.
    • Use of rootovl got therefore even easier. Thank you!

adrelanos avatar Jul 09 '23 14:07 adrelanos

And kernel boot parameter rootovl.

rootovl is only available on the Debian fork of dracut.

Here upstream there is an overlayfs drcaut module that works similarly to rootovl and it is now also available in Debian as well.

Perhaps you can help testing this solution so that it works with all distro

Happy to test this. Since I couldn't find any documentation (this is why I created this ticket), it took me a while to figure this out.

grub-live's /etc/grub.d/11_linux_live now has an added comment:

#GRUB_CMDLINE_LINUX="$GRUB_CMDLINE_LINUX rd.live.overlay.overlayfs=1 rd.live.overlay.readonly=1"

(I commented out rootovl, commented above in and run sudo update-grub.)

And indeed, adding the kernel parameter rd.live.overlay.overlayfs=1 rd.live.overlay.readonly=1 seems to have the same effect as rootovl.

Are these the correct kernel parameters?

adrelanos avatar Jul 09 '23 14:07 adrelanos

Are these the correct kernel parameters?

Well, there is an open bugfix that I hope to land soon - https://github.com/dracutdevs/dracut/pull/2269 . Ideally you should test with this patch applied.

This bugfix also uploaded for debian - https://salsa.debian.org/debian/dracut/-/merge_requests/20

You might need some of these changes even for a non-nfs use case.

FYI Fedora live images also using rd.live.overlay.overlayfs - see https://github.com/livecd-tools/livecd-tools/blob/main/imgcreate/live.py#L127

CC @Mrfai

LaszloGombos avatar Jul 09 '23 18:07 LaszloGombos