Commit Graph

27918 Commits

Author SHA1 Message Date
Lennart Poettering 08422e63b2 update TODO 2016-12-21 19:09:32 +01:00
Lennart Poettering 436e916eae util-lib: rework path_check_fstype() and path_is_temporary_fs() to use O_PATH
Also, add tests to make sure this actually works as intended.
2016-12-21 19:09:32 +01:00
Lennart Poettering fc2288f0be machinectl: minor indentation fix 2016-12-21 19:09:31 +01:00
Lennart Poettering 91359193c3 importd: automatically download .roothash in addition to .nspawn for raw downloads
Now that nspawn looks for these files, and mkosi generates them, we
should also make sure importd downloads them if it can.
2016-12-21 19:09:31 +01:00
Lennart Poettering 78f0243a44 gpt-auto-generator: enable auto-discovery logic also for verity root file systems
verity block devices have two backing devices: the data partition and
the hash partition. Previously the gpt auto-discovery logic would refuse
working on devices with multiple backing devices, losen this up a bit,
to permit them as long as the backing devices are all located on the
same physical media.
2016-12-21 19:09:31 +01:00
Lennart Poettering 5f4bfe56f3 cryptsetup: various coding style improvements
No functional changes.
2016-12-21 19:09:31 +01:00
Lennart Poettering a93c4776de util-lib: be stricter when decoding hex strings
If a hex string has an uneven length, generate an error instead of
silently assuming a trailing '0' was in place.
2016-12-21 19:09:31 +01:00
Lennart Poettering c0cee5f1e8 man: drop superfluous 'this' in man page 2016-12-21 19:09:31 +01:00
Lennart Poettering 2f3dfc6fb4 verity: add support for setting up verity-protected root disks in the initrd
This adds a generator and a small service that will look for "roothash="
on the kernel command line and use it for setting up a very partition
for the root device.

This provides similar functionality to nspawn's existing --roothash=
switch.
2016-12-21 19:09:30 +01:00
Lennart Poettering 72e18a98ba gpt-auto-discovery: port to dissect-image.c dissector
Change the gpt auto discovery generator to use the same dissector as
nspawn and the rest of the tools. This removes the separate dissector
code that the generator previously had and unifies the relevant code.
2016-12-21 19:09:30 +01:00
Lennart Poettering 47f9472950 gpt-auto-generator: drop duplicate container check
We already check for containers early in main(), no need to do this
check again.
2016-12-21 19:09:30 +01:00
Lennart Poettering e0f9e7bd03 dissect: make using a generic partition as root partition optional
In preparation for reusing the image dissector in the GPT auto-discovery
logic, only optionally fail the dissection when we can't identify a root
partition.

In the GPT auto-discovery we are completely fine with any kind of root,
given that we run when it is already mounted and all we do is find some
additional auxiliary partitions on the same disk.
2016-12-21 19:09:30 +01:00
Lennart Poettering be30ad41ff dissect: return the GPT partition UUID, too
This is useful as we can match up the EFI UUID with the one the firmware
supposedly used.
2016-12-21 19:09:30 +01:00
Lennart Poettering 01af8c019a gpt-auto-generator: support LUKS encrypted root partitions
Previously, we supported GPT auto-discovery for /home and /srv, but not
for the root partition. Add that, too.

Fixes: #859
2016-12-21 19:09:30 +01:00
Lennart Poettering e02c04c045 mkosi: drop duplicate "diffutils" package listing 2016-12-21 19:09:29 +01:00
Lennart Poettering 4332edf6b1 core: fix typo 2016-12-21 19:09:29 +01:00
Lennart Poettering f7e1577cd4 build-sys: add missing Makefile symlink
This way we can just type "make" in the .mkosi/ directory and the right thing
happens.
2016-12-21 19:09:29 +01:00
Lennart Poettering 91214a37ef fstab-generator: add support for volatile boots
This adds support for a new kernel command line option "systemd.volatile=" that
provides the same functionality that systemd-nspawn's --volatile= switch
provides, but for host systems (i.e. systems booting with a kernel).

It takes the same parameter and has the same effect.

