Commit graph

30514 commits

Author SHA1 Message Date
Lennart Poettering 14068e17f3 core: add support for expanding state/cache/log directory root in unit files
This augments %t which already resolves to the runtime directory root, and
should be useful for units that want to pass any of these paths in
command line arguments.

Example:

ExecStart=/usr/bin/mydaemon --datadir=%S/mydaemon

Why not expose a specifier resolving directly to the configured
state/runtime/cache/log dir? Three reasons:

1. Specifiers should be independent of configuration of the unit itself,
   and StateDirectory= and friends are unit configuration.  See
   03fc9c723c and related work.

2. We permit multiple StateDirectory= values per unit, and it hence
   wouldn't be clear which one is passed.

3. We already have %t for the runtime directory root, and we should
   continue with the same scheme.
2017-10-26 17:59:09 +02:00
Lennart Poettering 3992bce17f update TODO 2017-10-26 17:54:56 +02:00
Lennart Poettering 9fb0b9c70d machine-image: handle nicely if the user asks us to remove a symlinked image
Much like for dirs/raw images lets remove the symlink and not the
destination.
2017-10-26 17:54:56 +02:00
Lennart Poettering 759aaedc5c dissect: when we invoke dissection on a loop device with partscan help the user
This adds some simply detection logic for cases where dissection is
invoked on an externally created loop device, and partitions have been
detected on it, but partition scanning so far was off. If this is
detected we now print a brief message indicating what the issue is,
instead of failing with a useless EINVAL message the kernel passed to
us.
2017-10-26 17:54:56 +02:00
Lennart Poettering eb38edce88 machine-image: add partial discovery of block devices as images
This adds some basic discovery of block device images for nspawn and
friends. Note that this doesn't add searching for block devices using
udev, but instead expects users to symlink relevant block devices into
/var/lib/machines. Discovery is hence done exactly like for
dir/subvol/raw file images, except that what is found may be a (symlink
to) a block device.

For now, we do not support cloning these images, but removal, renaming
and read-only flags are supported to the point where that makes sense.

Fixe: #6990
2017-10-26 17:54:56 +02:00
Lennart Poettering 8c4a8ea2ac fs-util: small tweak in chase_symlinks()
If we follow an absolute symlink there's no need to prefix the path with
a "/", since by definition it already has one.

This helps suppressing double "/" in resolved paths containing absolute
symlinks.
2017-10-26 17:54:56 +02:00
Lennart Poettering f7c9f4a2a9 btrfs-util: when opening subvolume fds, always set O_NOFOLLOW
Some of the btrfs utility functions already used O_NOFOLLOW others
didn't. Let's streamline this, and refuse operation when we are called
for symlinks on "remove" and "snapshot" too.

