summaryrefslogtreecommitdiff
path: root/src/fstab-generator
AgeCommit message (Collapse)Author
2014-02-17Extract looping over /proc/cmdline into a shared functionZbigniew Jędrzejewski-Szmek
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.
2014-02-10fstab-generator: Create fsck-root symlink with correct pathColin Guthrie
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
2013-12-21fstab-generator: Do not try to fsck non-devicesThomas Bächler
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".
2013-11-15fstab-generator: use RequiresOverridable for fsck unitsZbigniew Jędrzejewski-Szmek
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.
2013-11-15fsck,fstab-generator: be lenient about missing fsck.<type>Zbigniew Jędrzejewski-Szmek
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.
2013-11-06util: unify reading of /proc/cmdlineLennart Poettering
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.
2013-10-19fsck-root: only run when requested in fstabTom Gundersen
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.
2013-10-19fstab-generator: Generate explicit dependencies on systemd-fsck@.service ↵Thomas Bächler
instead of using FsckPassNo [tomegun: * order all fsck instances after fsck-root * check for OOM * added notes in the manpages]
2013-10-19fstab-generator: When parsing the root= cmdline option, set FsckPassNo to 1Thomas Bächler
[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.]
2013-10-03Introduce _cleanup_endmntent_Zbigniew Jędrzejewski-Szmek
2013-09-17Remove six unused variables and add annotationZbigniew Jędrzejewski-Szmek
clang FTW!
2013-09-16swap: create .wants symlink to 'auto' swap devicesTom Gundersen
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'.
2013-09-11swap: handle nofail/noauto in coreTom Gundersen
2013-09-11mount: move device links handling from generatorTom Gundersen
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
2013-09-11fstab-generator: use DefaultDependencies=yesTom Gundersen
This removes some redundancy between the generator and the core mount handling.
2013-08-14fstab-generator: log_oom() if automount_name is nullWANG Chao
2013-08-09fstab-generator: read rd.fstab=on/off switch correctlyWANG Chao
2013-08-09fstab-generator: respect noauto/nofail when adding sysroot mountWANG Chao
Currently we don't respect noauto/nofail root mount options (from rootflags kernel cmdline). We should map these two flags to the corresponding boolean variable noauto and nofail when calling add_mount().
2013-04-18move _cleanup_ attribute in front of the typeHarald Hoyer
http://lists.freedesktop.org/archives/systemd-devel/2013-April/010510.html
2013-03-29Always use errno > 0 to help gccZbigniew Jędrzejewski-Szmek
gcc thinks that errno might be negative, and functions could return something positive on error (-errno). Should not matter in practice, but makes an -O4 build much quieter.
2013-03-29unit: replace remote-fs-setup.target by network-online.targetLennart Poettering
https://bugzilla.redhat.com/show_bug.cgi?id=787314
2013-03-26fstab-generator: drop x-initrd.rootfs mount optionHarald Hoyer
x-initrd.mount now has different meanings, if fstab-generator is called in the initramfs. initrd:/etc/fstab and x-initrd.mount defines mounts for the initrd-root-fs.target initrd:/sysroot/etc/fstab and x-initrd.mount defines mounts for the initrd-fs.target
2013-03-26fstab-generator: degrade the message about missing "root=" to log_debugHarald Hoyer
Some installation media (fedora at least) does not have and need a "root=" argument on the kernel command line.
2013-03-25units: introduce remote-fs-setup.target to pull in dependencies from remote ↵Lennart Poettering
mounts This introduces remote-fs-setup.target independently of remote-fs-pre.target. The former is only for pulling things in, the latter only for ordering. The new semantics: remote-fs-setup.target: is pulled in automatically by all remote mounts. Shall be used to pull in other units that want to run when at least one remote mount is set up. Is not ordered against the actual mount units, in order to allow activation of its dependencies even 'a posteriori', i.e. when a mount is established outside of systemd and is only picked up by it. remote-fs-pre.target: needs to be pulled in automatically by the implementing service, is otherwise not part of the initial transaction. This is ordered before all remote mount units. A service that wants to be pulled in and run before all remote mounts should hence have: a) WantedBy=remote-fs-setup.target -- so that it is pulled in b) Wants=remote-fs-pre.target + Before=remote-fs-pre.target -- so that it is ordered before the mount point, normally.
2013-03-25fstab-generator: add missing strempty() callsMantas Mikulėnas
2013-03-25fstab-generator: fix minor memory leak on error pathLennart Poettering
2013-03-25fstab-generator: add missing OOM checkLennart Poettering
2013-03-25fstab-generator: rename x-initrd-rootfs.mount to x-initrd.rootfsLennart Poettering
This changes the fstab mount option x-initrd-rootfs.mount to x-initrd.rootfs, in order to only use a single namespace "x-initrd." for all mount options of the initrd.
2013-03-15Make initrd.target the default target in the initrdHarald Hoyer
First, rename root-fs.target to initrd-root-fs.target to clarify its usage. Mount units with "x-initrd-rootfs.mount" are now ordered before initrd-root-fs.target. As we sometimes construct /sysroot mounts in /etc/fstab in the initrd, we want these to be mounted before the initrd-root-fs.target is active. initrd.target can be the default target in the initrd. (normal startup) : : v basic.target | ______________________/| / | | sysroot.mount | | | v | initrd-root-fs.target | | | v | initrd-parse-etc.service (custom initrd services) | | v | (sysroot-usr.mount and | various mounts marked | with fstab option | x-initrd.mount) | | | v | initrd-fs.target | | \______________________ | \| v initrd.target | v initrd-cleanup.service isolates to initrd-switch-root.target | v ______________________/| / | | initrd-udevadm-cleanup-db.service | | (custom initrd services) | | | \______________________ | \| v initrd-switch-root.target | v initrd-switch-root.service | v switch-root
2013-03-13add initrd-fs.target and root-fs.targetHarald Hoyer
Instead of using local-fs*.target in the initrd, use root-fs.target for sysroot.mount and initrd-fs.target for /sysroot/usr and friends. Using local-fs.target would mean to carry over the activated local-fs.target to the isolated initrd-switch-root.target and thus in the real root. Having local-fs.target already active after deserialization causes ordering problems with the real root services and targets. We better isolate to targets for initrd-switch-root.target, which are only available in the initrd.
2013-03-05Revert "fstab-generator: place initrd /sysroot mounts in initrd-fs.target"Harald Hoyer
This reverts commit 8330847e949fc0c26b16910e5240eef1fe2c330a. Conflicts: src/fstab-generator/fstab-generator.c
2013-03-04fstab-generator: only handle block devices with root= kernel command line ↵Harald Hoyer
parameter skip s.th. like root=nfs:... root=iscsi:... root=nbd:...
2013-03-04fstab-generator: place initrd /sysroot mounts in initrd-fs.targetHarald Hoyer
also do not overwrite /sysroot*.mount units already generated from fstab
2013-03-01fstab-generator: initrd - mount selected entries from /sysroot/etc/fstabTom Gundersen
We only mount "/usr" and entries marked with "x-initrd.mount". This (together with the right unit files) is needed in the initramfs in order to natively support mounting /usr (and friends) from the initramfs. The way it is meant to work is: * wait for sysroot.mount to be mounted * do a daemon-reload to generate sysroot-usr.mount (++) from /sysroot/etc/fstab * wait for sysroot-usr.mount to be mounted * switch-root Cc: Harald Hoyer <harald.hoyer@gmail.com> Cc: Dave Reisner <d@falconindy.com>
2013-03-01fstab-generator: drop rootwait supportTom Gundersen
I originally added this to stay as compatible as possible with the kernel, but as Lennart argued it is not really useful in the initramfs, so let's drop it (we already don't support 'rootdealy').
2013-03-01fstab-generator: set "ro" as default for sysroot.mountHarald Hoyer
2013-03-01fstab-generator: fix commit 92094b7Harald Hoyer
2013-03-01fstab-generator: parse_new_root_from_proc_cmdline() don't use "defaults"Harald Hoyer
Don't use "defaults" as default option string. "defaults,<anyotheroption>" does not even work for the mount unit mount options.
2013-03-01fstab,mount: detect rbind as bind mountFrederic Crozat
Correctly detect rbind mount option as bind mount. Fixes https://bugzilla.novell.com/show_bug.cgi?id=804575.
2013-02-21fstab-generator: change kernel command line mount path for rootHarald Hoyer
Use /sysroot instead of /new_root to mount the real root in the initramfs.
2013-02-14honor SELinux labels, when creating and writing config filesHarald Hoyer
Also split out some fileio functions to fileio.c and provide a SELinux aware pendant in fileio-label.c see https://bugzilla.redhat.com/show_bug.cgi?id=881577
2013-01-09tabs to spacesThomas Hindoe Paaboel Andersen
Skipped bootchart and various files that looked like they should be kept in sync with external sources.
2013-01-06fstab-generator: modernize styleZbigniew Jędrzejewski-Szmek
2012-12-29fstab-generator: fix typoTom Gundersen
2012-12-28fstab-generator: generate new_root.mount in initrdTom Gundersen
The configuration is taken from /proc/cmdline, aiming at emulating the behavior of the kernel when no initramfs is used. The supported options are: root=, rootfstype=, rootwait=, rootflags=, ro, and rw. rootdelay= was dropped, as it is not really useful in a systemd world, but could easily be added. v2: fix comments by Lennart, and complain loudly if root= can not be found Cc: Harald Hoyer <harald@redhat.com> Cc: Dave Reisner <dreisner@archlinux.org>
2012-12-24fstab-generator: properly detect bind mountsLennart Poettering
This kinda undoes a83cbaccd03c3f28e47e9330f4a22ff65ce4b561 and 1d634e21b453f3c80d7c6c4bd90a6b84e42a3d2a but corrects the original code to compare the mount type with "bind" rather than the mount options.
2012-11-27fstab-generator: make error more helpful in case of duplicates in fstabTom Gundersen
Traditional sysvinit systems would not complain about duplicates in fstab. Rather it (through monut -a) would mount one fs on top of another, in effect the last entry taking precedent. In systemd, the first entry takes precedent, all subsequent ones are ignored and an error is printed. The change of behavior and the source of this error message was causing some confusion, so give a hint what migt be wrong.
2012-11-27fstab-generator: drop mount_is_bindTom Gundersen
Do the check in-line instead, as the function is now a bit pointless.
2012-11-27fstab-generator: remove redundancy in mount_is_bindTom Gundersen
2012-11-09fstab-generator: more specific error messagesMichal Schmidt