Commit Graph

28191 Commits

Author SHA1 Message Date
Jörg Thalheim ff12a7954c treewide: more portable bash shebangs
As in 2a5fcfae02
and in 3e67e5c992
using /usr/bin/env allows bash to be looked up in PATH
rather than being hard-coded.

As with the previous changes the same arguments apply
- distributions have scripts to rewrite shebangs on installation and
  they know what locations to rely on.
- For tests/compilation we should rather rely on the user to have setup
  there PATH correctly.

In particular this makes testing from git easier on NixOS where do not provide
/bin/bash to improve compose-ability.
2020-03-05 17:27:07 +01:00
Zbigniew Jędrzejewski-Szmek eda0cbf071
Use Finished instead of Started for Type=oneshot services (#14851)
UnitStatusMessageFormats.finished_job, if present,
will be called with the same arguments as
job_get_done_status_message_format() to provide a format string
appropriate for the context

This commit replaces "Started" with "Finished" for started oneshot
units, as mentioned in the referenced issue

Closes #2458.
2020-03-05 17:24:19 +01:00
Yu Watanabe 412be51fe8
Merge pull request #15013 from systemd/systemctl-list-dependencies
systemctl list-dependencies: fix duplicate output and take multiple arguments
2020-03-05 20:54:58 +09:00
Zbigniew Jędrzejewski-Szmek 94c3a838da systemctl: make list-dependencies take multiple arguments
Other similar commands do, no reason not to do this here too.
2020-03-05 08:27:58 +01:00
Yu Watanabe df883de98a pid1, nspawn: voidify loopback_setup() 2020-03-04 14:18:55 +01:00
Zbigniew Jędrzejewski-Szmek dbf2801f5a systemctl: do not print items twice in list-dependencies
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1807485.
2020-03-04 09:33:12 +01:00
Yu Watanabe dd0395b565 make namespace_flags_to_string() not return empty string
This improves the following debug log.

Before:
systemd[1162]: Restricting namespace to: .

After:
systemd[1162]: Restricting namespace to: n/a.
2020-03-03 21:17:38 +01:00
Zbigniew Jędrzejewski-Szmek fbd6ac2601
Merge pull request #15009 from keszybz/version-and-doc-updates
Version and doc updates
2020-03-03 20:29:12 +01:00
Zbigniew Jędrzejewski-Szmek efd58985f6
Merge pull request #15002 from keszybz/sysusers-no-proc
Make systemd-sysusers work if /proc is unavailable
2020-03-03 20:28:02 +01:00
Zbigniew Jędrzejewski-Szmek 105a1a36cd tree-wide: fix spelling of lookup and setup verbs
"set up" and "look up" are the verbs, "setup" and "lookup" are the nouns.
2020-03-03 15:02:53 +01:00
Zbigniew Jędrzejewski-Szmek 7e0276b37a
Merge pull request #14874 from bluca/portable_detach_now_block
portablectl: block when stopping a unit on detach (--now)
2020-03-03 14:40:12 +01:00
Christian Göttsche fdb0405edd selinux: check return value of string_to_security_class()
This should never happen, but better safe than sorry.
2020-03-03 14:17:52 +01:00
Zbigniew Jędrzejewski-Szmek 1fb5a5edc7 sysusers: do not require /proc to be mounted
We're operating on known paths in root-owned directories here, so the detour
through toctou-safe methods that require /proc to be mounted is not necessary.
Should fix https://bugzilla.redhat.com/show_bug.cgi?id=1807768.
2020-03-03 12:29:57 +01:00
Zbigniew Jędrzejewski-Szmek 6cb356ca9f basic/fs-util: add a version of chmod_and_chown that doesn not use /proc 2020-03-03 11:56:44 +01:00
Zbigniew Jędrzejewski-Szmek 08c7c3216b sysusers: many different errnos to express one condition
See https://bugzilla.redhat.com/show_bug.cgi?id=1807768. It turns
out that sysusers cannot query if the group exists:
Failed to check if group dnsmasq already exists: No such process
...
Failed to check if group systemd-timesync already exists: No such process

When the same command is executed later, the issue does not occur. Not sure why
the behaviour in the initial transaction is different. But let's accept all
errors that the man pages list. We check if the user/group exists before creating
anyway, so this seems pretty safe.
2020-03-03 11:56:25 +01:00
Susant Sahani a75b211750 network: Move config_parse_ip_service_type to networkd-dhcp4.c and
rename
2020-03-03 11:53:49 +09:00
Zbigniew Jędrzejewski-Szmek 52c222db11
Merge pull request #14992 from keszybz/syslog-address-length-fix
Syslog address length fix
2020-03-02 21:31:24 +01:00
Zbigniew Jędrzejewski-Szmek 2b43402c84 ask-password-api: drop unneeded parentheses 2020-03-02 15:56:30 +01:00
Zbigniew Jędrzejewski-Szmek 86fca584c3 core/execute: use return value from sockaddr_un_set_path(), remove duplicate check 2020-03-02 15:56:30 +01:00
Zbigniew Jędrzejewski-Szmek 425d925f24 homed,userdb: don't use sockaddr_un_set_path() on fixed addresses
Let's use structured initialization and let the compiler do its job.
2020-03-02 15:56:30 +01:00
Zbigniew Jędrzejewski-Szmek f36a9d5909 tree-wide: use the return value from sockaddr_un_set_path()
It fully initializes the address structure, so no need for pre-initialization,
and also returns the length of the address, so no need to recalculate using
SOCKADDR_UN_LEN().

socklen_t is unsigned, so let's not use an int for it. (It doesn't matter, but
seems cleaner and more portable to not assume anything about the type.)
2020-03-02 15:55:44 +01:00
Zbigniew Jędrzejewski-Szmek 0f18868723 test-sizeof: print size socklen_t
It returns 32 bits, unsigned on amd64, so it's probably similar everywhere
with glibc. But let's make the code generic, without assuming specific size
or signedness.
2020-03-02 15:54:57 +01:00
Zbigniew Jędrzejewski-Szmek 64177e9e4e journald: fix forwarding to syslog
.msg_namelen was set to a bogus value before we actually stored the path in the
the structure. sockaddr_un_set_path() returns the length, so just use that.

