Hi,
I am trying to build an immutable image with systemd (v245 on fedora
32), but I have a problem.
Here's what I'm trying to do:
I would like to build my immutable system with three disk images:
- the first one contains the system, so /usr
- the second one contains the files specific to the instance, so
/usr/local/lib and it's actually an ISO image
- the third one contains mutable data, so /srv, /var and /var/tmp
The idea is that the first image can be used by several instances. So it
contains all the common files.
All the specific files (SSL certificates, configuration file with domain
name, ...) can be found in the second image.
In this usecase, /usr/local/lib must be mounted very early in the boot
process (before the unit initrd-parse-etc.service).
Without volatile mode, it's easy. We only need to add these lines in the
/etc/fstab file:
PARTLABEL=srv /srv ext4 defaults,x-systemd.makefs 0 0
PARTLABEL=var /var ext4 defaults,x-systemd.makefs 0 0
PARTLABEL=var-tmp /var/tmp ext4 defaults,x-systemd.makefs 0 0
/dev/sr0 /usr/local/lib iso9660
ro,x-initrd.mount,nosuid,noexec,uid=0,gid=0,mode=400 0 0
With volatile mode enable (systemd.volatile=yes), it's different.
/etc/fstab file is copied too late by systemd.tmpfiles.
For the 3 first mount point it's not a problem, we just have to creation
.mount files.
For /usr/local/lib it's different. I'm trying differents way to do that.
The best way I found is to modify the initramfs (here with dracut):
echo 'add_drivers+="iso9660"' > /etc/dracut.conf.d/cdrom.conf
echo 'add_fstab+=/tmp/fstab' >> /etc/dracut.conf.d/cdrom.conf
echo "/dev/sr0 /sysroot/usr/local/lib iso9660
ro,x-initrd.mount,nosuid,noexec,uid=0,gid=0,mode=400 0 0" > /tmp/fstab
kernel-install add xxxx /lib/xxxxx
In this case /usr/local/lib is supposed to be mounted in /usr then
remounted by systemd-volatile-root in read-only mode in
/run/systemd/volatile-sysroot/usr, which will later become the final /usr.
Unfortunately sometimes it works, sometimes it fails.
systemd-volatile-root does not wait for the partitions to be completely
mounted before launching.
So sometime /usr/local/lib is present. Sometime it's failed with error:
mai 21 18:40:22 localhost.localdomain systemd[1]: run.mount: Failed to
load configuration: No such file or directory
What's the best way to mount extra partition in initramfs in volatile mode?
Maybe it's should be interesting to add a kernerl command line
parameters to precise the place to volatile fstab. Something like:
systemd.volatile_fstab=/usr/lib/factory/etc/fstab.
And systemd-volatile-root service should wait that partition with option
"x-initrd.mount" are mounted before remount in volatile mode.
Regards,
begin:vcard
fn:Emmanuel Garette
n:Garette;Emmanuel
org:Cadoles
email;internet:egarette@xxxxxxxxxxx
title;quoted-printable:Ing=C3=A9nieur logiciels libre
tel;work:03 73 27 02 86
tel;fax:09 72 29 61 11
url:http://www.cadoles.com/
version:2.1
end:vcard
_______________________________________________
systemd-devel mailing list
systemd-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/systemd-devel