summaryrefslogtreecommitdiffstats
path: root/src/fstab-generator (follow)
Commit message (Collapse)AuthorAgeFilesLines
* fstab-generator: add more parameter name commentsLennart Poettering2023-07-041-3/+3
|
* fstab-generator: optional read addtional fstab lines from credentialsLennart Poettering2023-07-041-0/+39
| | | | Fixes: #27260
* fstab-generator: if we mount via roothash=/usrhash= let's imply "ro" mount ↵Lennart Poettering2023-06-021-4/+14
| | | | | | | | | | | | | | | | | option If we discover the root or /usr/ fs via roothash=/usrhash= we know the file system mounted on it will be read-only, since Verity volumes are by definition immutable. Hence, let's imply the "ro" mount option for them. This way the "kernel: /dev/mapper/usr: Can't open blockdev" boot-time log message goes away, reported here: https://github.com/systemd/systemd/issues/27682 (I do wonder though why erofs even tries to open the block device as writable, that sounds utterly pointless for a file system that carries the fact it is read-only even in the name...)
* fstab-generator: use correct swap name varFrantisek Sumsal2023-05-261-1/+1
| | | | Follow-up to 9445623363.
* fstab-generator: support defining mount units through kernel command lineYu Watanabe2023-05-241-5/+159
| | | | | | | | Now, the following kernel command line options are supported: systemd.mount-extra=what:where:fstype:options systemd.swap-extra=what:options Closes #27260.
* fstab-generator: fix error code propagation in run_generator()Yu Watanabe2023-05-241-8/+21
| | | | Previously, some errors might be ignored.
* fstab-generator: refuse invalid mount point path in fstab earlierYu Watanabe2023-05-241-34/+34
|
* fstab-generator: refuse to add swap earlier if disabledYu Watanabe2023-05-241-5/+4
| | | | No functional change, preparation for later commits.
* fstab-generator: call add_swap() earlierYu Watanabe2023-05-241-6/+15
| | | | As 'where' field will be ignored for swap entry.
* fstab-generator: split out several functions from parse_fstab()Yu Watanabe2023-05-241-153/+173
| | | | | No functional changes, just refactoring and preparation for later commits.
* fstab-generator: Fix log messageDaan De Meyer2023-05-111-1/+1
|
* fstab-generator: Unset kernel cmdline options if empty value is givenDaan De Meyer2023-05-111-6/+6
|
* fstab-generator: Take systemd.verity= into accountDaan De Meyer2023-05-111-0/+12
| | | | Disable verity logic if systemd.verity= switch is disabled.
* fstab-generator: add missing phrase in commentZbigniew Jędrzejewski-Szmek2023-04-181-1/+1
|
* fstab-generator: don't propagate ignored errnoFrantisek Sumsal2023-04-061-4/+4
| | | | | | With certain fstabs we may propagate ENXIO from the $SYSTEMD_SYSFS_CHECK check all the way up, making fstab-generator exit with a non-zero EC and without any helpful message, which is really confusing.
* chase-symlinks: Rename chase_symlinks() to chase()Daan De Meyer2023-03-241-5/+4
| | | | | | | | | Chasing symlinks is a core function that's used in a lot of places so it deservers a less verbose names so let's rename it to chase() and chaseat(). We also slightly change the pattern used for the chaseat() helpers so we get chase_and_openat() and similar.
* src: changed instances of sd_bus_call_method() to bus_call_method() (#26819)OMOJOLA JOSHUA2023-03-151-8/+1
| | | * src: changed instances of sd_bus_call_method() to bus_call_method()
* Merge pull request #26038 from ↵Zbigniew Jędrzejewski-Szmek2023-03-091-16/+59
|\ | | | | | | | | lilyinstarlight/fix/fstab-generator-sysroot-without-cmdline fstab-generator: use correct targets when /sysroot is specificied in fstab only
| * fstab-generator: add SYSTEMD_SYSFS_CHECK env varLily Foster2023-01-261-2/+10
| | | | | | | | | | This forces processing of /dev entries in fstab when running in a container is detected (checked as the existence of read-only /sys).
| * fstab-generator: use correct targets when /sysroot is specificied in fstab onlyLily Foster2023-01-261-14/+49
| |
* | shared/efi-loader: fix compilation with !ENABLE_EFI, improve messagesZbigniew Jędrzejewski-Szmek2023-01-251-5/+3
|/ | | | | | | | | | | | When compiled without ENABLE_EFI, efi_stub_measured() was not defined, so compilation would fail. But it's not enough to add a stub that returns -EOPNOTSUPP. We call this function in various places and usually print the error at warning or error level, so we'd print a confusing message. We also can't add a stub that always returns 0, because then we'd print a message like "Kernel stub did not measure", which would be confusing too. Adding special handling for -EOPNOTSUPP in every caller is also unattractive. So instead efi_stub_measured() is reworked to log the warning or error internally, and such logging is removed from the callers, and a stub is added that logs a custom message.
* tpm2: add common helper for checking if we are running on UKI with TPM ↵Lennart Poettering2023-01-171-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | measurements Let's introduce a common implementation of a function that checks whether we are booted on a kernel with systemd-stub that has TPM PCR measurements enabled. Do our own userspace measurements only if we detect that. PCRs are scarce and most likely there are projects which already make use of them in other ways. Hence, instead of blindly stepping into their territory let's conditionalize things so that people have to explicitly buy into our PCR assignments before we start measuring things into them. Specifically bind everything to an UKI that reported measurements. This was previously already implemented in systemd-pcrphase, but with this change we expand this to all tools that process PCR measurement settings. The env var to override the check is renamed to SYSTEMD_FORCE_MEASURE, to make it more generic (since we'll use it at multiple places now). This is not a compat break, since the original env var for that was not included in any stable release yet.
* generators: optionally, measure file systems at bootLennart Poettering2023-01-171-4/+15
| | | | | | If we use gpt-auto-generator, automatically measure root fs and /var. Otherwise, add x-systemd.measure option to request this.
* fstab-generator: use log message that matches realityZbigniew Jędrzejewski-Szmek2022-12-141-2/+2
| | | | | | | | | | | We *assume* that when /sys is read-only, we're running in a container. But there can other reasons, for example root is mount ro and nobody has mounted /sys yet, or somebody forgot to add /sys to the list of filesystem not to remount ro in a sandbox. So let's actually say what we know instead of assuming. systemd-fstab-generator was reporting that it's running in a container and I spent a good few minutes trying to figure out why 'systemd-detect-virt -c' disagrees, before noticing that it's just checking a different condition.
* sysroot: Support x-systemd.makefsWill Fancher2022-12-121-3/+12
|
* basic: create new basic/initrd-util.[ch] for initrd-related functionsZbigniew Jędrzejewski-Szmek2022-11-081-1/+1
| | | | | | | | | I changed imports of util.h to initrd-util.h, or added an import of initrd-util.h, to keep compilation working. It turns out that many files didn't import util.h directly. When viewing the patch, don't be confused by git rename detection logic: a new .c file is added and two functions moved into it.
* fstab-generator: add mode to check /sysroot/etc/fstab and maybe do daemon-reloadZbigniew Jędrzejewski-Szmek2022-07-231-8/+110
| | | | | | | | | | | The idea is that we can peek into /sysroot/etc/fstab and figure out if there's anything interesting there. We could use a separate binary for this, but we'd need to duplicate most of the logic that in systemd-fstab-generator. Thus I think it's nicer to make systemd-fstab-generator work as a multi-call binary. If called as systemd-sysroot-fstab-check, we look for units that we'd mount and call daemon-reload and initrd-fs.target/restart, similarly to what we did before, but in the process itself.
* fstab-generator: do not skip /sysroot prefix if the mount point is missingZbigniew Jędrzejewski-Szmek2022-07-151-4/+16
| | | | | | | | | When chase_symlinks() is called on something on a doesn't exist, it immediately returns an error. But we were relying on it to prepend "/sysroot/". If it fails, we need to do that ourselves. For example, with /sysroot/etc/fstab containing a line for /foo, if /sysroot/foo doesn't exist, we'd generate a mount point for /foo.
* fstab-generator: rename 'post' variableZbigniew Jędrzejewski-Szmek2022-07-151-16/+13
| | | | | | | Originally (6b1dc2bd3cdb3bd932b0692be636ddd2879edb92) we had 'pre' and 'post' to refer to remote-fs-pre.target and remote-fs.target or local-fs-pre.target and local-fs.target. But 'pre' is long gone, and 'post' by itself doesn't make much sense. Rename it for clarity.
* fstab-generator: tweak commentsZbigniew Jędrzejewski-Szmek2022-07-151-2/+2
|
* fstab-generator: allow overriding path to /sysroot/etc/fstab tooZbigniew Jędrzejewski-Szmek2022-07-151-1/+9
| | | | This adds $SYSTEMD_SYSROOT_FSTAB analoguous to $SYSTEMD_FSTAB.
* fstab-generator: properly report the source of dataZbigniew Jędrzejewski-Szmek2022-07-151-22/+23
| | | | | | | | Mount information can come from /etc/fstab, /sysroot/etc/fstab, and /proc/cmdline. Even when we had the path to the right source handy, we would often write something inaccurate. In particular, in the initrd, we would generally write "/etc/fstab" instead of "/sysroot/etc/fstab" for no good reason.
* fstab-generator: use path_equal() to detect alternate spellings of /usrZbigniew Jędrzejewski-Szmek2022-07-151-1/+1
| | | | | In the initrd we would treat e.g. "/usr/" as different from "/usr", which doesn't seem right.
* strv: make iterator in STRV_FOREACH() declaread in the loopYu Watanabe2022-03-191-3/+0
| | | | This also avoids multiple evaluations in STRV_FOREACH_BACKWARDS()
* fstab-generator: use str(n)dupa_safe() instead of plain str(n)dupa()Frantisek Sumsal2022-01-291-2/+2
|
* fstab-generator: also skip other network filesystems and live imageYu Watanabe2022-01-061-0/+15
|
* fstab-generator: skip root directory handling when nfsroot is requestedYu Watanabe2022-01-061-2/+57
| | | | Fixes RHBZ#2037233 (https://bugzilla.redhat.com/show_bug.cgi?id=2037233).
* fstab-generator: do not remount /sys when running in a containerYu Watanabe2021-12-141-3/+10
| | | | Closes #21744.
* Merge pull request #20598 from tomty89/order_noautoZbigniew Jędrzejewski-Szmek2021-12-111-2/+1
|\ | | | | fstab-generator, core/mount: Avoid special fs target before dependency only if nofail is used
| * fstab-generator: also order noauto or automount mount units before "post" ↵Tom Yan2021-09-011-2/+1
| | | | | | | | | | | | | | | | target units The ordering should not prevent noauto or automount from working as expected, and we do not want them to be stopped too early if they are active.
* | fstab-generator: use 'usr' mapper device when 'usrhash' is presentMark Boudreau2021-11-191-7/+28
| | | | | | | | | | If 'usrhash' is present as a kernel command line parameter, use the usr mapper device for usr mount
* | basic: spit out chase_symlinks() from fs-util.[ch] → chase-symlinks.[ch]Lennart Poettering2021-10-051-1/+1
|/
* fstab-generator: Respect nofail when orderingVladimir Panteleev2021-08-181-1/+2
|
* fstab-generator: put What= before Where=Zbigniew Jędrzejewski-Szmek2021-08-101-4/+4
| | | | | | | | All units in units/ follow this pattern, as do all other generators that we provide. The question of the order was raised in https://github.com/systemd/zram-generator/pull/90#discussion_r684965984, and I think it's nice to make it consistent everywhere (What= before Where= matches mount(8) and fstab(5)).
* tree-wide: add FORMAT_TIMESPAN()Zbigniew Jędrzejewski-Szmek2021-07-091-2/+1
|
* tree-wide: always drop unnecessary dot in pathYu Watanabe2021-05-281-1/+1
|
* meson: use jinja2 for rpm templatesZbigniew Jędrzejewski-Szmek2021-05-191-1/+1
| | | | | | | The naming of variables is very inconsistent. I tried to use more modern style naming (UNDERSCORED_TITLE_CASE), but I didn't change existing names too much. Only SYSTEM_DATA_UNIT_PATH is renamed to SYSTEM_DATA_UNIT_DIR to match SYSTEM_CONFIG_UNIT_DIR.
* fstab-generator: clean up mount point flags handlingLennart Poettering2021-04-231-39/+48
| | | | | | | | | | | | Let's rename MountpointsFlags → MountPointFlags. In most of our codebase we name things mount_point/MountPoint rather than mountpoint/Mountpoint, do so here too. Also, prefix the enum values with "MOUNT_". The fact the enum values weren#t prefixed was pretty unique in our codebase, and pretty surprising. Let's fix that. This is just refactoring, no actual change in behaviour
* fstab-generator: properly order generated mount units before "post" target unitsLennart Poettering2021-04-201-0/+5
| | | | | | Let's make sure, that our mount unit are properly ordered before the "post" target unit even if DefaultDependencies= is used on the target unit.
* fstab-generator: extend logging a bitLennart Poettering2021-04-201-1/+1
|