summaryrefslogtreecommitdiffstats
path: root/src/fstab-generator (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Replace strdup_or_null() by strdup_to()Zbigniew Jędrzejewski-Szmek2024-03-201-7/+2
| | | | | | I didn't know that this helper existed… It is very similar to strdup_to_full(), but all callers can actually be replaced by strdup_to(), which has more fitting semantics.
* units: make templates for quotaon and systemd-quotacheck serviceThomas Blume2024-03-091-1/+16
|
* extract-word: modernize extract_many_wordsMike Yuan2024-03-031-2/+2
|
* env-util: rename getenv_bool_secure() → secure_getenv_bool()Lennart Poettering2024-02-281-1/+1
| | | | | | The glibc API is behind the wrapper is called "secure_getenv()", hence our wrapper really should keep the order too, otherwise things are just too confusing.
* fstab-generator: drop unapplicable options for /usr/ tooMike Yuan2024-01-251-3/+3
| | | | | | | We already drop these for /sysroot/usr/ in parse_fstab (1e9b2e4fdd8d04e3fbfadbc0b92dc138c819c221). Let's make things consistent, and do the same for /usr/ too (after switch-root).
* fstab-generator: modernize write_extra_dependenciesMike Yuan2024-01-251-66/+75
|
* fstab-generator: add missing assertionsMike Yuan2024-01-251-0/+5
|
* fstab-generator: drop unneeded initializationMike Yuan2024-01-251-1/+1
|
* fstab-generator: drop assertions for mount optsMike Yuan2024-01-251-9/+6
| | | | | fstab_filter_options accepts NULL and (with later changes) might even return NULL.
* fstab-generator: disable default deps if x-systemd.{wanted,required}-by= is usedMike Yuan2023-12-111-25/+44
| | | | Fixes #30273
* core: add WantsMountsFor=Luca Boccassi2023-11-291-4/+9
| | | | | | | | This is the equivalent of RequiresMountsFor=, but adds Wants= instead of Requires=. It will be useful for example for the autogenerated systemd-cryptsetup units. Fixes https://github.com/systemd/systemd/issues/11646
* fstab-generator: drop unapplicable mount options for / from mount unit Options=Mike Yuan2023-10-271-20/+48
| | | | | | | | Prompted by #29705 Note that x-systemd.wanted-by= and x-systemd.required-by= are not dropped, since we ignore them because they are unnecessary rather than unapplicable.
* fstab-generator: use RET_GATHER moreMike Yuan2023-10-271-64/+41
|
* fstab-generator: drop nofail and noauto options for critical mountsMichal Sekletar2023-10-271-1/+12
| | | | | | | | Setting nofail for /usr mount doesn't make sense because without /usr we can't really boot. However, having the flag set might cause races in initrd where we could try to switchroot into rootfs before /usr is actually mounted. Let's just ignore it so that we always have proper mount unit ordering for /sysroot/usr mount.
* efi-loader: rename efi_stub_measured() → efi_measured_uki()Lennart Poettering2023-09-271-1/+1
| | | | | | | | | | Let's say "uki" rather than "stub", since that is just too generic, and we shouldn't limit us to our own stub anyway, but generally define a concept of a "measured UKI", which is a UKI that measures its part to PCR 11. This is mostly preparation for exposing this check to the user via ConditionSecurity=.
* fstab-generator: update cache in fstab_enabled_full() based on the parsed ↵Yu Watanabe2023-08-091-1/+1
| | | | | | | | result of fstab= Currently, fstab-generator does not use fstab file parsers in fstab-util.c. So, this is not necessary. Just for a possible optimization in the case the parsers used in the future.
* Merge pull request #28727 from yuwata/proc-cmdline-cleanupsLuca Boccassi2023-08-091-0/+2
|\ | | | | tree-wide: fixlet and optimization for parsing kernel command line
| * tree-wise: drop unnecessary use of proc_cmdline_key_streq()Yu Watanabe2023-08-081-0/+2
| | | | | | | | | | | | | | If the key does not contain '-' or '_', then it is not necessary to use proc_cmdline_key_streq(), and streq() is sufficient. This also adds missing assertions about 'key' argument.
* | meson: use install_emptydir() and drop meson-make-symlink.shYu Watanabe2023-08-081-3/+3
|/ | | | | | The script is mostly equivalent to 'mkdir -p' and 'ln -sfr'. Let's replace it with install_emptydir() builtin function and inline meson call.
* meson: move declarations of several generatorsYu Watanabe2023-07-311-0/+12
|
* Merge pull request #28359 from keszybz/ret-gatherDaan De Meyer2023-07-281-2/+1
|\ | | | | Add RET_GATHER macro to make continue-but-remember-first-error functions easier
| * various: use RET_GATHERZbigniew Jędrzejewski-Szmek2023-07-131-2/+1
| | | | | | | | No functional change indentended.
* | fstab-generator: enable fsck for block device mounts specified in ↵Yu Watanabe2023-07-281-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | systemd.mount-extra= Like we do for root= or so. Another possible option is adding support of fifth (sixth?) field in systemd.mount-extra=. But that may be overkill, hence let's do that later if someone request that. Fixes fsck part of issue #28541.
* | fstab-generator: add a flag to accept entry for "/" in initrdYu Watanabe2023-07-261-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When both prefix_sysroot and accept_root is true, the entry for "/" will be accepted and converted to "/sysroot/". Why? If the entry is read from the main system's fstab, then we already mounted /sysroot/, hence it is not and should not re-add the .mount unit for /sysroot/. However, if we want to specify the root mount through the kernel command line or credential, without this change, we need to specify the same entry in the two options. E.g. === systemd.mount-extra=/dev/sda1:/:auto:defaults rd.systemd.mount-extra=/dev/sda1:/sysroot:auto:defaults === That's inconvenient. Of course, we can dedup that by using traditional options, but cannot when defined in credential.
* | fstab-generator: read both credentials in initrdYu Watanabe2023-07-261-4/+12
| | | | | | | | | | | | This makes the behavior consistent with the way we already do for fstab and command line options. In initrd, entries read from fstab.extra are mounted under /sysroot.
* | fstab-generator: add rd.systemd.mount-extra= and friendsYu Watanabe2023-07-261-10/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously, mounts specified in systemd.mount-extra= are equally handled both in initrd and the main system. So, the mounts for the main system are also mounted in initrd. This introduces rd.systemd.mount-extra=, which specifies mounts in initrd. Then, mounts specified in systemd.mount-extra= are still mounted both in initrd and the main system, but prefixed with /sysroot/ when running in initrd. Fixes #28516.
* | fstab-generator: fix target of /sysroot/usrYu Watanabe2023-07-261-1/+1
| | | | | | | | | | | | If /usr mount is picked from the main system's fstab file (prefix_sysroot is true, and the path is prefixed as /sysroot/usr), then previously it was installed in the wrong target unit.
* | fstab-generator: rename 'initrd' flag to 'prefix_sysroot'Yu Watanabe2023-07-251-17/+17
| | | | | | | | The name 'initrd' is confusing with 'in_initrd()'.
* | fstab-generator: resolve bind mount source when in initrdMike Yuan2023-07-131-27/+53
|/ | | | | | | | | We currently prepend /sysroot to mount points for entries in /sysroot/etc/fstab. But when it comes to bind mounts, the source needs to canonicalized too. Fixes #6827 Replaces #7894
* bus-unit-util: add common code for reloading PID 1Lennart Poettering2023-07-101-7/+3
| | | | | | We have this very similar code in various places, and it#s not entirely obvious (since we want a prolonged timeout for the reload), hence unify this at one place.
* fstab-generator: unify initrd-root-device.target dependency handling codeLily Foster2023-07-071-12/+6
| | | | | | This fixes a bug from #26038 where it would actually write generator stuff during sysroot check when it was only supposed to check for daemon reload.
* 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).