Fixes #14799.
2020-03-02 15:47:41 +01:00
HATAYAMA Daisuke 27f31daf3e shared/logs-show: Remove unused OUTPUT_FOLLOW
As of the commit aae9a96d4b removing --follow
option in systemctl command, OUTPUT_FOLLOW has never been set anywhere. Let's
remove it.

The condition expression of the if-statement in show_journal() that refers to
OUTPUT_FOLLOW now thus evaluates always to true. Hence, the call of
sd_journal_wait() is in dead code, and the outer infinite for-loop is
meaningless, which we remove as cleanup.

There is no functional change by this commit.
2020-03-02 18:27:55 +09:00
Yu Watanabe ef62949a23 network: make Type=ether match based on iftype
This makes Type= can match the type shown in networkctl.

Closes #14952.
2020-03-02 08:52:18 +01:00
Yu Watanabe ed87ce1d5d
Merge pull request #14990 from keszybz/nss-homed-fix
Fix for lookup of groups defined by homed
2020-03-02 15:18:13 +09:00
Romain Naour 123aeae206
random-seed: add missing header for GRND_NONBLOCK (#14988)
GRND_NONBLOCK has been introduced with the 3.17 kernel version [1]
while adding getrandom(2) system call.

The header missing_random.h is needed for random-seed.c when building
with old toolchain, such Sourcery CodeBench ARM 2014.05 (kernel headers
3.13).

Fixes:
https://gitlab.com/buildroot.org/buildroot/-/jobs/454255917

[1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit/?id=c6e9d6f38894798696f23c8084ca7edbf16ee895
2020-03-02 14:48:21 +09:00
Yu Watanabe a7b74efd1c
Merge pull request #14983 from ssahani/dhcp-use-routes-14982
network: Allow to configure GW even if UseRoutes=false
2020-03-02 14:44:00 +09:00
Zbigniew Jędrzejewski-Szmek df46dbca92
Merge pull request #14976 from keszybz/show-status-message
core: fix message about show status state
2020-03-01 23:37:41 +01:00
Susant Sahani ad098b14c5 network: Allow to configure GW even UseRoutes=false
When use UseRoutes=False so the DHCP request itself does not request
for Classless Static Routes option.
As a result, the DHCP server will only respond with a Router option.
In this case since we are using the UseRoutes=False option the gateway
that comes in via the router option does not get configured.
This patch fixes theis behaviour.
2020-03-02 01:28:27 +09:00
Yu Watanabe df70539f9f resolve: error handling improvements 2020-03-01 14:02:23 +01:00
Zbigniew Jędrzejewski-Szmek 6f22d57235 userdb: fix lookup of groups defined by homed 2020-03-01 12:24:56 +01:00
Zbigniew Jędrzejewski-Szmek 3e93027b5b Fix two typos 2020-03-01 12:24:25 +01:00
Zbigniew Jędrzejewski-Szmek 0d066dd1a4 pid1: add new mode systemd.show-status=error and use it when 'quiet' is passed
systemd.show-status=error is useful for the case where people care about errors
only.

If people want to have a quiet boot, they most likely don't want to see all
status output even if there is a delay in boot, so make "quiet" imply
systemd.show-status=error instead of systemd.show-status=auto.

Fixes #14976.
2020-03-01 11:48:23 +01:00
Zbigniew Jędrzejewski-Szmek 5bcf34ebf3 pid1: when showing error status, do not switch to status=temporary
We would flip to status=temporary mode on the first error, and then switch back
to status=auto after the initial transaction was done. This isn't very useful,
because usually all the messages about successfully started units and not
related to the original failure. In fact, all those messages most likely cause
the information about the prime error to scroll off screen. And if the user
requested quiet boot, there's no reason to think that they care about those
success messages.

Also, when logging about dependency cycles, treat this similarly to a unit
error and show the message even if the status is "soft disabled" (before we
wouldn't show it in that case).
2020-03-01 11:42:42 +01:00
Zbigniew Jędrzejewski-Szmek 1b4154a891 pid1: make cylon timeout significantly bigger when not showing any messages
When we are booting with show-status=on, normally new status updates happen a
few times per second. Thus, it is reasonable to start showing the cylon eye
after 5 s, because that means a significant delay has happened. When we are
running with show-status=off or show-status=auto (and no error had occured),
the user is expecting maybe 15 to 90 seconds with no output (because that's
usually how long the whole boot takes). So we shouldn't bother the user with
information about a few seconds of delay. Let's make the timeout 25s if we are
not showing any messages.

Conversly, when we are outputting status messages, we can show the cylon eye
with a shorter delay, now that we removed the connection to enablement status.
Let's make this 2s, so users get feedback about delays more quickly.
2020-03-01 11:42:35 +01:00
Zbigniew Jędrzejewski-Szmek ef15d3e1ab pid1: touch the /run/systemd/show-status just once
We know if we created the file before, no need to repeat the operation. The
state in /run should always match our internal state. Since we call
manager_set_show_status() quite often internally, this saves quite a few
pointless syscalls.
2020-03-01 11:42:26 +01:00
Zbigniew Jędrzejewski-Szmek 7365a29670 pid1: when printing status message status, give reason 2020-03-01 11:42:19 +01:00
Zbigniew Jędrzejewski-Szmek 5ca02bfc39 core: fix message about show status state
We would say "Enabling" also for SHOW_STATUS_AUTO, which is actually
"soft off". So just print the exact state to make things easier to understand.
Also add a helper function to avoid repeating the enum value list.

For #14814.
2020-03-01 11:42:12 +01:00
Yu Watanabe 8ad2012d1e
Merge pull request #14966 from keszybz/journalctl-facilities
journalctl: filtering by facility
2020-03-01 13:17:00 +09:00
Zbigniew Jędrzejewski-Szmek 196dedd503 journalctl: implement --facility=foo
Fixes #9716.
2020-02-29 18:07:37 +01:00
Yu Watanabe c4ad7f83ec homed: fix typo 2020-02-29 16:06:45 +01:00
Topi Miettinen aeac9dd647 Revert "namespace: fix MAC labels of /dev when PrivateDevices=yes"
This reverts commit e6e81ec0a5.
2020-02-29 23:35:43 +09:00
Zbigniew Jędrzejewski-Szmek ee00d1e95e pid1: do not fail if we get EPERM while setting up network name
In a user namespace container:
Feb 28 12:45:53 0b2420135953 systemd[1]: Starting Home Manager...
Feb 28 12:45:53 0b2420135953 systemd[21]: systemd-homed.service: Failed to set up network namespacing: Operation not permitted
Feb 28 12:45:53 0b2420135953 systemd[21]: systemd-homed.service: Failed at step NETWORK spawning /usr/lib/systemd/systemd-homed: Operation not permitted
Feb 28 12:45:53 0b2420135953 systemd[1]: systemd-homed.service: Main process exited, code=exited, status=225/NETWORK
Feb 28 12:45:53 0b2420135953 systemd[1]: systemd-homed.service: Failed with result 'exit-code'.
Feb 28 12:45:53 0b2420135953 systemd[1]: Failed to start Home Manager.

We should treat this similarly to the case where network namespace are not
supported at all.

https://bugzilla.redhat.com/show_bug.cgi?id=1807465
2020-02-29 19:33:19 +09:00
Nate Jones ecf63c9102 execute: Make '+' exec prefix ignore PrivateTmp=yes
The man pages state that the '+' prefix in Exec* directives should
ignore filesystem namespacing options such as PrivateTmp. Now it does.

This is very similar to #8842, just with PrivateTmp instead of
PrivateDevices.
2020-02-29 19:32:01 +09:00
Zbigniew Jędrzejewski-Szmek ec0c9d3bcd
Merge pull request #14968 from keszybz/docs
Assorted updates to documentation
2020-02-28 21:36:12 +01:00
Zbigniew Jędrzejewski-Szmek 6ffeca8c8f meson: explain GIT_VERSION and PROJECT_VERSION
Fixes #11415.
2020-02-28 16:54:33 +01:00
Yu Watanabe 8956caf333 network: fix typo in comment 2020-02-28 16:52:33 +01:00
Topi Miettinen e6e81ec0a5 namespace: fix MAC labels of /dev when PrivateDevices=yes
Without changing the SELinux label for private /dev of a service, it will take
a generic file system label:
system_u:object_r:tmpfs_t:s0

After this change it is the same as without `PrivateDevices=yes`:
system_u:object_r:device_t:s0

This helps writing SELinux policies, as the same rules for `/dev` will apply
despite any `PrivateDevices=yes` setting.
2020-02-28 14:17:48 +00:00
Yu Watanabe 07336a0672 network: assume Scope=host when Address= is loopback address
Fixes #14903.
2020-02-28 09:53:36 +01:00