Commit graph

31363 commits

Author SHA1 Message Date
Max Harmathy 5424824adf Fix logical error in meson.build (#7658)
sysvinit_path and sysvrcnd_path have to be set both to activate Sysv compatibility.
2017-12-15 16:05:25 +01:00
Zbigniew Jędrzejewski-Szmek e09fc88440 mount: add option to specify uid= and gid=
The kernel needs two numbers, but for the user it's most convenient to provide the
user name and have that resolved to uid and gid.

Right now the primary group of the specified user is always used. That's the most
common case anyway. In the future we can extend the --owner option to allow a group
after a colon.

[I added this before realizing that this will not be enough to be used for user
runtime directory. But this seems useful on its own, so I'm keeping this commit.]
2017-12-15 14:57:07 +01:00
Zbigniew Jędrzejewski-Szmek 8426bfd397 logind: use free_and_replace in one spot
No functional change.
2017-12-15 14:57:07 +01:00
Zbigniew Jędrzejewski-Szmek e5af6e0e2d tree-wide: use SPECIAL_ROOT_SLICE 2017-12-15 14:57:07 +01:00
Zbigniew Jędrzejewski-Szmek a789420775 core: reuse slice_build_parent_slice 2017-12-15 14:57:07 +01:00
Zbigniew Jędrzejewski-Szmek 8b5c4d167a logind: fix misleading message
This message would also be emitted at boot for any user with linger
enabled, so "logged in" is the wrong term to use.
2017-12-15 14:57:07 +01:00
Zbigniew Jędrzejewski-Szmek f52da59548 logind: simplify one conditional
Don't bother with removing the directory if we didn't create it.
2017-12-15 14:57:07 +01:00
Ken (Bitsko) MacLeod bd2538b50b man: Clarify when OnFailure= activates after restarts (#7646) 2017-12-15 11:10:41 +01:00
Lennart Poettering f1d34068ef tree-wide: add DEBUG_LOGGING macro that checks whether debug logging is on (#7645)
This makes things a bit easier to read I think, and also makes sure we
always use the _unlikely_ wrapper around it, which so far we used
sometimes and other times we didn't. Let's clean that up.
2017-12-15 11:09:00 +01:00
Lennart Poettering 42521cd1ed
Merge pull request #7637 from yuwata/transient-path
core/path: implement transient path unit
2017-12-15 10:53:49 +01:00
Lennart Poettering b794712a1c
Merge pull request #7631 from cgwalters/systemctl-offline
systemctl,verbs: Introduce SYSTEMCTL_OFFLINE environment variable
2017-12-15 10:29:21 +01:00
Lennart Poettering de68b6a796
Merge pull request #7644 from poettering/memzero
add memzero()/zero() coccinelle scripts and use them
2017-12-15 10:27:31 +01:00
Lennart Poettering c920e651e6
CODING_STYLE: provide better explanation why /* */ over // (#7647)
Let's provide a real reason why /* */ should be used for commenting,
rather than //, beyond mere taste.

(This ultimately simply codifies how I use // vs. /* */ comments, and I
think this is useful as an explanation and reason hence.)
2017-12-15 10:26:07 +01:00
Yu Watanabe 69ec5decf0 TODO: update 2017-12-15 09:11:54 +09:00
Yu Watanabe d852bda105 doc: update TRANSIENT-SETTINGS.md 2017-12-15 09:11:51 +09:00
Yu Watanabe 535e0d19a2 bus-unit-util: add path unit related options 2017-12-15 09:11:39 +09:00
Yu Watanabe 5b9fbf8989 core/path: implement transient path unit 2017-12-15 09:10:34 +09:00
Yu Watanabe 1e3b7b0ec8 core/dbus-timer: improve error messages 2017-12-15 09:10:28 +09:00
Yu Watanabe afcb1cd3a3 bus-unit-util: improve error messages 2017-12-15 09:10:21 +09:00
Yu Watanabe ed7e9b34ce bus-unit-util: remove unnecessary oom check
We cannot detect error by alloca().
2017-12-15 09:10:17 +09:00
Lennart Poettering a1b2c92d82 final v236 update (#7649) 2017-12-14 23:09:57 +01:00
Lennart Poettering a181c67462
Merge pull request #7608 from poettering/more-news-v236
more v236 news improvements
2017-12-14 22:58:22 +01:00
Lennart Poettering f78a88beca
Merge pull request #6598 from kyle-walker/shutdown-limit
core: Limit the time and attempts in shutdown remount/umount efforts
2017-12-14 22:57:57 +01:00
Lennart Poettering e3140015a7
Merge pull request #7640 from keszybz/tainting-updates
Tainting updates
2017-12-14 22:57:17 +01:00
Zbigniew Jędrzejewski-Szmek bdd2bbc445
Merge pull request #7469 from kinvolk/dongsu/nspawn-netns
nspawn: introduce an option for specifying network namespace path
2017-12-14 22:47:57 +01:00
Zbigniew Jędrzejewski-Szmek 590171d1c9 Update TODO 2017-12-14 22:14:39 +01:00
Zbigniew Jędrzejewski-Szmek 49e74d7e2e meson: restore --update-catalog call after install
This got dropped by mistake in 72cdb3e783.
2017-12-14 22:14:38 +01:00
Zbigniew Jędrzejewski-Szmek b2e7486cc7 Make taint message structured and add catalog entry
Dec 14 14:10:54 krowka systemd[1]: System is tainted: overflowgid-not-65534
-- Subject: The system is configured in a way that might cause problems
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- The following "tags" are possible:
-- - "split-usr" — /usr is a separate file system and was not mounted when systemd
--   was booted
-- - "cgroups-missing" — the kernel was compiled without cgroup support or access
--   to expected interface files is resticted
-- - "var-run-bad" — /var/run is not a symlink to /run
-- - "overflowuid-not-65534" — the kernel user ID used for "unknown" users (with
--   NFS or user namespaces) is not 65534
-- - "overflowgid-not-65534" — the kernel group ID used for "unknown" users (with
--   NFS or user namespaces) is not 65534
-- Current system is tagged as overflowgid-not-65534.
2017-12-14 22:14:38 +01:00
Zbigniew Jędrzejewski-Szmek 198ce93248 core: drop taints for nobody user/group names
We have a check and warning at compile time. The user cannot do anything about
this at runtime, and all other taints are about checks that happen at runtime
and are specific to that system (and at least potentially correctable).

(The logic in the compilation-time check was updated to treat "nogroup" as OK,
but not the runtime check. But I think it's better to remove the runtime check
for this altogether, so this becomes moot.)
2017-12-14 22:14:38 +01:00
Colin Walters c56d1e2c1b verbs: Rename VERB_OFFLINE to VERB_ONLINE_ONLY, expand MUSTBEROOT
Followup to previous commit. Suggested by @poettering.
Reindented the `verbs[]` tables to match the apparent previous
whitespace rules (indent to one flag, allow multiple flags to overflow?).
2017-12-14 16:12:14 -05:00
Colin Walters f38951a628 systemctl,verbs: Introduce SYSTEMD_OFFLINE environment variable
A lot of code references the `running_in_chroot()` function; while
I didn't dig I'm pretty certain this arose to deal with situations
like RPM package builds in `mock` - there we don't want the `%post`s
to `systemctl start` for example.

And actually this exact same use case arises for
[rpm-ostree](https://github.com/projectatomic/rpm-ostree/)
where we implement offline upgrades by default; the `%post`s are
always run in a new chroot using [bwrap](https://github.com/projectatomic/bubblewrap).

And here's the problem: bwrap creates proper mount roots, so it
passes `running_in_chroot()`, and then if a script tries to do
`systemctl start` we get:
`System has not been booted with systemd as init system (PID 1)`
but that's an *error*, unlike the `running_in_chroot()` case where we ignore.

Further complicating things is there are real world RPM packages
like `glusterfs` which end up invoking `systemctl start`.

A while ago, the `SYSTEMD_IGNORE_CHROOT` environment variable was
added for the inverse case of running in a chroot, but still wanting
to use systemd as PID 1 (presumably some broken initramfs setups?).

Let's introduce a `SYSTEMD_OFFLINE` environment variable for cases like
mock/rpm-ostree so we can force on the "ignore everything except preset" logic.
This way we'll still not start services even if mock switches to use nspawn or
bwrap or something else that isn't a chroot.

We also cleanly supercede the `SYSTEMD_IGNORE_CHROOT=1` which is now spelled
`SYSTEMD_OFFLINE=0`.  (Suggested by @poettering)

Also I made things slightly nicer here and we now print the ignored operation.
2017-12-14 16:00:16 -05:00
Zbigniew Jędrzejewski-Szmek 6c9c81fce1
Merge pull request #7643 from keszybz/hwdb-update-again
Hwdb update again
2017-12-14 21:13:20 +01:00
Lennart Poettering 14965b94f2
resolve: extend systemd-resolve so that it can push per-interface DNS configuration into systemd-resolved (#7576)
This is useful to debug things, but also to hook up external post-up
scripts with resolved.

Eventually this code might be useful to implement a
resolvconf(8)-compatible interface for compatibility purposes. Since the
semantics don't map entirely cleanly as first step we add a native
interface for pushing DNS configuration into resolved, that exposes the
correct semantics, before adding any compatibility interface.

See: #7202
2017-12-14 20:13:14 +01:00
Lennart Poettering c805d41c9b udev-link-config: add missing OOM check 2017-12-14 20:09:45 +01:00
Lennart Poettering ab27086387 link-config: make initialization to -1 less weird
memset() is weird anyway, since it expects an "int" as second parameter,
which it then uses as a byte, i.e. as uint8_t or something like that.
But by passing -1 to it, things get particularly weird, as that relies
on sign expansion to do the right thing.
2017-12-14 19:51:25 +01:00
Lennart Poettering 673192494c coccinelle: automatically rewrite memset() to zero() or memzero() where we can
We are pretty good at this already, hence only a single case is actually
found by this.
2017-12-14 19:47:46 +01:00
Lennart Poettering fbd0b64f44
tree-wide: make use of new STRLEN() macro everywhere (#7639)
Let's employ coccinelle to do this for us.

Follow-up for #7625.
2017-12-14 19:02:29 +01:00
Kyle Walker 73ad712fcf core: Implement sync_with_progress()
In similar fashion to the previous change, sync() operations can stall
endlessly if cache is unable to be written out. In order to avoid an
unbounded hang, the sync takes place within a child process. Every 10
seconds (SYNC_TIMEOUT_USEC), the value of /proc/meminfo "Dirty" is checked
to verify it is smaller than the last iteration. If the sync is not making
progress for 3 successive iterations (SYNC_PROGRESS_ATTEMPTS), a SIGKILL is
sent to the sync process and the shutdown continues.
2017-12-14 11:46:03 -05:00
Iago López Galeiras f3d33947ea test: add smoke tests for --network-namespace-path
We create net ns with `ip netns`, pass the created ns to nspawn and
check the loopback interface is DOWN.
2017-12-14 17:34:26 +01:00
Lennart Poettering ea2a3c9e50 NEWS: update NEWS again, and prepare for a release tomorrow 2017-12-14 17:29:30 +01:00
Lennart Poettering cbd73c69ba meson: increase version numbers 2017-12-14 17:29:30 +01:00
Lennart Poettering 1142cbd76a
Merge pull request #7610 from poettering/stdio-nolocking
use __fsetlocking() to turn off thread locking in STDIO where applicable
2017-12-14 16:56:36 +01:00
Zbigniew Jędrzejewski-Szmek 82267a45dd hwdb: update
The changes in pci.ids, usb.ids, and the .hwdb files are almost always
additions. 20-OUI.hwdb drops a few names and replaces them by
"IEEE Registration Authority". I'm not sure what to do about this.
Many other removals do not seem to be removals of real entries, but
rather placeholder or generic names.
2017-12-14 16:01:24 +01:00
Zbigniew Jędrzejewski-Szmek af49df623e hwdb/ids_parser: use replacement chars for invalid characters
We have some more non-utf8 characters. Let's just replace them, this doesn't
matter much.
2017-12-14 15:47:39 +01:00
Zbigniew Jędrzejewski-Szmek c6801f502c meson-hwdb-update: fix undefined variable access
I added the test if an optional parameter is not empty, but that doesn't work
with -u. Provide an empty "fallback" value to fix the issue.

Also group the update steps so that it's easier to see what is going on.
2017-12-14 15:45:21 +01:00
Kyle Walker d5641e0d7e core: Implement timeout based umount/remount limit
Remount, and subsequent umount, attempts can hang for inaccessible network
based mount points. This can leave a system in a hard hang state that
requires a hard reset in order to recover. This change moves the remount,
and umount attempts into separate child processes. The remount and umount
operations will block for up to 90 seconds (DEFAULT_TIMEOUT_USEC). Should
those waits fail, the parent will issue a SIGKILL to the child and continue
with the shutdown efforts.

In addition, instead of only reporting some additional errors on the final
attempt, failures are reported as they occur.
2017-12-14 08:58:56 -05:00
Cong Wang f581267a02 sd-bus: fix a memory leak in message_new_reply() (#7636)
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
2017-12-14 13:07:04 +01:00
Lennart Poettering e18c15413d
Merge pull request #7606 from yuwata/run-timer
run: allow to specify multiple timer options
2017-12-14 13:04:30 +01:00
Daniel Black a327431bd1 core: add EXTEND_TIMEOUT_USEC={usec} - prevent timeouts in startup/runtime/shutdown (#7214)
With Type=notify services, EXTEND_TIMEOUT_USEC= messages will delay any startup/
runtime/shutdown timeouts.

A service that hasn't timed out, i.e, start time < TimeStartSec,
runtime < RuntimeMaxSec and stop time < TimeoutStopSec, may by sending
EXTEND_TIMEOUT_USEC=, allow the service to continue beyond the limit for
the execution phase (i.e TimeStartSec, RunTimeMaxSec and TimeoutStopSec).

EXTEND_TIMEOUT_USEC= must continue to be sent (in the same way as
WATCHDOG=1) within the time interval specified to continue to reprevent
the timeout from occuring.

Watchdog timeouts are also extended if a EXTEND_TIMEOUT_USEC is greater
than the remaining time on the watchdog counter.

Fixes #5868.
2017-12-14 12:17:43 +01:00
Lennart Poettering e51faad3d5 busctl: let's make use of the log_error_errno() calls 2017-12-14 10:46:19 +01:00