In order to implement systemd.volatile=yes a new service
systemd-volatile-root.service is introduced that only runs in the initrd and
rearranges the root directory as needed to become a tmpfs instance. Note that
systemd.volatile=state is implemented different: it simply generates a
var.mount unit file that is part of the normal boot and has no effect on the
initrd execution.

The way this is implemented ensures that other explicit configuration for /var
can always override the effect of these options.  Specifically, the var.mount
unit is generated in the "late" generator directory, so that it only is in
effect if nothing else overrides it.
2016-12-21 19:09:29 +01:00
Lennart Poettering e5b4220341 shared: rework switch_root() code
Let's follow symlinks before invoking mount() on arbitrary paths, so that we
won't get confused if directories are prepared with absolute symlinks.

Use FOREACH_STRING() instead of NULSTR_FOREACH() as it is more readable.

Don't use snprintf() for concatenating strings, let chase_symlinks() to that.

Replace homegrown mount check with path_is_mount_point(). Also, change the
behaviour when we encounter this: instead of unmounting the old mount point,
simply leave it around and don't replace it, so that initrds can mount stuff
there with different settings than we would apply. This is in-line with how we
handle automatic mounts in nspawn for example.

Use umount_recursive() instead of a simple umount2() for unmounting the old
root, so that we actually cover really all mounts, not just the top-level one.
2016-12-21 19:09:29 +01:00
Lennart Poettering f78273c8da journald: don't flush to /var/log/journal before we get asked to
This changes journald to not write to /var/log/journal until it received
SIGUSR1 for the first time, thus having been requested to flush the runtime
journal to disk.

This makes the journal work nicer with systems which have the root file system
writable early, but still need to rearrange /var before journald should start
writing and creating files to it, for example because ACLs need to be applied
first, or because /var is to be mounted from another file system, NFS or tmpfs
(as is the case for systemd.volatile=state).

Before this change we required setupts with /var split out to mount the root
disk read-only early on, and ship an /etc/fstab that remounted it writable only
after having placed /var at the right place. But even that was racy for various
preparations as journald might end up accessing the file system before it was
entirely set up, as soon as it was writable.

With this change we make scheduling when to start writing to /var/log/journal
explicit. This means persistent mode now requires
systemd-journal-flush.service in the mix to work, as otherwise journald would
never write to the directory.

See: #1397
2016-12-21 19:09:29 +01:00
Lennart Poettering 4ad14eff19 nspawn: restore --volatile=yes support
This was broken by 19caffac75 which remounted the
root directory to MS_SHARED before applying the volatile mount logic. This
broke things as MS_MOVE is incompatible with MS_SHARED directory trees, and we
need MS_MOVE in the volatile mount logic to rearrange the directory tree.
Simply swap the order here, apply the volatile logic before we switch to
MS_SHARED.
2016-12-21 19:09:28 +01:00
Lennart Poettering 57ab9f8930 qutoacheck,gpt-auto-generator: trivial coding style improvements 2016-12-21 19:09:28 +01:00
Lennart Poettering 1d84ad9445 util-lib: various improvements to kernel command line parsing
This improves kernel command line parsing in a number of ways:

a) An kernel option "foo_bar=xyz" is now considered equivalent to
   "foo-bar-xyz", i.e. when comparing kernel command line option names "-" and
   "_" are now considered equivalent (this only applies to the option names
   though, not the option values!). Most of our kernel options used "-" as word
   separator in kernel command line options so far, but some used "_". With
   this change, which was a source of confusion for users (well, at least of
   one user: myself, I just couldn't remember that it's systemd.debug-shell,
   not systemd.debug_shell). Considering both as equivalent is inspired how
   modern kernel module loading normalizes all kernel module names to use
   underscores now too.

b) All options previously using a dash for separating words in kernel command
   line options now use an underscore instead, in all documentation and in
   code. Since a) has been implemented this should not create any compatibility
   problems, but normalizes our documentation and our code.

c) All kernel command line options which take booleans (or are boolean-like)
   have been reworked so that "foobar" (without argument) is now equivalent to
   "foobar=1" (but not "foobar=0"), thus normalizing the handling of our
   boolean arguments. Specifically this means systemd.debug-shell and
   systemd_debug_shell=1 are now entirely equivalent.

