Commit Graph

30 Commits

Author SHA1 Message Date
Harald Hoyer 135b5212d4 fstab-generator: only handle block devices with root= kernel command line parameter
skip s.th. like root=nfs:... root=iscsi:... root=nbd:...
2013-03-04 21:00:56 +01:00
Harald Hoyer 8330847e94 fstab-generator: place initrd /sysroot mounts in initrd-fs.target
also do not overwrite /sysroot*.mount units already generated from fstab
2013-03-04 19:37:06 +01:00
Tom Gundersen 3d22d1ab57 fstab-generator: initrd - mount selected entries from /sysroot/etc/fstab
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-01 22:52:36 +01:00
Tom Gundersen 533740e161 fstab-generator: drop rootwait support
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-01 21:17:19 +01:00
Harald Hoyer 945d1442ed fstab-generator: set "ro" as default for sysroot.mount 2013-03-01 17:52:05 +01:00
Harald Hoyer 3fb5a0feb4 fstab-generator: fix commit 92094b7 2013-03-01 17:07:44 +01:00
Harald Hoyer 92094b75fb fstab-generator: parse_new_root_from_proc_cmdline() don't use "defaults"
Don't use "defaults" as default option string.

"defaults,<anyotheroption>" does not
even work for the mount unit mount options.
2013-03-01 15:05:28 +01:00
Frederic Crozat 3f8ee79182 fstab,mount: detect rbind as bind mount
Correctly detect rbind mount option as bind mount.

Fixes https://bugzilla.novell.com/show_bug.cgi?id=804575.
2013-03-01 14:43:18 +01:00
Harald Hoyer 696164cb5b fstab-generator: change kernel command line mount path for root
Use /sysroot instead of /new_root to mount the real root in the
initramfs.
2013-02-21 10:27:38 +01:00
Harald Hoyer a5c32cff1f honor SELinux labels, when creating and writing config files
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-02-14 16:19:38 +01:00
Thomas Hindoe Paaboel Andersen b929bf049d tabs to spaces
Skipped bootchart and various files that looked like they should be
kept in sync with external sources.
2013-01-09 21:20:43 +01:00
Zbigniew Jędrzejewski-Szmek d0aa9ce519 fstab-generator: modernize style 2013-01-06 13:52:48 -05:00
Tom Gundersen 6fe8ab6d57 fstab-generator: fix typo 2012-12-29 00:21:28 +01:00
Tom Gundersen 5e398e546e fstab-generator: generate new_root.mount in initrd
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-28 23:39:42 +01:00
Lennart Poettering f9ea108e7c fstab-generator: properly detect bind mounts
This kinda undoes a83cbaccd0 and
1d634e21b4 but corrects the original code
to compare the mount type with "bind" rather than the mount options.
2012-12-24 13:01:00 +01:00
Tom Gundersen 67ab5f761f fstab-generator: make error more helpful in case of duplicates in fstab
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-27 01:57:57 +01:00
Tom Gundersen 1d634e21b4 fstab-generator: drop mount_is_bind
Do the check in-line instead, as the function is now a bit pointless.
2012-11-27 00:56:09 +01:00
Tom Gundersen a83cbaccd0 fstab-generator: remove redundancy in mount_is_bind 2012-11-27 00:41:43 +01:00
Michal Schmidt 40b8acd039 fstab-generator: more specific error messages 2012-11-09 12:00:46 +01:00
Shawn Landden 0d0f0c50d3 log.h: new log_oom() -> int -ENOMEM, use it
also a number of minor fixups and bug fixes: spelling, oom errors
that didn't print errors, not properly forwarding error codes,
few more consistency issues, et cetera
2012-07-26 11:48:26 +02:00
Shawn Landden 669241a076 use "Out of memory." consistantly (or with "\n")
glibc/glib both use "out of memory" consistantly so maybe we should
consider that instead of this.

Eliminates one string out of a number of binaries. Also fixes extra newline
in udev/scsi_id
2012-07-25 11:23:57 +02:00
Lennart Poettering b7def68494 util: rename join() to strjoin()
This is to match strappend() and the other string related functions.
2012-07-13 13:41:01 +02:00
Lennart Poettering 9473414219 fstab-generator: support fstab=/rd.fstab= kernel cmdline
This generalizes functionality already available in dracut.
2012-06-22 10:27:05 +02:00
Kay Sievers ec6ceb1866 fstab-generator: avoid mangling of mount source string
This is a valid source entry in /etc/fstab:
  //192.168.6.10/data /data cifs noperm,auto

On Mon, Jun 4, 2012 at 2:04 PM, Dave Reisner <d@falconindy.com> wrote:
> On Mon, Jun 04, 2012 at 12:57:47PM +0200, Kay Sievers wrote:
>>
>> Changed it to use:
>>   path_is_absolute()
>> instead of:
>>   is_path(),
>> so that we still sanitize the input we might match against.
>>
>> Let me know, if you think that could still cause any problems?

> Yes, this will still break CIFS shares.
2012-06-04 15:21:05 +02:00
Kay Sievers 2b71016a3c fstab-generator: avoid mangling of non-path mount source and dest
This can invalidate otherwise valid source paths with trailing slashes,
such as "host:/" in the case of a network mount.

Based on a patch from Dave Reisner <dreisner@archlinux.org>, which
removed the slash mangling entirely.

Changed it to match on the leading slash to exclude non-path values.
2012-06-04 12:52:14 +02:00
Kay Sievers d2e54fae5c mkdir: append _label to all mkdir() calls that explicitly set the selinux context 2012-05-31 12:40:20 +02:00
Lennart Poettering 07719a21b6 manager: rework generator logic
Previously generated units were always placed at the end of the search
path. With this change there will be three unit dirs instead of one, to
place generated entries at the beginning, in the middle and at the end
of the search path:

beginning: for units that need to override all configuration, regardless
of user or vendor. Example use: system-update-generator uses this to
temporarily redirect default.target.

middle: for units that need to override vendor configuration, but not
vendor configuration. Example use: /etc/fstab should override vendor
supplied configuration (think /tmp), but should not override native user
configuration.

end: does not override anything but is available as well. Possible usage
might be to convert D-Bus bus service files to native units but allowing
vendor supplied native units to win.
2012-05-23 03:43:29 +02:00
Lennart Poettering 1b64d026af units: remove service sysv_path variable and replace it by generic unit_path
UnitPath= is also writable via native units and may be used by generators
to clarify from which file a unit is generated. This patch also hooks up
the cryptsetup and fstab generators to set UnitPath= accordingly.
2012-05-22 23:08:24 +02:00
Lennart Poettering a690306153 log: make sure generators never log into the journal to avoid activation deadlocks
This makes all generators log to kmsg by default.
2012-05-22 22:00:37 +02:00
Lennart Poettering 6b1dc2bd3c mount: replace PID1 internal fstab parser with generator
Bit by bit we should remove non-unit parsing from PID 1 and move into
generators, to clean up our code base a bit and clearly separate
parsers.
2012-05-22 19:25:17 +02:00