Commit graph

27651 commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 953bf4604f 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).
2016-11-29 01:40:34 -05:00
Zbigniew Jędrzejewski-Szmek 2b656050b6 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.
2016-11-29 01:40:34 -05:00
Martin Pitt 920ec31b5f Merge pull request #4761 from fsateler/python3
Explicitly use python3 everywhere
2016-11-28 21:10:57 +01:00
Tom Gundersen b76d99d9e6 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.
2016-11-28 20:42:40 +01:00
Felipe Sateler b95f5528cc Use python3 explicitly in all python scripts 2016-11-28 15:00:20 -03:00
Felipe Sateler a381e2b5fd build-sys: explicitly require python3
Otherwise python programs might be run with python2
2016-11-28 15:00:20 -03:00
(GalaxyMaster) dc3b8afb93 socket-proxyd: Introduced dynamic connection limit via an option. (#4749) 2016-11-28 18:25:11 +01:00
Daniel Wagner a92cf7840f udevd: check correct return value of fcntl() (#4758)
This looks like a copy&paste error from the code block above.
2016-11-28 18:24:26 +01:00
Martin Pitt fd0cec0366 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.
2016-11-28 14:35:49 +03:00
Dave Reisner d112eae7da device: Avoid calling unit_free(NULL) in device setup logic (#4748)
Since a581e45ae8, 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
2016-11-27 23:05:39 +01:00
Djalal Harouni a748a0169a Merge pull request #4736 from dobyrch/calendar-cleanup
calendarspec: miscellaneous parsing and formatting fixes
2016-11-27 11:43:26 +01:00
Douglas Christman 7c2503218e calendarspec: refactor format_chain()
Factor out repeated references to usec and remove nested ifs.
2016-11-25 11:21:21 -05:00
Waldemar Brodkorb 9bab3b65b0 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.
2016-11-25 11:24:58 +01:00
Martin Pitt 2f08ccc32e 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 115a10c58d.
2016-11-25 07:59:37 +01:00
Douglas Christman c58b1b3abf calendarspec: rename "eom" to "end_of_month" 2016-11-24 18:40:14 -05:00
Douglas Christman 9904dc00e7 calendarspec: make specifications with ranges reversible
"*-*-01..03" is now formatted as "*-*-01..03" instead of "*-*-01,02,03"
2016-11-24 18:40:14 -05:00
Douglas Christman 36ff0c9792 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.
2016-11-24 18:22:08 -05:00
Douglas Christman 3215e35c40 calendarspec: make specifications with seconds wildcard reversible
"*:*:*" is now formatted as "*:*:*" instead of "*:*:00/1"
2016-11-24 18:22:08 -05:00
Douglas Christman 9dfa81a00a 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".
2016-11-24 18:22:08 -05:00
Douglas Christman 6bae2fd4cd calendarspec: reject open weekday ranges
Forbid open ranges like "Tue.."; trailing commas are still OK.
2016-11-24 18:22:08 -05:00
Douglas Christman 04773cb50a calendarspec: reject strings that only contain a timezone
This makes " UTC" an illegal date specification.
2016-11-24 18:22:08 -05:00
Douglas Christman 408a51e156 calendarspec: always interpret a missing time as 00:00:00
"*-*-*" is now equivalent to "*-*-* 00:00:00" (daily)
rather than "*-*-* *:*:*" (every second).
2016-11-24 18:22:08 -05:00
Peter Hutterer 28d329571a Merge pull request #4734 from whot/hwdb-updates
hwdb: add axis overrides for HP Pavilion dv7
2016-11-25 08:46:28 +10:00
Peter Hutterer 2502c8137f hwdb: add axis overrides for HP Pavilion dv7
Fixes #4731
2016-11-25 07:53:18 +10:00
Franck Bui acc28e2e30 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
a4021390fe 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().
2016-11-24 18:52:04 +01:00
Martin Pitt c495dfb9c3 Merge pull request #4729 from martinpitt/hwdb
fix hwdb syntax error and add test for it
2016-11-24 18:19:59 +01:00
Martin Pitt 30dc7898d5 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.
2016-11-24 11:46:03 +01:00
Martin Pitt 54abf90a0b hwdb: fix syntax error in 60-keyboard.hwdb
Fixes #4728
2016-11-24 11:45:55 +01:00
Martin Pitt 115a10c58d 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.
2016-11-24 10:38:01 +01:00
Lennart Poettering bbe16abb61 Merge pull request #4710 from martinpitt/networkd-dbus
networkd: allow networkd to start in early boot
2016-11-24 01:58:33 +01:00
Jouke Witteveen e0c7d5f7be man: document protocol error type for service failures (#4724) 2016-11-23 22:51:33 +01:00
Susant Sahani d6fceaf1f7 networkd: handle MTU field in IPv6 RA (#4719)
This patch handles the custom MTU field in IPv6 RA.

fixes RFE #4464
2016-11-23 22:32:19 +01:00
Lennart Poettering 99245111ac Merge pull request #4703 from dobyrch/calendar-offset
calendarspec: add support for scheduling timers at the end of the month
2016-11-23 22:31:01 +01:00
Michael Biebl 331d6a201b hwdb: use systemd-hwdb instead of obsolete udevadm hwdb (#4722)
Fixes: #4721
2016-11-23 19:21:56 +01:00
Douglas Christman 8ea803516e 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
2016-11-23 12:37:43 -05:00
Douglas Christman f6e7d66b9f 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.
2016-11-23 12:28:00 -05:00
Martin Pitt 5f004d1e32 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
2016-11-23 17:05:11 +01:00
Martin Pitt 7901cea199 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.
2016-11-23 17:05:10 +01:00
Lennart Poettering fadc06bb81 Merge pull request #4259 from joukewitteveen/notify
service: fix main processes exit behavior for type notify services
2016-11-23 16:45:19 +01:00
Susant Sahani b8b40317d0 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
2016-11-23 16:33:01 +01:00
Martin Pitt 2c99aba726 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 ☺ ).
2016-11-23 16:32:06 +01:00
Martin Pitt 59eb33e0fe 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.
2016-11-23 16:32:06 +01:00
Franck Bui a4021390fe core: consider SIGTERM as a clean exit status for initrd-switch-root.service (#4713)
Since commit 1f0958f640, 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.
2016-11-23 16:31:24 +01:00
Zbigniew Jędrzejewski-Szmek 3d4cf7de48 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.
2016-11-23 16:18:30 +01:00
Zbigniew Jędrzejewski-Szmek b0828828bb CONTRIBUTING: reword the part about unsetting the label (#4716)
Only project members can do it.
2016-11-23 08:52:19 +01:00
Zbigniew Jędrzejewski-Szmek ee43050b40 Merge pull request #4692 from poettering/networkd-dhcp
Various networkd/DHCP fixes.
2016-11-22 23:22:04 -05:00
Janne Heß 6d9e45e97f 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
2016-11-22 23:19:56 -05:00
Zbigniew Jędrzejewski-Szmek c5c755e1bc Merge pull request #4693 from poettering/nspawn-ephemeral
nspawn: support ephemeral boots from images
2016-11-22 23:15:07 -05:00
Jouke Witteveen 3d474ef7a6 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.
2016-11-22 17:54:27 +01:00
Jouke Witteveen c35755fb87 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.
2016-11-22 17:54:27 +01:00