d) All kernel command line options which take an argument, and where no
   argument is specified will now result in a log message. e.g. passing just
   "systemd.unit" will no result in a complain that it needs an argument. This
   is implemented in the proc_cmdline_missing_value() function.

e) There's now a call proc_cmdline_get_bool() similar to proc_cmdline_get_key()
   that parses booleans (following the logic explained in c).

f) The proc_cmdline_parse() call's boolean argument has been replaced by a new
   flags argument that takes a common set of bits with proc_cmdline_get_key().

g) All kernel command line APIs now begin with the same "proc_cmdline_" prefix.

h) There are now tests for much of this. Yay!
2016-12-21 19:09:08 +01:00
Lennart Poettering 2467cc55f1 util-lib: read $SYSTEMD_PROC_CMDLINE if set when looking for the kernel cmdline
if we want to parse the kernel command line, let's check the
$SYSTEMD_PROC_CMDLINE environment variable first. This is useful for debugging
purposes.
2016-12-21 19:07:55 +01:00
Lennart Poettering 5cfc0a8461 build-sys: don't mke use of "sushell" automatically
"sushell" is a Fedora-specific concept, shipped as part of
"initscripts". We shouldn't actively search for it if we can avoid it.
Hence, lets now default to /bin/sh as debug shell on all systems, and
permit Fedora to override that for their RPMs via --with-debug-shell= at
configure time.
2016-12-20 20:23:40 +01:00
Lennart Poettering 9b6deb03fc dissect: optionally, only look for GPT partition tables, nothing else
This is useful for reusing the dissector logic in the gpt-auto-discovery logic:
there we really don't want to use MBR or naked file systems as root device.
2016-12-20 20:00:09 +01:00
Lennart Poettering 6f4e2f97d7 units: drop --fail parameter from "systemctl switch-root" invocation
This parameter has no effect on switch root hence we shouldn't specify it.
2016-12-20 20:00:09 +01:00
Lennart Poettering afe682bc7f util-lib: make verbose_mount() grok MS_MOVE
Let's print a proper message if we see MS_MOVE.
2016-12-20 20:00:09 +01:00
Lennart Poettering f582cbca00 firstboot: add kernel cmdline option to disable firstboot wizard
If booting with systemd.firstboot=0 the wizard will be skipped.
2016-12-20 20:00:09 +01:00
Lennart Poettering 710028b473 core: modernize the SwitchRoot() bus method a bit
Let's more verbose error messages when validating the input parameters fails.
Also, call path_is_os_tree() properly, as it doesn't return a boolean, but
possibly also an error. Finally, check for the existance of the new init
process with chase_symlinks() to properly handle possible symlinks on the init
binary (which might actually be pretty likely).
2016-12-20 20:00:09 +01:00
Lennart Poettering ffeb828596 util-lib: add new path_is_temporary_fs() API
As simple wrapper around fd_is_temporary_fs().
2016-12-20 20:00:09 +01:00
Lennart Poettering ae59114af9 gpt-auto-generator: rename add_boot() → add_esp()
After all, the call doesn't necessarily mount /boot anymore, but possibly /efi
now.
2016-12-20 20:00:09 +01:00
Lennart Poettering 9ffcff0e0a tree-wide: always invoke setmntent() with "re" mode
Let's make sure O_CLOEXEC is set for the file descriptor.
2016-12-20 20:00:09 +01:00
Lennart Poettering 08cea7dfc0 util-lib: make sure fd_check_fstype() opens files with O_CLOEXEC
Also, O_NOCTTY is a safer bet, let's add that too.
2016-12-20 20:00:09 +01:00
Lennart Poettering eee8b7ab2e core: minor coding style/wording fixes 2016-12-20 20:00:08 +01:00
Lennart Poettering 7dcdb24e19 util-lib: beef path_is_os_tree() up a bit
Let's use chase_symlinks() when looking for /etc/os-release and
/usr/lib/os-release as these files might be symlinks (and actually are IRL on
some distros).
2016-12-20 20:00:08 +01:00
Lennart Poettering 245f1d244b util-lib: accept invoking chase_symlinks() with a NULL return parameter
Let's permit invoking chase_symlinks() with a NULL return parameter. If so, the
resolved name is not returned, and call is useful for checking for existance of
a file, without actually returning its ultimate path.
2016-12-20 20:00:08 +01:00
Lennart Poettering dee22f3970 core: add comment why we don't bother with MS_SHARED remounting of / in containers 2016-12-20 20:00:08 +01:00
Lennart Poettering 289cb4d5cd shared: use uid_is_valid() for checking validity of UIDs 2016-12-20 20:00:08 +01:00
Lennart Poettering a4c35b6b4d nspawn: split out VolatileMode definitions
This moves the VolatileMode enum and its helper functions to src/shared/. This
is useful to then reuse them to implement systemd.volatile= in a later commit.
2016-12-20 20:00:08 +01:00
Baruch Siach 72d17ce680 man/journalctl: mention systemd-journal-remote(8) (#4929)
Make it easier to figure out how to use the journalctl export format.
2016-12-20 14:59:26 +01:00
Lennart Poettering ce5cbd8679 Merge pull request #4904 from dobyrch/calendar-range-step
calendarspec: allow repetition values with ranges
2016-12-20 11:14:59 +01:00
Zbigniew Jędrzejewski-Szmek 6483ad89f5 systemctl: do not segfault when we cannot find template unit (#4915)
Core was generated by `systemctl cat test@.target test@.service'.
Program terminated with signal SIGSEGV, Segmentation fault.
32              movdqu  (%rdi), %xmm0
(gdb) bt
-0  strrchr () at ../sysdeps/x86_64/strrchr.S:32
-1  0x00007f57fdf837fe in __GI___basename (filename=0x0) at basename.c:24
-2  0x000055b8a77d0d91 in unit_find_paths (bus=0x55b8a9242f90, unit_name=0x55b8a92428f0 "test@.service", lp=0x7ffdc9070400, fragment_path=0x7ffdc90703e0, dropin_paths=0x7ffdc90703e8) at src/systemctl/systemctl.c:2584
-3  0x000055b8a77dbae5 in cat (argc=3, argv=0x7ffdc9070678, userdata=0x0) at src/systemctl/systemctl.c:5324
-4  0x00007f57fe55fc6b in dispatch_verb (argc=5, argv=0x7ffdc9070668, verbs=0x55b8a77f1c60 <verbs>, userdata=0x0) at src/basic/verbs.c:92
-5  0x000055b8a77e477f in systemctl_main (argc=5, argv=0x7ffdc9070668) at src/systemctl/systemctl.c:8141
-6  0x000055b8a77e5572 in main (argc=5, argv=0x7ffdc9070668) at src/systemctl/systemctl.c:8412

The right behaviour is not easy in this case. Implement some "sensible" logic.

Fixes #4912.
2016-12-20 11:09:59 +01:00
Mike Gilbert ecf4f0a8de build-sys: revert dbus >= 1.9.18 requirement (#4924)
Instead, document the necessary step to utilize older dbus versions.
2016-12-20 10:53:53 +01:00
Martin Pitt 1bb67eb21a Merge pull request #4926 from whot/hwdb-updates
Hwdb updates
2016-12-20 08:18:06 +01:00
Peter Hutterer f8de7c1875 hwdb: axis override for HP Spectre
https://bugzilla.redhat.com/show_bug.cgi?id=1402596
2016-12-20 14:39:59 +10:00
Peter Hutterer 3b4d94b66b hwdb: add axis overrides for Asus Vivobook E402SA 2016-12-20 14:39:59 +10:00
Peter Hutterer d28c633676 hwdb: add axis override for Lenovo W530
https://bugs.freedesktop.org/show_bug.cgi?id=98844
2016-12-20 14:39:59 +10:00
Peter Hutterer 24a797f4c7 hwdb: add axis override for Toshiba Tecra M11 2016-12-20 14:39:59 +10:00
Jörg Thalheim 29b5ad083a networkd-ndisc: handle missing mtu gracefully (#4913)
At least bird's implementation of router advertisement does not
set MTU option by default (instead it supplies an option to the user).
In this case just leave MTU as it is.
2016-12-19 15:34:07 +01:00