Lennart Poettering [Fri, 25 Nov 2016 00:00:31 +0000 (01:00 +0100)]
nspawn: accept --ephemeral --template= as alternative for --ephemeral --directory=
As suggested in PR #3667.
This PR simply ensures that --template= can be used as alternative to
--directory= when --ephemeral is used, following the logic that for ephemeral
options the source directory is actually a template.
This does not deprecate usage of --directory= with --ephemeral, as I am not
convinced the old logic wouldn't make sense.
Fixes: #3667
Lennart Poettering [Thu, 24 Nov 2016 20:03:36 +0000 (21:03 +0100)]
nspawn: properly handle image/directory paths that are symlinks
This resolves any paths specified on --directory=, --template=, and --image=
before using them. This makes sure nspawn can be used correctly on symlinked
images and directory trees.
Fixes: #2001
Lennart Poettering [Fri, 18 Nov 2016 20:35:21 +0000 (21:35 +0100)]
tree-wide: stop using canonicalize_file_name(), use chase_symlinks() instead
Let's use chase_symlinks() everywhere, and stop using GNU
canonicalize_file_name() everywhere. For most cases this should not change
behaviour, however increase exposure of our function to get better tested. Most
importantly in a few cases (most notably nspawn) it can take the correct root
directory into account when chasing symlinks.
Lennart Poettering [Mon, 28 Nov 2016 18:41:20 +0000 (19:41 +0100)]
core: make unit_free() accept NULL pointers
We generally try to make our destructors robust regarding NULL pointers, much
in the same way as glibc's free(). Do this also for unit_free().
Follow-up for #4748.
AsciiWolf [Wed, 30 Nov 2016 20:59:19 +0000 (21:59 +0100)]
l10n: update line numbers in Czech translation (#4776)
Franck Bui [Wed, 30 Nov 2016 17:27:42 +0000 (18:27 +0100)]
systemctl: fix 'is-enabled' exit status on failure when executed in chroot (#4773)
Susant Sahani [Wed, 30 Nov 2016 10:54:42 +0000 (16:24 +0530)]
As per use case we should allow ForwardDelaySec to be set as 0 (#4765)
So let's set ForwardDelaySec to USEC_INFINITY .
Reference:
https://wiki.linuxfoundation.org/networking/bridge#does-dhcp-work-overthrough-a-bridge
Martin Pitt [Wed, 30 Nov 2016 09:25:09 +0000 (10:25 +0100)]
Merge pull request #4772 from martinpitt/hwdb
parse_hwdb: fix to work with pyparsing 2.1.10
Martin Pitt [Thu, 24 Nov 2016 09:38:01 +0000 (10:38 +0100)]
hwdb/parse_hwdb.py: open files with UTF-8 mode
pyparsing uses the system locale by default, which in the case of 'C' (in lots
of build environment) will fail with a UnicodeDecodeError. Explicitly open it
with UTF-8 encoding to guard against this.
Martin Pitt [Wed, 30 Nov 2016 08:20:15 +0000 (09:20 +0100)]
parse_hwdb: fix to work with pyparsing 2.1.10
pyparsing 2.1.10 fixed the handling of LineStart to really just apply to line
starts and not ignore whitespace and comments any more. Adjust EMPTYLINE to
this.
Many thanks to Paul McGuire for pointing this out!
Martin Pitt [Wed, 30 Nov 2016 07:02:49 +0000 (08:02 +0100)]
test: retry checking for transient hostname in hostnamectl (#4769)
Sometimes setting the transient hostname does not happen synchronously, so
retry up to five times. It is not yet clear whether this is legitimate
behaviour or an underlying bug, but this will at least show whether the wrong
transient hostname is just a race condition or permanently wrong.
Fixes #4753
Evgeny Vereshchagin [Wed, 30 Nov 2016 00:22:07 +0000 (03:22 +0300)]
Merge pull request #4745 from joukewitteveen/notify
Improvements for notify services (including #4212)
Jouke Witteveen [Thu, 24 Nov 2016 09:56:32 +0000 (10:56 +0100)]
service: new NotifyAccess= value for control processes (#4212)
Setting NotifyAccess=exec allows notifications coming directly from any
control process.
Jouke Witteveen [Mon, 28 Nov 2016 17:54:37 +0000 (18:54 +0100)]
NEWS: mention more aggressive failing of notify services
Jouke Witteveen [Tue, 29 Nov 2016 08:36:20 +0000 (09:36 +0100)]
bus-util: add protocol error type explanation
Dongsu Park [Tue, 29 Nov 2016 19:16:55 +0000 (20:16 +0100)]
cgroup: support prefix "-" in cgroups whitelisting entries (#4687)
So far systemd-nspawn container has been creating files under
/run/systemd/inaccessible, no matter whether it's running in user
namespace or not. That's fine for regular files, dirs, socks, fifos.
However, it's not for block and character devices, because kernel
doesn't allow them to be created under user namespace. It results
in warnings at booting like that:
====
Couldn't stat device /run/systemd/inaccessible/chr
Couldn't stat device /run/systemd/inaccessible/blk
====
Thus we need to have the cgroups whitelisting handler to silently ignore
a file, when the device path is prefixed with "-". That's exactly the
same convention used in directives like ReadOnlyPaths=. Also insert the
prefix "-" to inaccessible entries.
Gabriel Rauter [Tue, 29 Nov 2016 18:00:38 +0000 (19:00 +0100)]
networkctl: install zsh completion from #3062 (#4767)
zsh autocompletion provided by #3062 will be installed when networkd is
enabled.
Stefan Berger [Tue, 29 Nov 2016 15:47:20 +0000 (10:47 -0500)]
ima: Write the policy filename into IMA's sysfs policy file (#4766)
IMA validates file signatures based on the security.ima xattr. As of
Linux-4.7, instead of copying the IMA policy into the securityfs policy,
the IMA policy pathname can be written, allowing the IMA policy file
signature to be validated.
This patch modifies the existing code to first attempt to write the
pathname, but on failure falls back to copying the IMA policy contents.
Lennart Poettering [Tue, 29 Nov 2016 13:14:43 +0000 (14:14 +0100)]
Merge pull request #4763 from keszybz/offline-update-loop
A fix for offline update loop
Jouke Witteveen [Sat, 26 Nov 2016 09:16:47 +0000 (10:16 +0100)]
service: prevent registering control pids as the main pid
We assume a process can be only one of the two in service_sigchld_event.
Jouke Witteveen [Thu, 24 Nov 2016 20:05:47 +0000 (21:05 +0100)]
service: only fail notify services on empty cgroup during start
We stay in the SERVICE_START while no READY=1 notification message has
been received. When we are in the SERVICE_START_POST state, we have
already received a ready notification. Hence we should not fail when the
cgroup becomes empty in that state.
Zbigniew Jędrzejewski-Szmek [Tue, 29 Nov 2016 06:29:02 +0000 (01:29 -0500)]
units: add system-update-cleanup.service to guard against offline-update loops
Note: the name is "system-update-cleanup.service" rather than
"system-update-done.service", because it should not run normally, and also
because there's already "systemd-update-done.service", and having them named
so similarly would be confusing.
In https://bugzilla.redhat.com/show_bug.cgi?id=1395686 the system repeatedly
entered system-update.target on boot. Because of a packaging issue, the tool
that created the /system-update symlink could be installed without the service
unit that was supposed to perform the upgrade (and remove the symlink). In
fact, if there are no units in system-update.target, and /system-update symlink
is created, systemd always "hangs" in system-update.target. This is confusing
for users, because there's no feedback what is happening, and fixing this
requires starting an emergency shell somehow, and also knowing that the symlink
must be removed. We should be more resilient in this case, and remove the
symlink automatically ourselves, if there are no upgrade service to handle it.
This adds a service which is started after system-update.target is reached and
the symlink still exists. It nukes the symlink and reboots the machine. It
should subsequently boot into the default default.target.
This is a more general fix for
https://bugzilla.redhat.com/show_bug.cgi?id=1395686 (the packaging issue was
already fixed).
Zbigniew Jędrzejewski-Szmek [Tue, 29 Nov 2016 06:19:24 +0000 (01:19 -0500)]
man: update the description of offline updates
- use "service" instead of "script", because various offline updaters that we have
aren't really scripts, e.g. dnf-plugin-system-upgrade, packagekit-offline-update,
fwupd-offline-update.
- strongly recommend After=sysinit.target, Wants=sysinit.target
- clarify a bit what should happen when multiple update services are started
- replace links to the wiki with refs to the man page that replaced it.
Martin Pitt [Mon, 28 Nov 2016 20:10:57 +0000 (21:10 +0100)]
Merge pull request #4761 from fsateler/python3
Explicitly use python3 everywhere
Tom Gundersen [Mon, 28 Nov 2016 19:42:40 +0000 (20:42 +0100)]
networkd: move event loop handling out of the manager (#4723)
This will allow us to have several managers sharing an event loop
and running in parallel, as if they were running in separate processes.
The long term-aim is to allow networkd to be split into separate
processes, so restructure the code to make this simpler.
For now we drop the exit-on-idle logic, as this was anyway severely
restricted at the moment. Once split, we will revisit this as it may
then make more sense again.
Felipe Sateler [Sun, 21 Aug 2016 23:25:37 +0000 (20:25 -0300)]
Use python3 explicitly in all python scripts
Felipe Sateler [Sun, 21 Aug 2016 21:20:05 +0000 (18:20 -0300)]
build-sys: explicitly require python3
Otherwise python programs might be run with python2
(GalaxyMaster) [Mon, 28 Nov 2016 17:25:11 +0000 (04:25 +1100)]
socket-proxyd: Introduced dynamic connection limit via an option. (#4749)
Daniel Wagner [Mon, 28 Nov 2016 17:24:26 +0000 (18:24 +0100)]
udevd: check correct return value of fcntl() (#4758)
This looks like a copy&paste error from the code block above.
Martin Pitt [Mon, 28 Nov 2016 11:35:49 +0000 (12:35 +0100)]
test: make transient hostname tests fail verbosely (#4754)
This test fails sometimes but it is hard to reproduce, so we need more
information what happens. Set journal log level to "debug" for the entirety of
networkd-test.py, and show networkd's and hostnamed's journals and the DHCP
server log on failure of the two test_transient_hostname* tests. Also sync the
journal before querying it to get more precise output.
This should help with tracking down issue #4753.
Dave Reisner [Sun, 27 Nov 2016 22:05:39 +0000 (17:05 -0500)]
device: Avoid calling unit_free(NULL) in device setup logic (#4748)
Since
a581e45ae8f9bb5c, there's a few function calls to
unit_new_for_name which will unit_free on failure. Prior to this commit,
a failure would result in calling unit_free with a NULL unit, and hit an
assertion failure, seen at least via device_setup_unit:
Assertion 'u' failed at src/core/unit.c:519, function unit_free(). Aborting.
Fixes #4747
https://bugs.archlinux.org/task/51950
Djalal Harouni [Sun, 27 Nov 2016 10:43:26 +0000 (11:43 +0100)]
Merge pull request #4736 from dobyrch/calendar-cleanup
calendarspec: miscellaneous parsing and formatting fixes
Douglas Christman [Fri, 25 Nov 2016 02:44:14 +0000 (21:44 -0500)]
calendarspec: refactor format_chain()
Factor out repeated references to usec and remove nested ifs.
Waldemar Brodkorb [Fri, 25 Nov 2016 10:24:58 +0000 (11:24 +0100)]
fix journald startup problem when code is compiled with -DNDEBUG (#4735)
Similar to this patch from here:
http://systemd-devel.freedesktop.narkive.com/AvfCbi6c/patch-0-3-using-assert-se-on-actions-with-side-effects-on-test-cases
If the code is compiled with -DNDEBUG which is the default for
some embedded buildsystems, systemd-journald does not startup
and silently fails.
Martin Pitt [Fri, 25 Nov 2016 06:59:37 +0000 (07:59 +0100)]
Revert "hwdb/parse_hwdb.py: open files with UTF-8 mode"
"encoding" is not a valid Python 2 keyword, and despite the hashbang this
script can be called with Python 2.
This reverts commit
115a10c58d343d00b73bd9442f7ce6c294debad8.
Douglas Christman [Thu, 24 Nov 2016 22:47:25 +0000 (17:47 -0500)]
calendarspec: rename "eom" to "end_of_month"
Douglas Christman [Thu, 24 Nov 2016 20:41:04 +0000 (15:41 -0500)]
calendarspec: make specifications with ranges reversible
"*-*-01..03" is now formatted as "*-*-01..03" instead of "*-*-01,02,03"
Douglas Christman [Thu, 24 Nov 2016 20:51:07 +0000 (15:51 -0500)]
calendarspec: allow whole second ranges
Previously a string like "00:00:01..03" would fail to parse due to the
ambiguity between a decimal point and the start of a range.
Douglas Christman [Thu, 24 Nov 2016 19:34:17 +0000 (14:34 -0500)]
calendarspec: make specifications with seconds wildcard reversible
"*:*:*" is now formatted as "*:*:*" instead of "*:*:00/1"
Douglas Christman [Thu, 24 Nov 2016 17:47:55 +0000 (12:47 -0500)]
calendarspec: reject strings with spurious spaces and signs
strtoul() parses leading whitespace and an optional sign;
check that the first character is a digit to prevent odd
specifications like "00: 00: 00" and "-00:+00/-1".
Douglas Christman [Thu, 24 Nov 2016 19:04:13 +0000 (14:04 -0500)]
calendarspec: reject open weekday ranges
Forbid open ranges like "Tue.."; trailing commas are still OK.
Douglas Christman [Thu, 24 Nov 2016 17:21:37 +0000 (12:21 -0500)]
calendarspec: reject strings that only contain a timezone
This makes " UTC" an illegal date specification.
Douglas Christman [Thu, 24 Nov 2016 16:50:06 +0000 (11:50 -0500)]
calendarspec: always interpret a missing time as 00:00:00
"*-*-*" is now equivalent to "*-*-* 00:00:00" (daily)
rather than "*-*-* *:*:*" (every second).
Peter Hutterer [Thu, 24 Nov 2016 22:46:28 +0000 (08:46 +1000)]
Merge pull request #4734 from whot/hwdb-updates
hwdb: add axis overrides for HP Pavilion dv7
Peter Hutterer [Thu, 24 Nov 2016 21:53:18 +0000 (07:53 +1000)]
hwdb: add axis overrides for HP Pavilion dv7
Fixes #4731
Franck Bui [Thu, 24 Nov 2016 17:52:04 +0000 (18:52 +0100)]
core: make sure initrd-switch-root command survives PID1's killing spree (#4730)
This is a different way to implement the fix proposed by commit
a4021390fef27f4136497328f suggested by Lennart Poettering.
In this patch we instruct PID1 to not kill "systemctl switch-root" command
started by initrd-switch-root service using the "argv[0][0]='@'" trick.
See: https://www.freedesktop.org/wiki/Software/systemd/RootStorageDaemons/ for
more details.
We had to backup argv[0] because argv is modified by dispatch_verb().
Martin Pitt [Thu, 24 Nov 2016 17:19:59 +0000 (18:19 +0100)]
Merge pull request #4729 from martinpitt/hwdb
fix hwdb syntax error and add test for it
Martin Pitt [Thu, 24 Nov 2016 10:29:42 +0000 (11:29 +0100)]
tests: add hwdb parsing test
This calls the built "systemd-hwdb update" on the source tree's hwdb/ in a
temporary directory and verifies that there are no error messages.
Martin Pitt [Thu, 24 Nov 2016 10:08:49 +0000 (11:08 +0100)]
hwdb: fix syntax error in 60-keyboard.hwdb
Fixes #4728
Martin Pitt [Thu, 24 Nov 2016 09:38:01 +0000 (10:38 +0100)]
hwdb/parse_hwdb.py: open files with UTF-8 mode
pyparsing uses the system locale by default, which in the case of 'C' (in lots
of build environment) will fail with a UnicodeDecodeError. Explicitly open it
with UTF-8 encoding to guard against this.
Lennart Poettering [Thu, 24 Nov 2016 00:58:33 +0000 (01:58 +0100)]
Merge pull request #4710 from martinpitt/networkd-dbus
networkd: allow networkd to start in early boot
Jouke Witteveen [Wed, 23 Nov 2016 21:51:33 +0000 (22:51 +0100)]
man: document protocol error type for service failures (#4724)
Susant Sahani [Wed, 23 Nov 2016 21:32:19 +0000 (03:02 +0530)]
networkd: handle MTU field in IPv6 RA (#4719)
This patch handles the custom MTU field in IPv6 RA.
fixes RFE #4464
Lennart Poettering [Wed, 23 Nov 2016 21:31:01 +0000 (22:31 +0100)]
Merge pull request #4703 from dobyrch/calendar-offset
calendarspec: add support for scheduling timers at the end of the month
Michael Biebl [Wed, 23 Nov 2016 18:21:56 +0000 (19:21 +0100)]
hwdb: use systemd-hwdb instead of obsolete udevadm hwdb (#4722)
Fixes: #4721
Douglas Christman [Tue, 22 Nov 2016 15:05:10 +0000 (10:05 -0500)]
calendarspec: add support for scheduling timers at the end of the month
"*-*~1" => The last day of every month
"*-02~3..5" => The third, fourth, and fifth last days in February
"Mon 05~07/1" => The last Monday in May
Resolves #3861
Douglas Christman [Tue, 22 Nov 2016 17:57:07 +0000 (12:57 -0500)]
calendarspec: add upper bound on year
Stop looking for matches after MAX_YEAR so impossible dates like
"*-02-30" and "*-04-31" don't cause an infinite loop.
Martin Pitt [Tue, 22 Nov 2016 07:41:51 +0000 (08:41 +0100)]
networkd: allow networkd to start in early boot
With the previous improvements, networkd.service's "After=dbus.service" can now
be dropped. That ordering effectively forced networkd.service to run in late
boot only (dbus.service was rejected to run in early boot in
https://bugs.freedesktop.org/show_bug.cgi?id=98254).
Fixes #4504
Martin Pitt [Tue, 22 Nov 2016 07:36:20 +0000 (08:36 +0100)]
networkd: set DHCP-acquired timezone and hostname after connecting to D-Bus
If setting the received timezone or transient hostname fails because D-Bus is
not (yet) up, store the data in the Manager object and try again after
connecting to D-Bus.
Lennart Poettering [Wed, 23 Nov 2016 15:45:19 +0000 (16:45 +0100)]
Merge pull request #4259 from joukewitteveen/notify
service: fix main processes exit behavior for type notify services
Susant Sahani [Wed, 23 Nov 2016 15:33:01 +0000 (21:03 +0530)]
networkd: fix size of MTUBytes so that it does not overwrites ARP (#4707)
config_parse_iec_size overwrites the next varible that is ARP.
Now the mtu is unsigned . Make it size_t .
Fixes #4644
Martin Pitt [Tue, 22 Nov 2016 07:05:18 +0000 (08:05 +0100)]
networkd: allow networkd to set the timezone in timedated
systemd-networkd runs as user "systemd-network" and thus is not privileged to
set the timezone acquired from DHCP:
systemd-networkd[4167]: test_eth42: Could not set timezone: Interactive authentication required.
Similarly to commit
e8c0de912, add a polkit rule to grant
org.freedesktop.timedate1.set-timezone to the "systemd-network" system user.
Move the polkit rules from src/hostname/ to src/network/ to avoid too many
small distributed policy snippets (there might be more in the future), as it's
easier to specify the privileges for a particular subject in this case.
Add NetworkdClientTest.test_dhcp_timezone() test case to verify this (for
all people except those in Pacific/Honolulu, there the test doesn't prove
anything -- sorry ☺ ).
Martin Pitt [Mon, 21 Nov 2016 22:15:41 +0000 (23:15 +0100)]
networkd: move setting hostname and timezone to Manager
Hostname and time zone are global settings, not link specific. Move these
methods from Link into Manager.
Franck Bui [Wed, 23 Nov 2016 15:31:24 +0000 (16:31 +0100)]
core: consider SIGTERM as a clean exit status for initrd-switch-root.service (#4713)
Since commit
1f0958f640b8717, systemd considers SIGTERM for short-running
services (aka Type=oneshot) as a failure.
This can be an issue with initrd-switch-root.service as the command run by this
service (in order to switch to the new rootfs) may still be running when
systemd does the switch.
However PID1 sends SIGTERM to all remaining processes right before
switching and initrd-switch-root.service can be one of those.
After systemd is reexecuted and its previous state is deserialized, systemd
notices that initrd-switch-root.service was killed with SIGTERM and considers
this as a failure which leads to the emergency shell.
To prevent this, this patch teaches systemd to consider a SIGTERM exit as a
clean one for this service.
It also removes "KillMode=none" since this is pretty useless as the service is
never stopped by systemd but it either exits normally or it's killed by a
SIGTERM as described previously.
Zbigniew Jędrzejewski-Szmek [Wed, 23 Nov 2016 15:18:30 +0000 (10:18 -0500)]
build-sys: check for lz4 in the old and new numbering scheme (#4717)
lz4 upstream decided to switch to an incompatible numbering scheme
(1.7.3 follows 131, to match the so version).
PKG_CHECK_MODULES does not allow two version matches for the same package,
so e.g. lz4 < 10 || lz4 >= 125 cannot be used. Check twice, once for
"new" numbers (anything below 10 is assume to be new), once for the "old"
numbers (anything above >= 125). This assumes that the "new" versioning
will not get to 10 to quickly. I think that's a safe assumption, lz4 is a
mature project.
Fixed #4690.
Zbigniew Jędrzejewski-Szmek [Wed, 23 Nov 2016 07:52:19 +0000 (02:52 -0500)]
CONTRIBUTING: reword the part about unsetting the label (#4716)
Only project members can do it.
Zbigniew Jędrzejewski-Szmek [Wed, 23 Nov 2016 04:22:04 +0000 (23:22 -0500)]
Merge pull request #4692 from poettering/networkd-dhcp
Various networkd/DHCP fixes.
Janne Heß [Wed, 23 Nov 2016 04:19:56 +0000 (05:19 +0100)]
Document an edge-case with resume and mounting (#4581)
When trying to read keyfiles from an encrypted partition to unlock the swap,
a cyclic dependency is generated because systemd can not mount the
filesystem before it has checked if there is a swap to resume from.
Closes #3940
Zbigniew Jędrzejewski-Szmek [Wed, 23 Nov 2016 04:15:07 +0000 (23:15 -0500)]
Merge pull request #4693 from poettering/nspawn-ephemeral
nspawn: support ephemeral boots from images
Jouke Witteveen [Sat, 1 Oct 2016 12:06:48 +0000 (14:06 +0200)]
service: fix main processes exit behavior for type notify services
Before this commit, when the main process of a Type=notify service exits the
service would enter a running state without passing through the startup post
state. This meant ExecStartPost= from being executed and allowed follow-up
units to start too early (before the ready notification).
Additionally, when RemainAfterExit=yes is used on a Type=notify service, the
exit status of the main process would be disregarded.
After this commit, an unsuccessful exit of the main process of a Type=notify
service puts the unit in a failed state. A successful exit is inconsequential
in case RemainAfterExit=yes. Otherwise, when no ready notification has been
received, the unit is put in a failed state because it has never been active.
When all processes in the cgroup of a Type=notify service are gone and no ready
notification has been received yet, the unit is also put in a failed state.
Jouke Witteveen [Tue, 22 Nov 2016 16:39:56 +0000 (17:39 +0100)]
service: introduce protocol error type
Introduce a SERVICE_FAILURE_PROTOCOL error type for when a service does
not follow the protocol.
This error type is used when a pid file is expected, but not delivered.
Lennart Poettering [Tue, 22 Nov 2016 12:35:24 +0000 (13:35 +0100)]
nspawn: don't require chown() if userns is not on
Fixes: #4711
Lennart Poettering [Mon, 21 Nov 2016 19:02:43 +0000 (20:02 +0100)]
nspawn: add fallback top normal copy/reflink when we cannot btrfs snapshot
Given that other file systems (notably: xfs) support reflinks these days, let's
extend the file system snapshotting logic to fall back to plan copies or
reflinks when full btrfs subvolume snapshots are not available.
This essentially makes "systemd-nspawn --ephemeral" and "systemd-nspawn
--template=" available on non-btrfs subvolumes. Of course, both operations will
still be slower on non-btrfs than on btrfs (simply because reflinking each file
individually in a directory tree is still slower than doing this in one step
for a whole subvolume), but it's probably good enough for many cases, and we
should provide the users with the tools, they have to figure out what's good
for them.
Note that "machinectl clone" already had a fallback like this in place, this
patch generalizes this, and adds similar support to our other cases.
Lennart Poettering [Fri, 18 Nov 2016 23:00:16 +0000 (00:00 +0100)]
nspawn: remove temporary root directory on exit
When mountint a loopback image, we need a temporary root directory we can mount
stuff to. Make sure to actually remove it when exiting, so that we don't leave
stuff around in /tmp unnecessarily.
See: #4664
Lennart Poettering [Fri, 18 Nov 2016 22:47:09 +0000 (23:47 +0100)]
nspawn: try to wait for the container PID 1 to exit, before we exit
Let's make the shutdown logic synchronous, so that there's a better chance to
detach the loopback device after use.
Lennart Poettering [Fri, 18 Nov 2016 22:34:39 +0000 (23:34 +0100)]
nspawn: add ability to run nspawn without container locks applied
This adds a new undocumented env var $SYSTEMD_NSPAWN_LOCK. When set to "0",
nspawn will not attempt to lock the image.
Fixes: #4037
Lennart Poettering [Fri, 18 Nov 2016 22:31:01 +0000 (23:31 +0100)]
shared: make sure image_path_lock() return parameters are always initialized on success
We forgot to initialize the "global" return parameter in one case. Fix that.
Lennart Poettering [Fri, 18 Nov 2016 17:38:06 +0000 (18:38 +0100)]
nspawn: support ephemeral boots from images
Previously --ephemeral was only supported with container trees in btrfs
subvolumes (i.e. in combination with --directory=). This adds support for
--ephemeral in conjunction with disk images (i.e. --image=) too.
As side effect this fixes that --ephemeral was accepted but ignored when using
-M on a container that turned out to be an image.
Fixes: #4664
Lennart Poettering [Tue, 22 Nov 2016 00:29:12 +0000 (01:29 +0100)]
seccomp: add @filesystem syscall group (#4537)
@filesystem groups various file system operations, such as opening files and
directories for read/write and stat()ing them, plus renaming, deleting,
symlinking, hardlinking.
Martin Ejdestig [Tue, 22 Nov 2016 00:21:00 +0000 (01:21 +0100)]
sd-event: fix sd_event_source_get_priority() (#4712)
To properly store priority in passed in pointer and return 0 for success.
Also add a test for verifying that it works correctly.
Zbigniew Jędrzejewski-Szmek [Sat, 19 Nov 2016 17:53:29 +0000 (12:53 -0500)]
sd-dhcp-client: use free_and_strdup
This changes the return value a bit: 1 will be returned if the value is
changed. But the return value was not documented, and the change should
be for the good anyway. Current callers don't care.
Lennart Poettering [Fri, 18 Nov 2016 16:31:49 +0000 (17:31 +0100)]
man: make /etc/nsswitch.conf documentation for nss-resolve match example
Fixes: #4683
Lennart Poettering [Fri, 18 Nov 2016 16:19:44 +0000 (17:19 +0100)]
dhcp4: filter bogus DNS/NTP server addresses silently
if we receive a bogus lease with a DNS/NTP server within local scope let's
politely ignore.
Fixes: #4524
Lennart Poettering [Fri, 18 Nov 2016 16:11:12 +0000 (17:11 +0100)]
networkd: do not automatically propagate bogus DNS/NTP servers
Never propagate DNS/NTP servers on the local link via the DHCP server. The
DNS/NTP servers 0.0.0.0 and 127.0.0.1 only make sense in the local context,
hence never propagate them automatically to other hosts.
Fixes: #4524
Lennart Poettering [Fri, 18 Nov 2016 16:07:52 +0000 (17:07 +0100)]
networkd: rename link_push_dns_to_dhcp_server() → link_push_uplink_dns_to_dhcp_server()
Let's clarify that this is only relevant for pushing uplink DNS config data,
not in any other context.
(Same for NTP)
Lennart Poettering [Fri, 18 Nov 2016 16:04:26 +0000 (17:04 +0100)]
networkd: store DNS servers configured per-network as parsed addresses
DNS servers must be specified as IP addresses, hence let's store them as that
internally, so that they are guaranteed to be fully normalized always, and
invalid data cannot be stored.
Lennart Poettering [Fri, 18 Nov 2016 16:03:13 +0000 (17:03 +0100)]
networkd: minor word extraction fixes
Let's make the loops around extract_first_word() be more alike.
Lennart Poettering [Fri, 18 Nov 2016 16:01:32 +0000 (17:01 +0100)]
networkd: reorder fields in Network struct a bit
Let's reorder them a bit, so that stuff that belongs together semantically is
placed together (in particular, move the various DHCP "use" booleans together).
Lennart Poettering [Fri, 18 Nov 2016 16:00:25 +0000 (17:00 +0100)]
networkd: validate NTP server strings configured in .network files
Let's be a bit stricter, and make sure users only configure proper DNS names or
IP addresses, but not any other strings.
Lennart Poettering [Fri, 18 Nov 2016 15:55:01 +0000 (16:55 +0100)]
shared: add new API to validate a string as hostname or IP address
Lennart Poettering [Fri, 18 Nov 2016 15:48:19 +0000 (16:48 +0100)]
basic: make sure in_addr_from_string() can take NULL arguments
This way, we can use it for validating IP address strings.
Lennart Poettering [Fri, 18 Nov 2016 12:13:28 +0000 (13:13 +0100)]
basic: add explicit ipv4-specific in_addr classification calls
This adds in4_addr_is_localhost() and in4_addr_is_link_local() that only take
an IPv4 "struct in_addr", to match in_addr_is_localhost() and
in_addr_is_link_local() that that a "union in_addr_union".
This matches the existing in4_addr_is_null() call that already exists.
For IPv6 glibc already exports a set of macros, hence we don't add similar
functions in6_addr_is_localhost(). We also drop in6_addr_is_null() as
IN6_IS_ADDR_UNSPECIFIED() already provides that.
Lennart Poettering [Fri, 18 Nov 2016 12:02:57 +0000 (13:02 +0100)]
networkd: rework how we set the hostname on the dhcp4 client
Let's split out the code into its own little function and let's use
gethostname_strict() which already filters out localhost for us.
Lennart Poettering [Fri, 18 Nov 2016 11:33:14 +0000 (12:33 +0100)]
sd-dhcp: permit unsetting the hostname again
Let's handle NULL hostnames (for unsetting it) before we validate the name.
Lennart Poettering [Mon, 21 Nov 2016 17:24:51 +0000 (18:24 +0100)]
Merge pull request #4701 from martinpitt/networkd-polkit
hostnamed: allow networkd to set the transient hostname
Martin Pitt [Mon, 21 Nov 2016 11:53:24 +0000 (12:53 +0100)]
tests: check transient hostname with and without static hostname
We expect a static hostname to win over a transient one, so test both cases.
Evgeny Vereshchagin [Sun, 20 Nov 2016 16:38:58 +0000 (19:38 +0300)]
Merge pull request #4691 from keszybz/test-suite-fixes
Test suite fixes
Martin Pitt [Fri, 18 Nov 2016 15:17:01 +0000 (16:17 +0100)]
hostnamed: allow networkd to set the transient hostname
systemd-networkd runs as user "systemd-network" and thus is not privileged to
set the transient hostname:
systemd-networkd[516]: ens3: Could not set hostname: Interactive authentication required.
Standard polkit *.policy files do not have a syntax for granting privileges to
a user, so ship a pklocalauthority (for polkit < 106) and a JavaScript rules
file (for polkit >= 106) that grants the "systemd-network" system user that
privilege.
Add DnsmasqClientTest.test_transient_hostname() test to networkd-test.py to
cover this. Make do_test() a bit more flexible by interpreting "coldplug==None"
as "test sets up the interface by itself". Change DnsmasqClientTest to set up
test_eth42 with a fixed MAC address so that we can configure dnsmasq to send a
special host name for that.
Fixes #4646
Martin Pitt [Sun, 20 Nov 2016 09:08:23 +0000 (10:08 +0100)]
test: clean up "dummy0" interface after each test case in networkd-test.py
Zbigniew Jędrzejewski-Szmek [Sun, 20 Nov 2016 03:45:23 +0000 (22:45 -0500)]
test-functions: also add qemu define for ppc64