In particular in the "remove" case following symlinks is a bad idea, and
is quite different from how unlink() and friends work, which always
remove the symlink, and not the destination, a logic we should follow
here too.
2017-10-26 17:54:56 +02:00
Razvan Cojocaru 530c1c3028 systemd-detect-virt: refine hypervisor detection (#7171)
Continue to try to get more details about the actual underlying
hypervisor with successive tests until none are available.
This fixes issue #7165.
2017-10-26 16:59:04 +02:00
Zbigniew Jędrzejewski-Szmek 8aeadf3052 Merge pull request #7184 from keszybz/resolved-loop
resolved: fix loop on packets with pseudo dns types

https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1725351,
CVE-2017-15908.
2017-10-26 15:29:03 +02:00
Lennart Poettering 35682fd4a1 Merge pull request #7127 from keszybz/sundry-tweaks
Various unrelated small patches
2017-10-26 10:57:00 +02:00
Lennart Poettering af163d70ae Merge pull request #7142 from sourcejedi/systemd-shutdown
systemd-shutdown: avoid confusingly redundant messages
2017-10-26 10:56:44 +02:00
martingh 5e38eb931f Adding timer_event to wakeup as suggested by MHD_get_timeout (#7152) 2017-10-26 10:54:30 +02:00
Lars Kellogg-Stedman 5cfde7ad29 hwdb: Add ACCEL_MOUNT_MATRIX for ThinkPad Yoga 11e (#7174)
Accelerometer readings from the screen accelerometer on the Yoga 11e
need to be rotated 90 degrees around the Z axis.
2017-10-25 13:23:51 +02:00
Zbigniew Jędrzejewski-Szmek 9f939335a0 resolved: fix loop on packets with pseudo dns types
Reported by Karim Hossen & Thomas Imbert from Sogeti ESEC R&D.

https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1725351
2017-10-25 11:47:04 +02:00
Hans de Goede b141888b30 hwdb: Document expected MOUNT_MATRIX on devices with non upright display (#7177)
On some devices the display (LCD panel) is mounted non upright
in the device's casing, e.g. mounted upside-down or 90 degree rotated.

Document the expected ACCEL_MOUNT_MATRIX settings for such devices.
2017-10-25 09:47:27 +02:00
Lauri Tirkkonen 4f13e53428 nspawn: EROFS for chowning mount points is not fatal (#7122)
This fixes --read-only with --private-users. mkdir_userns_p may return
-EROFS if either mkdir or lchown fails; lchown failing is fine as the
mount point will just be overmounted, and if mkdir fails then the
following mount() will also fail (with ENOENT).
2017-10-24 19:40:50 +02:00
Alan Jenkins 116e6d9643 core: systemd-shutdown: avoid confusingly redundant messages
After previous output from systemd-shutdown indicated a bug, my attention
was drawn to redundant output lines.  Did they indicate an anomaly?

It turns out to be an expected, harmless result of the current code.  But
we don't have much justification to run such redundant operations.  Let's
remove the confusing redundant message.

We can stop trying to remount a directory read-only once its mount entry
has successfully been changed to "ro".  We can simply let the kernel keep
track of this for us.  I don't bother to try and avoid re-parsing the
mountinfo.  I appreciate snappy shutdowns, but this code is already
intricate and buggy enough (see issue 7131).

(Disclaimer: At least for the moment, you can't _rely_ on always seeing
suspicious output from systemd-shutdown.  By default, you can expect the
kernel to truncate the log output of systemd-shutdown.  Ick ick ick!
Because /dev/kmsg is rate-limited by default.  Normally it prints a message
"X lines supressed", but we tend to shut down before the timer expires
in this case).

Before:

systemd-shutdown[1]: Remounting '/' read-only with options 'seclabel...
EXT4-fs (vda3): re-mounted. Opts: data=ordered
systemd-shutdown[1]: Remounting '/' read-only with options 'seclabel, ...
EXT4-fs (vda3): re-mounted. Opts: data=ordered

After:

systemd-shutdown[1]: Remounting '/' read-only with options 'seclabel, ...
EXT4-fs (vda3): re-mounted. Opts: data=ordered

I also tested with `systemctl reboot --force`, plus a loopback mount to
cause one of the umounts to fail initially.  In this case another 2 lines
of output are removed (out of a larger number of lines).
2017-10-24 15:54:30 +01:00
Dimitri John Ledkov e6b2d948f8 resolved: create private stub resolve file for /etc/resolv.conf integration (#7014)
This creates a second private resolve.conf file which lists the stub resolver
and the resolved acquired search domains.

This runtime file should be used as a symlink target for /etc/resolv.conf such
that non-nss based applications can resolve search domains.

Fixes: #7009
2017-10-24 15:28:41 +02:00
Lennart Poettering ceeb433c39 Merge pull request #7141 from yuwata/fix-7129
core: fix D-Bus API
2017-10-24 15:25:12 +02:00
Zbigniew Jędrzejewski-Szmek 0c2826c60c core: in --user mode, report READY=1 as soon as basic.target is reached (#7102)
When a user logs in, systemd-pam will wait for the user manager instance to
report readiness. We don't need to wait for all the jobs to finish, it
is enough if the basic startup is done and the user manager is responsive.

systemd --user will now send out a READY=1 notification when either of two
conditions becomes true:
- basic.target/start job is gone,
- the initial transaction is done.

Also fixes #2863.
2017-10-24 14:48:54 +02:00
Lennart Poettering e0237035a0 Merge pull request #7123 from keszybz/date-formatting
Fix for time stamp formatting in timedatectl
2017-10-24 12:24:09 +02:00
Yu Watanabe 3f856a2813 core: fix D-Bus API
This fixes bugs introduced by cffaed83e8.

Closes #7129.
2017-10-24 17:21:27 +09:00
myrkr 1898e5f9a3 nspawn: Fix calculation of capabilities for configuration file (#7087)
The current code shifting an integer 1 failed for capabilities like
CAP_MAC_ADMIN (numerical value 33). This caused issues when specifying
them in the nspawn configuration file. Using an uint64_t 1 instead.

The similar code for processing the --capability command line option
was already correctly working.
2017-10-24 09:56:40 +02:00
Zbigniew Jędrzejewski-Szmek fc5ffacdab man: update the description of interval limiting (#7128)
Fixes #7125.
2017-10-24 09:41:52 +02:00
Lennart Poettering b88d48c2ca Merge pull request #7148 from keszybz/dynamic-user-use-gid
Use gid for static dynamic users
2017-10-24 09:38:01 +02:00
Mantas Mikulėnas 195b943d4e NEWS: start adding 236 (#7159) 2017-10-23 22:56:01 +02:00
Lennart Poettering d3aa0a1c42 Merge pull request #6948 from pfl/radv_emit_dns
Add EmitDNS= and EmitDomains= network file configuration options
2017-10-23 18:39:07 +02:00
Zbigniew Jędrzejewski-Szmek c2983a7fdd core/dynamic-user: use gid from pwnam if a static user was found
Fixes #7133.

v2:
- update based on review
2017-10-23 16:09:20 +02:00
Peter Hutterer de13433b2f hwdb: invert the USB touchpad integration assumption (#7161)
The vast majority of touchpads are internal, so let's assume that any USB
touchpad is internal by default (exception: bluetooth) and manually mark the
ones that are external. That's a lot more future-proof than having to mark all
internal touchpads that use USB as internal - that number is only going to
increase.

Related to #7068
2017-10-23 10:20:16 +02:00
Michael Biebl 02fa054dc4 modprobe.d: fix directory of modprobe configuration file (#7149)
kmod upstream uses /lib/modprobe.d which means we need to use rootprefix
instead of prefix for installing the modprobe configuration file as
otherwise split-usr systems are broken.

See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=879191
2017-10-21 08:32:50 +02:00
Zbigniew Jędrzejewski-Szmek 362d90b7f2 core/dynamic-user: use _cleanup_ in dynamic user locking
This makes the code a bit easier to read.
2017-10-20 13:39:07 +02:00
Patrik Flykt 6852c0f6b0 sd-radv: Allocate space also for DNSSL iov option (#7144)
The iov array needs to hold five entries in addition to the number
of prefixes.
2017-10-20 10:59:15 +02:00
Alan Jenkins 066b753dc5 core: systemd-shutdown: add missing check for umount_changed
The assumption was that nothing changes in the final attempt.  This
would be confusing if a filesystem with a process in uninterruptible
sleep suddenly became un-stuck for the final attempt, but we still give
up and don't try to e.g. unmount any parent mounts.

I don't know how possible that is.  But the code will be easier to read
without an assumption that it does not attempt to justify.
2017-10-19 15:00:57 +01:00
Zbigniew Jędrzejewski-Szmek 8cb8326606 logind: fix killing of scopes
scope_abandon() called unit_watch_all_pids() to check if there are any pids in
the cgroup, but unit_watch_all_pids() does nothing (and returns an empty set of
pids) when cg_unified_controller(SYSTEMD) returns true. On hybrid or unified,
cg_unified_controller(SYSTEMD) returns 1, so scope_abandon() thinks the scope
is empty, even though it's not, and marks the scope dead prematurely.

Example output after the scope is marked dead with processes still being present:

● session-24.scope - Session 24 of user guest
   Loaded: loaded (/run/systemd/transient/session-24.scope; transient; vendor preset: disabled)
Transient: yes
   Active: inactive (dead) since Sat 2017-10-14 15:36:22 CEST; 5min ago
    Tasks: 1
   CGroup: /user.slice/user-1001.slice/session-24.scope
           └─17309 sleep infinity

Subsequent calls to stop the scope unit do nothing, because systemd thinks the
scope is already dead.

https://bugzilla.redhat.com/show_bug.cgi?id=1486859

This is easily reproducible on both F26 and F27:

> ssh guest@localhost
$ pulseaudio & sleep infinity & disown; exit
$ systemctl status $$
> systemctl status session-NN.scope

Tested with unified, hybrid, and legacy layouts, seems to work.
2017-10-19 08:49:01 +02:00
Zbigniew Jędrzejewski-Szmek 7cd0f0f844 logind: allow two very close error messages to be distinguished
In https://bugzilla.redhat.com/show_bug.cgi?id=1486859 error messages appera:

Sep 06 19:09:07 ld92.e.math.uh.edu audit[21482]: AVC avc:  denied  { read } for  pid=21482 comm="systemd-logind" name="dbus-1" dev="tmpfs" ino=5548194 scontext=system_u:system_r:systemd_logind_t:s0 tcontext=unconfined_u:object_r:session_dbusd_tmp_t:s0 tclass=dir permissive=0
Sep 06 19:09:07 ld92.e.math.uh.edu systemd-logind[21482]: Failed to remove runtime directory /run/user/8664: Permission denied

But it's not clear which of the two rm_rf's is the source. Let's make
them different.
2017-10-19 08:49:01 +02:00
Zbigniew Jędrzejewski-Szmek dd202fa492 Merge pull request #7132 from splantefeve/fr-translation
Update French translation
2017-10-19 08:29:37 +02:00
Sylvain Plantefève 629be9c9d1 po: update french translation 2017-10-19 00:26:52 +02:00
Sylvain Plantefève b5ff403d14 catalog: update french translation 2017-10-19 00:26:27 +02:00
Zbigniew Jędrzejewski-Szmek 74a79c657e man: describe how machine-id should be initialized (#7051) 2017-10-19 00:47:34 +08:00
Zbigniew Jędrzejewski-Szmek 78344935fd rfkill: include the device name in error message 2017-10-18 17:39:54 +02:00
Zbigniew Jędrzejewski-Szmek 551072321e man: recommend using /var/lib/machines in systemd-nspawn(1)
Also update the instruction to latest Fedora version.
2017-10-18 17:14:05 +02:00
Zbigniew Jędrzejewski-Szmek c47f86e660 util-lib: simplify kexec_loaded() 2017-10-18 17:14:05 +02:00
Zbigniew Jędrzejewski-Szmek 545a30a9a9 logind: drop unnecessary braces 2017-10-18 17:14:05 +02:00
Zbigniew Jędrzejewski-Szmek 9476ddba60 meson: drop unneeded check for grep 2017-10-18 17:14:05 +02:00
Zbigniew Jędrzejewski-Szmek 14ce0c25c2 timedatectl: stop using xstrftime
When using strftime in arbitrary locales, we cannot really say how big the
buffer should be. Let's make the buffer "large", which will work fine pretty
much always, and just print n/a if the timestamp does not fit. strftime returns
0 if the buffer is too small and a NUL-terminated string otherwise, so we
can drop the size specifications in string formatting.

$ export LANG=fa_IR.UTF-8
$ date
چهارشنبه ۱۸ اكتبر ۱۷، ساعت ۱۰:۵۴:۲۴ (+0330)
$ timedatectl
Assertion 'xstrftime: a[] must be big enough' failed at ../src/timedate/timedatectl.c:105, function print_status_info(). Aborting.

now:

$ timedatectl
        Local time: چهارشنبه 2017-10-18 16:29:40 CEST
    Universal time: چهارشنبه 2017-10-18 14:29:40 UTC
          RTC time: چهارشنبه 2017-10-18 14:29:40
…

https://bugzilla.redhat.com/show_bug.cgi?id=1503452
2017-10-18 16:30:37 +02:00
Lennart Poettering b5487fa0b6 Merge pull request #7078 from keszybz/cryptsetup-netdev-fixes
Cryptsetup _netdev fixes
2017-10-18 21:15:29 +08:00
Zbigniew Jędrzejewski-Szmek a0e030f53b units: make remote-cryptsetup.target also after cryptsetup-pre.target
This way people can order units before cryptsetup-pre.target and
have them run before any cryptsetup-related stuff.
2017-10-18 15:14:46 +02:00
Susant Sahani 28464ae0e2 networkd: don't stop the dhcp server if it's not configured. (#7083)
we call sd_dhcp_server_stop even if it's not configured when link is
down resulting unwanted logs.
```
Oct 10 13:41:07 nena systemd-networkd[126]: eth0: Lost carrier
Oct 10 13:41:07 nena systemd-networkd[126]: DHCP CLIENT (0x560f2dc5): STOPPED
Oct 10 13:41:07 nena systemd-networkd[126]: eth0: DHCP lease lost
Oct 10 13:41:07 nena systemd-networkd[126]: NDISC: Stopping IPv6 Router Solicitation client
Oct 10 13:41:07 nena systemd-networkd[126]: Assertion 'server' failed at ../src/libsystemd-network/sd-dhcp-server.c:256, function sd_dhcp_server_stop(). Ignoring.
```

fixes #7047
2017-10-18 12:38:56 +02:00
Zbigniew Jędrzejewski-Szmek b996f7e41a tests: rename test-time to test-time-util
It's for testing time-util.c so rename it to make things more
obvious.
2017-10-18 11:27:23 +02:00
Susant Sahani 702c979fef networkd: Consider linkLocalAddressing state while configuring ndisc. (#7012)
If linkLocalAddressing is disabled in for the interface still then
we look for ndisc configured or not in link_check_ready.

Link local is used automatic address configuration and neighbor discovery protocol.
If link local is disabled we should not configure ndisc.

Fixes #2713, #6441, #5841.
2017-10-18 11:12:59 +02:00