You are not logged in.

#1 2025-09-16 05:22:22

x254lb
Member
Registered: 2024-11-15
Posts: 10

[SOLVED] systemd.volatile=overlay on Arch/w UKI ,not booting

Hi all,

I’m trying to set up my Arch Linux system with systemd.volatile=overlay because I need to make temporary changes that don’t persist across reboots. I’m using UKI and have run into some issues getting it to work.

Here’s what I’ve tried so far:

Linux preset (linux.preset):

#/etc/mkinitcpio.d/linux.preset
ALL_kver="/boot/vmlinuz-linux"

PRESETS=('default' 'fallback')

default_uki="/efi/EFI/Linux/arch-linux.efi"
default_options="--splash /usr/share/systemd/bootctl/splash-arch.bmp"

fallback_uki="/efi/EFI/Linux/arch-linux-fallback.efi"
fallback_options="-S autodetect"

mkinitcpio config (/etc/mkinitcpio.conf):

#/etc/mkinitcpio.conf
.
.
MODULES=()
.
.
HOOKS=(base systemd autodetect microcode modconf kms keyboard sd-vconsole block sd-encrypt filesystems fsck)
.
.

Initial attempt:

    Added

systemd.volatile=overlay

to the kernel cmdline.

    Stuck at:

[OK] Mounted /sysroot

    Observed that overlay module was missing in UKI:

lsinitrd /efi/EFI/Linux/arch-linux.efi | grep overlay
objcopy: /dev/null: file truncated

Next attempt:

    Added overlay to MODULES=() in mkinitcpio.conf and rebuilt UKI.

    Verified module exists:

lsinitrd /efi/EFI/Linux/arch-linux.efi | grep overlay
objcopy: /dev/null: file truncated
drwxr-xr-x  root root        Jan  1 1970  usr/lib/modules/6.16.3-arch1-1/kernel/fs/overlayfs/
-rw-r--r--  root root        Jan  1 1978  usr/lib/modules/6.16.3-arch1-1/kernel/fs/overlayfs/overlay.ko.zst

Kernel cmdline tried:

rd.luks.name=f47ac10b-58cc-4372-a567-0e02b2c3d479=root root=/dev/mapper/root rootfstype=ext4 systemd.volatile=overlay

I want a read-only root with an overlay for temporary changes, similar to live system behavior, so I can test things without affecting the installed system.

I also tried with

systemd.volatile=state

, then /var gets mounted as a tmpfs, but root is still rw.

Thanks in advance!

Last edited by x254lb (2025-09-16 18:38:27)

Offline

#2 2025-09-16 05:39:53

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,999
Website

Re: [SOLVED] systemd.volatile=overlay on Arch/w UKI ,not booting


Jin, Jîyan, Azadî

Offline

#3 2025-09-16 05:45:47

x254lb
Member
Registered: 2024-11-15
Posts: 10

Re: [SOLVED] systemd.volatile=overlay on Arch/w UKI ,not booting

Can I ask why there still is no fix being formulated?

Offline

#4 2025-09-16 06:04:32

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,999
Website

Re: [SOLVED] systemd.volatile=overlay on Arch/w UKI ,not booting

The devs are probably too busy.

Have you tried dracut instead? That seems to work for Fedora.


Jin, Jîyan, Azadî

Offline

#5 2025-09-16 06:14:13

x254lb
Member
Registered: 2024-11-15
Posts: 10

Re: [SOLVED] systemd.volatile=overlay on Arch/w UKI ,not booting

Head_on_a_Stick wrote:

The devs are probably too busy.

Have you tried dracut instead? That seems to work for Fedora.

You mean, try with dracut on arch?

Offline

#6 2025-09-16 06:32:48

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,999
Website

Re: [SOLVED] systemd.volatile=overlay on Arch/w UKI ,not booting

Yes smile

EDIT: there is a patch available for mkinitcpio: https://bugs.archlinux.org/task/55648.html

Last edited by Head_on_a_Stick (2025-09-16 07:05:57)


Jin, Jîyan, Azadî

Offline

#7 2025-09-16 07:51:08

x254lb
Member
Registered: 2024-11-15
Posts: 10

Re: [SOLVED] systemd.volatile=overlay on Arch/w UKI ,not booting

Head_on_a_Stick wrote:

Yes smile

EDIT: there is a patch available for mkinitcpio: https://bugs.archlinux.org/task/55648.html

Thank you for your help so far.
I was trying to use dracut,and got met with an error.
Can you help me with it?

Initramfs generation with dracut fails.

Offline

#8 2025-09-16 14:06:26

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,999
Website

Re: [SOLVED] systemd.volatile=overlay on Arch/w UKI ,not booting

Please don't do that. I check the boards every day and reply to every thread to which I can make a useful contribution (and sometimes just shitpost for fun if it's TGN).

Did you try the patch? It might be useful for others to know if it works.


Jin, Jîyan, Azadî

Offline

#9 2025-09-16 14:10:36

x254lb
Member
Registered: 2024-11-15
Posts: 10

Re: [SOLVED] systemd.volatile=overlay on Arch/w UKI ,not booting

x254lb wrote:
Head_on_a_Stick wrote:

Yes smile

EDIT: there is a patch available for mkinitcpio: https://bugs.archlinux.org/task/55648.html

Thank you for your help so far.
I was trying to use dracut,and got met with an error.
Can you help me with it?

Initramfs generation with dracut fails.

I only just saw your edit. I'll try the patch out.

Offline

#10 2025-09-16 17:11:26

x254lb
Member
Registered: 2024-11-15
Posts: 10

Re: [SOLVED] systemd.volatile=overlay on Arch/w UKI ,not booting

Head_on_a_Stick wrote:

Yes smile

EDIT: there is a patch available for mkinitcpio: https://bugs.archlinux.org/task/55648.html

I tried the patch and it worked.
Not the one provided by Tobias Hunger (hunger) , but the hook provided by Nils (nlswrnr)

sd-volatile hook:

#!/bin/bash

build() {
    add_module "overlay"

    add_systemd_unit "systemd-volatile-root.service"
}

help() {
    cat <<HELPEOF
This hook installs the necessary infrastructure for systemd.volatile to work.
HELPEOF
}

# vim: set ft=sh ts=4 sw=4 et:

I copied it to

/usr/lib/initcpio/install/sd-vconsole

And in mkinitcpio.conf, I added sd-volatile to HOOKS:

HOOKS=(base systemd sd-volatile autodetect microcode modconf kms keyboard sd-vconsole block sd-encrypt filesystems fsck)

Now, upon boot if i add the following kernel parameter, and it works perfectly.

.... systemd.volatile=overlay 

root / is mounted as overlayfs

❯ findmnt
TARGET                 SOURCE   FSTYPE   OPTIONS
/                      overlay  overlay  rw,relatime,lowerdir=/sysroot,upperdir=/run/systemd/overlay-sysr

Thank you very much for you help. In the end, it was a very simple fix.

Offline

#11 2025-09-16 18:35:34

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,999
Website

Re: [SOLVED] systemd.volatile=overlay on Arch/w UKI ,not booting

You're welcome, glad I could help. Please edit the first post in the thread and prepend [SOLVED] to help others who may encounter this issue. Thanks,


Jin, Jîyan, Azadî

Offline

Board footer

Powered by FluxBB