summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2016-12-21fstab-generator: add support for volatile bootsLennart Poettering
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-21shared: rework switch_root() codeLennart Poettering
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-21journald: don't flush to /var/log/journal before we get asked toLennart Poettering
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-21nspawn: restore --volatile=yes supportLennart Poettering
This was broken by 19caffac75a2590a0c5ebc2a0214960f8188aec7 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-21qutoacheck,gpt-auto-generator: trivial coding style improvementsLennart Poettering
2016-12-21util-lib: various improvements to kernel command line parsingLennart Poettering
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-21util-lib: read $SYSTEMD_PROC_CMDLINE if set when looking for the kernel cmdlineLennart Poettering
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-20build-sys: don't mke use of "sushell" automaticallyLennart Poettering
"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-20dissect: optionally, only look for GPT partition tables, nothing elseLennart Poettering
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-20units: drop --fail parameter from "systemctl switch-root" invocationLennart Poettering
This parameter has no effect on switch root hence we shouldn't specify it.
2016-12-20util-lib: make verbose_mount() grok MS_MOVELennart Poettering
Let's print a proper message if we see MS_MOVE.
2016-12-20firstboot: add kernel cmdline option to disable firstboot wizardLennart Poettering
If booting with systemd.firstboot=0 the wizard will be skipped.
2016-12-20core: modernize the SwitchRoot() bus method a bitLennart Poettering
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-20util-lib: add new path_is_temporary_fs() APILennart Poettering
As simple wrapper around fd_is_temporary_fs().
2016-12-20gpt-auto-generator: rename add_boot() → add_esp()Lennart Poettering
After all, the call doesn't necessarily mount /boot anymore, but possibly /efi now.
2016-12-20tree-wide: always invoke setmntent() with "re" modeLennart Poettering
Let's make sure O_CLOEXEC is set for the file descriptor.
2016-12-20util-lib: make sure fd_check_fstype() opens files with O_CLOEXECLennart Poettering
Also, O_NOCTTY is a safer bet, let's add that too.
2016-12-20core: minor coding style/wording fixesLennart Poettering
2016-12-20util-lib: beef path_is_os_tree() up a bitLennart Poettering
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-20util-lib: accept invoking chase_symlinks() with a NULL return parameterLennart Poettering
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-20core: add comment why we don't bother with MS_SHARED remounting of / in ↵Lennart Poettering
containers
2016-12-20shared: use uid_is_valid() for checking validity of UIDsLennart Poettering
2016-12-20nspawn: split out VolatileMode definitionsLennart Poettering
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-20man/journalctl: mention systemd-journal-remote(8) (#4929)Baruch Siach
Make it easier to figure out how to use the journalctl export format.
2016-12-20Merge pull request #4904 from dobyrch/calendar-range-stepLennart Poettering
calendarspec: allow repetition values with ranges
2016-12-20systemctl: do not segfault when we cannot find template unit (#4915)Zbigniew Jędrzejewski-Szmek
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-20build-sys: revert dbus >= 1.9.18 requirement (#4924)Mike Gilbert
Instead, document the necessary step to utilize older dbus versions.
2016-12-20Merge pull request #4926 from whot/hwdb-updatesMartin Pitt
Hwdb updates
2016-12-20hwdb: axis override for HP SpectrePeter Hutterer
https://bugzilla.redhat.com/show_bug.cgi?id=1402596
2016-12-20hwdb: add axis overrides for Asus Vivobook E402SAPeter Hutterer
2016-12-20hwdb: add axis override for Lenovo W530Peter Hutterer
https://bugs.freedesktop.org/show_bug.cgi?id=98844
2016-12-20hwdb: add axis override for Toshiba Tecra M11Peter Hutterer
2016-12-19networkd-ndisc: handle missing mtu gracefully (#4913)Jörg Thalheim
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-18build-sys: treat format errors as fatal (#4910)Zbigniew Jędrzejewski-Szmek
We currently don't expect any warnings about format strings, on any architecture (#4612 removed the last few warnings). Turn those warnings into errors in the future. As requested by Martin Pitt. gcc documentation says that -Wformat=2 includes -Wformat-security and -Wformat-nonliteral so don't include them explicitly.
2016-12-18Merge pull request #4892 from poettering/buspolicymoveZbigniew Jędrzejewski-Szmek
build-sys: stop placing D-Bus policy below /etc
2016-12-18core: downgrade "Time has been changed" to debug (#4906)Zbigniew Jędrzejewski-Szmek
That message is emitted by every systemd instance on every resume: Dec 06 08:03:38 laptop systemd[1]: Time has been changed Dec 06 08:03:38 laptop systemd[823]: Time has been changed Dec 06 08:03:38 laptop systemd[916]: Time has been changed Dec 07 08:00:32 laptop systemd[1]: Time has been changed Dec 07 08:00:32 laptop systemd[823]: Time has been changed Dec 07 08:00:32 laptop systemd[916]: Time has been changed -- Reboot -- Dec 07 08:02:46 laptop systemd[836]: Time has been changed Dec 07 08:02:46 laptop systemd[1]: Time has been changed Dec 07 08:02:46 laptop systemd[926]: Time has been changed Dec 07 19:48:12 laptop systemd[1]: Time has been changed Dec 07 19:48:12 laptop systemd[836]: Time has been changed Dec 07 19:48:12 laptop systemd[926]: Time has been changed ... Fixes #4896.
2016-12-18Merge pull request #4911 from keszybz/fixletsMartin Pitt
A few simple fixes / improvements
2016-12-17basic/log: use IN_SETZbigniew Jędrzejewski-Szmek
2016-12-17test-compress: fix warning about LZ4_compress_limitedOutputZbigniew Jędrzejewski-Szmek
691b90d465 fixed one spot, but missed the other one.
2016-12-17core: remove spurious newlineZbigniew Jędrzejewski-Szmek
2016-12-17debug-generator: simplify handling of arg_default_unitZbigniew Jędrzejewski-Szmek
Also free the allocated memory before exiting.
2016-12-17Use SPECIAL_DEFAULT_TARGET consistentlyZbigniew Jędrzejewski-Szmek
2016-12-17Modify mount_propagation_flags_from_string to return a normal int codeZbigniew Jędrzejewski-Szmek
This means that callers can distiguish an error from flags==0, and don't have to special-case the empty string.
2016-12-17Merge pull request #4845 from poettering/various-smaller-fixesZbigniew Jędrzejewski-Szmek
Various smaller fixes
2016-12-17coredumpctl: let gdb handle the SIGINT signal (#4901)Franck Bui
Even if pressing Ctrl-c after spawning gdb with "coredumpctl gdb" is not really useful, we should let gdb handle the signal entirely otherwise the user can be suprised to see a different behavior when gdb is started by coredumpctl vs when it's started directly. Indeed in the former case, gdb exits due to coredumpctl being killed by the signal. So this patch makes coredumpctl ignore SIGINT as long as gdb is running.
2016-12-17README: bump dbus depZbigniew Jędrzejewski-Szmek
We should also mention this in NEWS before release. Suggested text: > DBus policy files are now installed into /usr rather than /etc. Make sure > your system has dbus = 1.9.18 running before upgrading to this version, or > override the install path with --with-dbuspolicydir=
2016-12-16calendarspec: remove superfluous variablesDouglas Christman
2016-12-16calendarspec: rename fields of CalendarComponentDouglas Christman
value/range_end -> start/stop
2016-12-16calendarspec: allow repetition values with rangesDouglas Christman
"Every other hour from 9 until 5" can be written as `9..17/2:00` instead of `9,11,13,15,17:00`
2016-12-16core: make mount units from /proc/self/mountinfo possibly bind to a device ↵Franck Bui
(#4515) Since commit 9d06297, mount units from mountinfo are not bound to their devices anymore (they use the "Requires" dependency instead). This has the following drawback: if a media is mounted and the eject button is pressed then the media is unconditionally ejected leaving some inconsistent states. Since udev is the component that is reacting (no matter if the device is used or not) to the eject button, users expect that udev at least try to unmount the media properly. This patch introduces a new property "SYSTEMD_MOUNT_DEVICE_BOUND". When set on a block device, all units that requires this device will see their "Requires" dependency upgraded to a "BindTo" one. This is currently only used by cdrom devices. This patch also gives the possibility to the user to restore the previous behavior that is bind a mount unit to a device. This is achieved by passing the "x-systemd.device-bound" option to mount(8). Please note that currently this is not working because libmount treats the x-* options has comments therefore they're not available in utab for later application retrievals.