Re: [systemd-devel] systemd-repart /etc automount via discoverable partition specification
On Mon, Sep 11, 2023 at 11:49 AM Lennart Poettering wrote: > > On Mo, 11.09.23 11:39, Nils Kattenbeck (nilskem...@gmail.com) wrote: > > > On Mon, Sep 11, 2023, 10:54 Lennart Poettering > > wrote: > > > > > The discoverable partition scheme has no concept of /etc/ discovery. It > > > focusses on three basic setups: > > > > > > 1. writable root fs that contains /etc/, /var/ and /usr/ directly. > > > 2. writable root fs that contains /etc/ and /var/ and gets an > > >immutable /usr/ mounted in > > > 3. immutable root fs that contains /etc/ and /usr/ directly and gets a > > >writable /var/ mounted in. (the latter possibly as tmpfs, for truly > > >stateless systems) > > > > There is also 4. with a writeable root which only contains /etc, an > > immutable /usr and a temporary /var. Though I guess that can be covered > > with the existing DPS...? > > That's pretty much the same as 2, except that /var is overmounted with > a tmpfs. i.e. you would simply place /etc/fstab in there, that says > /var is tmpfs. Yeah I figured as much, thanks for confirming. > > My use case is basically 2, /etc has to be writeable to persist the > > machine-id across reboots, /var also has to be writeable and /usr can be > > immutable. > > > > The problem I am then likely facing is that I create the partitions wrong. > > I am using mkosi and tried several different repart.d configuration with > > type=root+type=usr, type=root+type=var+type=use, and different CopyFiles= > > and Exclude(Target)Files= but none of them seemed to have worked. > > if your /var/ is supposed to be a tmpfs, then don't mention it to > mkosi/repart, just put an /etc/fstab into place that dicates /var is > mounted as tmpfs. > > Other than that you should just be able to use Type=root and Type=usr then. > > > Are there special requirements for what the respective partitions must or > > shall not contain when using several auto-discovered partitions? Or should > > I ask on the mkosi issue tracker? > > If you have just root + usr then this should be a pretty common > situation for mkosi, it's not special and should just work. > > Lennart Do I have to write the usr/ partition in the fstab then if it is supposed to be discovered automatically? When booting the image (without an fstab) I get dropped into the emergency target as initrd-switch-root failed. It fails because /etc/os-release is symlinked into usr/ and usr/ is not mounted under /sysroot/. I have read the bootup man page to maybe find units whose output might help me troubleshoot this better but apart from affirming that a sysroot-usr.mount unit did *not* exist I have not been able to troubleshoot this any further. My repart.d files are as follows: # 10-root.conf [Partition] Type=root Format=ext4 SizeMaxBytes=5G CopyFiles=/etc CopyFiles=/var Minimize=guess # 20-usr.conf # Format= and Minimize= would be erofs/best once everything is final [Partition] Type=usr Format=ext4 SizeMaxBytes=3G CopyFiles=/usr:/ Minimize=guess Nils
Re: [systemd-devel] systemd-repart /etc automount via discoverable partition specification
On Mo, 11.09.23 11:39, Nils Kattenbeck (nilskem...@gmail.com) wrote: > On Mon, Sep 11, 2023, 10:54 Lennart Poettering > wrote: > > > On So, 10.09.23 00:33, Nils Kattenbeck (nilskem...@gmail.com) wrote: > > > > > Hello, I am currently trying to build a linux image with discoverable > > > partitions in an A/B+etc+var scheme. > > > > The discoverable partition scheme has no concept of /etc/ discovery. It > > focusses on three basic setups: > > > > 1. writable root fs that contains /etc/, /var/ and /usr/ directly. > > 2. writable root fs that contains /etc/ and /var/ and gets an > >immutable /usr/ mounted in > > 3. immutable root fs that contains /etc/ and /usr/ directly and gets a > >writable /var/ mounted in. (the latter possibly as tmpfs, for truly > >stateless systems) > > There is also 4. with a writeable root which only contains /etc, an > immutable /usr and a temporary /var. Though I guess that can be covered > with the existing DPS...? That's pretty much the same as 2, except that /var is overmounted with a tmpfs. i.e. you would simply place /etc/fstab in there, that says /var is tmpfs. > > It was our assumption that these three cases should cover most > > intended behaviours nicely, i.e. systems with modifiable config, code > > and state. systems with modifiable config and state, but immutable > > code. And finally systems with immutable config and code, but > > modifiable state. > > > > A system where /etc/ was separate from the root fs is not covered by > > the above, because it is not clear what that would get us. if you want > > it immutable, why not stick it on an immutable root fs. And if you > > want it writable, why not stick it on a writable root fs directly? > > My use case is basically 2, /etc has to be writeable to persist the > machine-id across reboots, /var also has to be writeable and /usr can be > immutable. > > The problem I am then likely facing is that I create the partitions wrong. > I am using mkosi and tried several different repart.d configuration with > type=root+type=usr, type=root+type=var+type=use, and different CopyFiles= > and Exclude(Target)Files= but none of them seemed to have worked. if your /var/ is supposed to be a tmpfs, then don't mention it to mkosi/repart, just put an /etc/fstab into place that dicates /var is mounted as tmpfs. Other than that you should just be able to use Type=root and Type=usr then. > Are there special requirements for what the respective partitions must or > shall not contain when using several auto-discovered partitions? Or should > I ask on the mkosi issue tracker? If you have just root + usr then this should be a pretty common situation for mkosi, it's not special and should just work. Lennart -- Lennart Poettering, Berlin
Re: [systemd-devel] systemd-repart /etc automount via discoverable partition specification
On Mon, Sep 11, 2023, 10:54 Lennart Poettering wrote: > On So, 10.09.23 00:33, Nils Kattenbeck (nilskem...@gmail.com) wrote: > > > Hello, I am currently trying to build a linux image with discoverable > > partitions in an A/B+etc+var scheme. > > The discoverable partition scheme has no concept of /etc/ discovery. It > focusses on three basic setups: > > 1. writable root fs that contains /etc/, /var/ and /usr/ directly. > 2. writable root fs that contains /etc/ and /var/ and gets an >immutable /usr/ mounted in > 3. immutable root fs that contains /etc/ and /usr/ directly and gets a >writable /var/ mounted in. (the latter possibly as tmpfs, for truly >stateless systems) There is also 4. with a writeable root which only contains /etc, an immutable /usr and a temporary /var. Though I guess that can be covered with the existing DPS...? It was out assumption that these three cases should cover most > intended behaviours nicely, i.e. systems with modifiable config, code > and state. systems with modifiable config and state, but immutable > code. And finally systems with immutable config and code, but > modifiable state. > > A system where /etc/ was separate from the root fs is not covered by > the above, because it is not clear what that would get us. if you want > it immutable, why not stick it on an immutable root fs. And if you > want it writable, why not stick it on a writable root fs directly? My use case is basically 2, /etc has to be writeable to persist the machine-id across reboots, /var also has to be writeable and /usr can be immutable. The problem I am then likely facing is that I create the partitions wrong. I am using mkosi and tried several different repart.d configuration with type=root+type=usr, type=root+type=var+type=use, and different CopyFiles= and Exclude(Target)Files= but none of them seemed to have worked. Are there special requirements for what the respective partitions must or shall not contain when using several auto-discovered partitions? Or should I ask on the mkosi issue tracker? Kind regards, Nils >
Re: [systemd-devel] systemd-repart /etc automount via discoverable partition specification
On So, 10.09.23 00:33, Nils Kattenbeck (nilskem...@gmail.com) wrote: > Hello, I am currently trying to build a linux image with discoverable > partitions in an A/B+etc+var scheme. The discoverable partition scheme has no concept of /etc/ discovery. It focusses on three basic setups: 1. writable root fs that contains /etc/, /var/ and /usr/ directly. 2. writable root fs that contains /etc/ and /var/ and gets an immutable /usr/ mounted in 3. immutable root fs that contains /etc/ and /usr/ directly and gets a writable /var/ mounted in. (the latter possibly as tmpfs, for truly stateless systems) It was out assumption that these three cases should cover most intended behaviours nicely, i.e. systems with modifiable config, code and state. systems with modifiable config and state, but immutable code. And finally systems with immutable config and code, but modifiable state. A system where /etc/ was separate from the root fs is not covered by the above, because it is not clear what that would get us. if you want it immutable, why not stick it on an immutable root fs. And if you want it writable, why not stick it on a writable root fs directly? The design of saying "/etc/ is always part of the rootfs" is also reflecting the fact that /etc/fstab is the map of secondary file systems to mount, i.e. it generally contains references to other file systems that take precedence over the discoverable partition spec, and hence it is crucial that we place it on the first item in the chain so that we can take it into account before looking for other items in the chain. > I know that /usr and /var have a > corresponding partition UUID for automatically mounting them as per > DPS. However, I am not sure how to mount the /etc partition? Do I have > to specify it as the root partition and exclude /usr and /var in it? > Any help would be appreciated. If you want /etc/ split off, then the discoverable partition spec won't help you: you have to mount it explicitly from your initrd. Lennart -- Lennart Poettering, Berlin
[systemd-devel] systemd-repart /etc automount via discoverable partition specification
Hello, I am currently trying to build a linux image with discoverable partitions in an A/B+etc+var scheme. I know that /usr and /var have a corresponding partition UUID for automatically mounting them as per DPS. However, I am not sure how to mount the /etc partition? Do I have to specify it as the root partition and exclude /usr and /var in it? Any help would be appreciated. Kind regards, Nils