summaryrefslogtreecommitdiff
path: root/src/fstab-generator
Commit message (Collapse)AuthorAge
* fstab-generator: don't accept missing root=, but accept root=noneTobias Hunger2015-03-25
| | | | | | | | | | | | | | | | | | | | | | | And other non-device entries (like fstab does). Mount whatever the user asked to be mounted on / on the kernel command line. Do less sanity check and do *not* bail out when the mount device looks strange or does not exist. This basically makes the changes for deviceless filesystems from yesterday unnecessary and is in line with what we do for filesystems set up in fstab. Remove some code that is now dead (reverting fb02a2775a65 and b0438462). [tomegun: - change patch title/description a bit. - don't touch the /usr logic, that would be a separate change and we don't currently have a convincing use-case for that. - don't bail out on /sys ro. This only makes sense in containers, where we would not be doing this anyway. If there is a use-case we could consider that as a separate patch.]
* fstab-generator: Support root on tmpfs (or other deviceless FS)Tobias Hunger2015-03-24
| | | | This allows for stateless systems.
* fstab-generator: ignore invalid swap priorityZbigniew Jędrzejewski-Szmek2015-03-21
| | | | | | | | | | | | A failed priority is not something worth stopping boot over. Most people have only one swap device, in which case priority is irrelevant, and even if there is more than one swap device, they are all usable, and ignoring the priority field should only result in some loss of performance. The kernel will report the priority as -1 if not set, so it's easy for people to make this mistake. https://bugzilla.redhat.com/show_bug.cgi?id=1204336
* remove unused includesThomas Hindoe Paaboel Andersen2015-02-23
| | | | | | This patch removes includes that are not used. The removals were found with include-what-you-use which checks if any of the symbols from a header is in use.
* util: rework strappenda(), and rename it strjoina()Lennart Poettering2015-02-03
| | | | | | After all it is now much more like strjoin() than strappend(). At the same time, add support for NULL sentinels, even if they are normally not necessary.
* Support negated fstab optionsZbigniew Jędrzejewski-Szmek2015-01-11
| | | | | | | | | We would ignore options like "fail" and "auto", and for any option which takes a value the first assignment would win. Repeated and options equivalent to the default are rarely used, but they have been documented forever, and people might use them. Especially on the kernel command line it is easier to append a repeated or negated option at the end.
* Add new function to filter fstab optionsZbigniew Jędrzejewski-Szmek2015-01-11
| | | | | | | | | | | | | | | | | | | | This fixes parsing of options in shared/generator.c. Existing code had some issues: - it would treate whitespace and semicolons as seperators. fstab(5) is pretty clear that only commas matter. And the syntax does not allow for spaces to be inserted in the field in fstab. Whitespace might be escaped, but then it should not seperate options. Treat whitespace and semicolons as any other character. - it assumed that x-systemd.device-timeout would always be followed by "=". But this is not guaranteed, hasmntopt will return this option even if there's no value. Uninitialized memory could be read. - some error paths would log, and inconsistently, some would just return an error code. Filtering is split out to a separate function and tests are added. Similar code paths in other places are adjusted to use the new function.
* fstab-generator: use more appropriate checks for swap and device availabilityLennart Poettering2015-01-05
| | | | | | | | | | | We always should use the same checks when deciding whether swap support and mounting of devices is supported. Hence, let's make fstab-generator's logic more similar to the usual logic we follow: a) Look for /proc/swaps and no container support before activating swaps. b) Look for /sys being writable befire supporting device mounts.
* fstab-generator: Allow mount.usr without mount.usrflags, honor rw/roMichael Marineau2014-12-09
| | | | | | | | | There is no need to require mount.usrflags. The original implementation assumed that a btrfs subvolume would always be needed but that is not applicable to systems that do not use btrfs for /usr. Similar to using rootflags= for the default of mount.usrflags=, append the classic 'ro' and 'rw' flags to the mount options.
* fstab-generator: free all allocated stringsLennart Poettering2014-12-09
|
* treewide: another round of simplificationsMichal Schmidt2014-11-28
| | | | | Using the same scripts as in f647962d64e "treewide: yet more log_*_errno + return simplifications".
* treewide: use log_*_errno whenever %m is in the format stringMichal Schmidt2014-11-28
| | | | | | | | | | | If the format string contains %m, clearly errno must have a meaningful value, so we might as well use log_*_errno to have ERRNO= logged. Using: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/' Plus some whitespace, linewrap, and indent adjustments.
* treewide: more log_*_errno + return simplificationsMichal Schmidt2014-11-28
|
* treewide: no need to negate errno for log_*_errno()Michal Schmidt2014-11-28
| | | | It corrrectly handles both positive and negative errno values.
* treewide: auto-convert the simple cases to log_*_errno()Michal Schmidt2014-11-28
| | | | | | | | | | | | | As a followup to 086891e5c1 "log: add an "error" parameter to all low-level logging calls and intrdouce log_error_errno() as log calls that take error numbers", use sed to convert the simple cases to use the new macros: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/' Multi-line log_*() invocations are not covered. And we also should add log_unit_*_errno().
* swap: restore support for nofailZbigniew Jędrzejewski-Szmek2014-11-26
| | | | | | | | | | | | | | | | systemd stops adding automatic dependencies on swap.target to swap units. If a dependency is required, it has to be added by unit configuration. fstab-generator did that already, except that now it is modified to create a Requires or Wants type dependency, depending on whether nofail is specified in /etc/fstab. This makes .swap units obey the nofail/noauto options more or less the same as .mount units. Documentation is extended to clarify that, and to make systemd.mount(5) and system.swap(5) more similar. The gist is not changed, because current behaviour actually matches existing documentation. https://bugs.freedesktop.org/show_bug.cgi?id=86488
* util: simplify proc_cmdline() to reuse get_process_cmdline()Lennart Poettering2014-11-07
| | | | Also, make all parsing of the kernel cmdline non-fatal.
* s/commandline/command line/gHarald Hoyer2014-11-06
|
* swap: replace Discard= setting by a more generic Options= settingLennart Poettering2014-10-28
| | | | | | For now, it's systemd itself that parses the options string, but as soon as util-linux' swapon can take the option string directly with -o we should pass it on unmodified.
* fstab-generator: Honor mount.usr*= on kernel command lineTobias Hunger2014-10-10
| | | | | | This allows to configure boot loader entries for systems where the root and usr filesystems are in different subvolumes (or even on different drives).
* fstab-generator: Small cleanupTobias Hunger2014-10-03
|
* fstab-generator: properly deal with discard as non-last optionZbigniew Jędrzejewski-Szmek2014-09-29
| | | | | | | | Previous code would only return correct results when discard was the last option. While at it, avoid incorrect behaviour for (invalid) 'pri' option not followed by '=...', and also do not return -1 as the error code.
* swap: introduce Discard propertyJan Synacek2014-09-29
| | | | Process possible "discard" values from /etc/fstab.
* util: allow strappenda to take any number of argsDave Reisner2014-08-13
| | | | | This makes strappenda3 redundant, so we remove its usage and definition. Add a few tests along the way for sanity.
* fstab-generator: fix trivial leakZbigniew Jędrzejewski-Szmek2014-07-07
|
* fstab-generator: allow x-systemd.device-timeout for swap unitsZbigniew Jędrzejewski-Szmek2014-06-30
|
* Move x-systemd-device.timeout handling from core to fstab-generatorZbigniew Jędrzejewski-Szmek2014-06-30
| | | | | | | | | | | | | Instead of adjusting job timeouts in the core, let fstab-generator write out a dropin snippet with the appropriate JobTimeout. x-systemd-device.timeout option is removed from Options= line in the generated unit. The functions to write dropins are moved from core/unit.c to shared/dropin.c, to make them available outside of core. generator.c is moved to libsystemd-label, because it now uses functions defined in dropin.c, which are in libsystemd-label.
* fstab-generator: simplify add_root_mountZbigniew Jędrzejewski-Szmek2014-06-23
|
* stop complaining about unknown kernel cmdline optionsLennart Poettering2014-06-19
| | | | | Also stop warning about unknown kernel cmdline options in the various tools, not just in PID 1
* fstab-generator: when running in a container, ignore fstab entries referring ↵Lennart Poettering2014-03-11
| | | | | | | | | | | to device nodes Since these device nodes will never appear in the container anyway there's no point in waiting for them. This makes it easier to boot images generated with general purpose installers like Anaconda which unconditionally populate /etc/fstab to boot in containers.
* fstab-generator: the root partition is not optionalLennart Poettering2014-03-07
|
* fstab-generator: merge /proc/cmdline parsing loops into oneLennart Poettering2014-03-07
|
* generators: add Documentation= fields that point to the generator man pagesLennart Poettering2014-03-06
|
* util: move more intellegince into parse_proc_cmdline()Lennart Poettering2014-03-06
| | | | | Already split variable assignments before invoking the callback. And drop "rd." settings if we are not in an initrd.
* generators: rework mount generatorsLennart Poettering2014-03-06
| | | | | | | | | | | | | - Add support for finding and mounting /srv based on GPT data, similar to how we already handly /home. - Share the fsck logic between GPT, EFI and fstab generators - Make sure we never run the EFI generator inside containers - Drop DefaultDependencies=no from EFI mount units - Other fixes
* Extract looping over /proc/cmdline into a shared functionZbigniew Jędrzejewski-Szmek2014-02-17
| | | | | | | In cryptsetup-generator automatic cleanup had to be replaced with manual cleanup, and the code gets a bit longer. But existing code had the issue that it returned negative values from main(), which was wrong, so should be reworked anyway.
* fstab-generator: Create fsck-root symlink with correct pathColin Guthrie2014-02-10
| | | | | | This was noticed in Brussels at the hackfest. The fstab-generator currently creates a broken symlink pointing to itself in /run/systemd/generator/local-fs.target.wants/ for systemd-fsck-root.service
* fstab-generator: Do not try to fsck non-devicesThomas Bächler2013-12-21
| | | | | | This fixes a regression introduced in 64e70e4 where the mount fails when fstab is misconfigured with fs_passno > 0 on a virtual file system like nfs, and the type is specified as "auto".
* fstab-generator: use RequiresOverridable for fsck unitsZbigniew Jędrzejewski-Szmek2013-11-15
| | | | | | | | | | | | | | | | | | This allows the user to disable fsck's by masking. If fsck fails, emergency target is started, the user might mount the unit using mount and disable fsck by masking the unit. In this case, .mount will be active because the mount is detect through /proc/self/mountinfo, but systemd-fsck@.service will still be in failed mode. This results in a funny situation where $ systemctl show -p ActiveState local-fs.target yyy.mount ActiveState=active ActiveState=active $ sudo systemctl start local-fs.target [sudo] password for test: Failed to start local-fs.target: Unit systemd-fsck@xxx.service is masked.
* fsck,fstab-generator: be lenient about missing fsck.<type>Zbigniew Jędrzejewski-Szmek2013-11-15
| | | | | | | | | | | | | If fstab contains 1 for passno, treat this as an error, but only warn briefly. If fstab doesn't contain this information, don't complain at all. Patch is complicated a bit by the fact that we might have the fstype specified in fstab or on /proc/cmdline, in which case we can check if we have the appropriate fsck tool, or not specified, or specified as auto, in which case we have to look and check the type of the filesystem ourselves. It cannot be done before the device appears, so it is too early in the generator phase, and it must be done directly in fsck service.
* util: unify reading of /proc/cmdlineLennart Poettering2013-11-06
| | | | | | Instead of individually checking for containers in each user do this once in a new call proc_cmdline() that read the file only if we are not in a container.
* fsck-root: only run when requested in fstabTom Gundersen2013-10-19
| | | | | | fsck-root is redundant in case an initrd is used, or in case the rootfs is never remounted 'rw', so the new default is the correct behavior for most users. For the rest, they should enable it in fstab.
* fstab-generator: Generate explicit dependencies on systemd-fsck@.service ↵Thomas Bächler2013-10-19
| | | | | | | | | instead of using FsckPassNo [tomegun: * order all fsck instances after fsck-root * check for OOM * added notes in the manpages]
* fstab-generator: When parsing the root= cmdline option, set FsckPassNo to 1Thomas Bächler2013-10-19
| | | | | | [tomegun: without this we would never fsck the rootfs if it was directly mounted 'rw' from the initrd. We now risk fsck'ing it twice in the case it is mounted 'ro', so that should be addressed in a separate patch.]
* Introduce _cleanup_endmntent_Zbigniew Jędrzejewski-Szmek2013-10-03
|
* Remove six unused variables and add annotationZbigniew Jędrzejewski-Szmek2013-09-17
| | | | clang FTW!
* swap: create .wants symlink to 'auto' swap devicesTom Gundersen2013-09-16
| | | | | | | | | | | As we load unit files lazily, we need to make sure something pulls in swap units that should be started automatically, otherwise the default dependencies will never be applied. This partially reinstates code removed in commit 64347fc2b983f33e7efb0fd2bb44e133fb9f30f4. Also don't order swap devices after swap.target when they are 'nofail'.
* swap: handle nofail/noauto in coreTom Gundersen2013-09-11
|
* mount: move device links handling from generatorTom Gundersen2013-09-11
| | | | | | | This makes mount units work like swap units: when the backing device appears the mount unit will be started. v2: the device should want the mount unconditionally, not only for DefaultDependencies=yes
* fstab-generator: use DefaultDependencies=yesTom Gundersen2013-09-11
| | | | This removes some redundancy between the generator and the core mount handling.