Commit graph

43213 commits

Author SHA1 Message Date
Lennart Poettering 8ac7339648
Merge pull request #14525 from yuwata/mount-use-format-table
systemd-mount: use format-table.[ch]
2020-01-09 15:47:24 +01:00
Yu Watanabe 0ca1926ec3 bash-completion: networkctl: support --full and --lines 2020-01-09 15:43:18 +01:00
Lennart Poettering 404308486a core: be more restrictive on the dependency types we allow to be created transiently
We should allow the ones that the [Unit] section of regular unit files
may accet, but no other, in particular not the internal deps we
synthesize as reverse of explicitly configured ones, such was WantedBy=.

Fixes: #14251
2020-01-09 15:42:34 +01:00
Yu Watanabe cf57766d79 timedatectl: use format-table.[ch] 2020-01-09 15:40:50 +01:00
Lennart Poettering 7cce68e1e0 core: make sure we use the correct mount flag when re-mounting bind mounts
When in a userns environment we cannot take away per-mount point flags
set on a mount point that was passed to us. Hence we need to be careful
to always check the actual mount flags in place and manipulate only
those flags of them that we actually want to change and not reset more
as side-effect.

We mostly got this right already in
bind_remount_recursive_with_mountinfo(), but didn't in the simpler
bind_remount_one_with_mountinfo(). Catch up.

(The old code assumed that the MountEntry.flags field contained the
right flag settings, but it actually doesn't for new mounts we just
established as for those mount() establishes the initial flags for us,
and we have to read them back to figure out which ones the kernel
picked.)

Fixes: #13622
2020-01-09 15:18:08 +01:00
Lennart Poettering 8403219fc1 mount-util: line break overly long function prototypes 2020-01-09 15:05:55 +01:00
Lennart Poettering 08b1f5c7d1 mount-util: clean up get_mount_flags()
This cleans up the function in multiple ways:

- change order of parameters to follow our usualy system of putting
  return parameters last
- rename return parameter "ret" as we usually do
- don't initialize local variables we override immediately anyway
- downgrade log messages to LOG_DEBUG (since we don't log about any
  other errors here above LOG_DEBUG, as this is mostly an "API"-style
  function)
- handle that mnt_fs_get_vfs_options() may return NULL (according to
  docs)
- manually map the ST_xyz to MS_xyz flags on statvfs(), because while
  they are mostly the same, they aren't entirely the same, MS_RELATIME and
  ST_RELATIME are defined differently (sad!)
2020-01-09 15:05:21 +01:00
Lennart Poettering 4eaf0d9401 mount-util: don't mask away MS_RDONLY twice
We have the flags mask for that, and if callers really wanted us to mask
this away, then they should pass the correct mask.
2020-01-09 14:55:15 +01:00
Lennart Poettering f3dab34d22 mount-util: rename cleaned → simplified, because that's what we actually did here 2020-01-09 14:53:36 +01:00
Yu Watanabe a5279634c0 systemd-mount: add --no-legend command line option 2020-01-09 20:16:03 +09:00
Yu Watanabe 6ae6ea55d8 systemd-mount: use format-table.[ch] 2020-01-09 20:16:03 +09:00
Yu Watanabe f93d876c80 format-table: introduce TABLE_PATH 2020-01-09 20:16:03 +09:00
Lennart Poettering 4c2ef32767 core: propagate service state to socket in more load states
It makes sense to filter state changes for some load states that
shouldn't happen, but the common cases should be accepted, because they
might happen during runtime when "systemctl daemon-reload" is issued and
unit files changed state in between. Otherwise we lose events.

Fixes: #4708
2020-01-09 11:53:26 +01:00
Thomas Schmitt 19212f2781 udev: don't import parent ID_FS_ data on partitions
When probing partitions, we inherit important information from the parent
disk device such as ID_MODEL, and usage of such properties is seen to
be acceptable and well established.

However, we need to exclude filesystem information from the properties
that get inherited. Information about the device content should not be
passed on in this way.

For example, Linux distro install media commonly uses an ISO filesystem
plus a partition table. The ISO filesystem is detected on the main disk
device, but we should not pass down those details to the partitions,
some or all of which may be pointing at storage areas completely distinct
from the ISO filesystem.

This is particularly problematic when adding new partitions on media
set up in this way (since the new partitions are then reported to contain
the parent device's ISO filesystem), or when dealing with more unusual
hybrid ISO layouts. The inaccuracy of information here inversely affects
users of blkid and udev's persistent storage symlinks.

Exclude ID_FS_* properties from the inheritance chain to avoid these
problems.

Fixes: #14408
2020-01-09 11:20:55 +01:00
Lennart Poettering b0a94268f8 core: when we cannot open an image file for write, try read-only
Closes: #14442
2020-01-09 11:18:06 +01:00
Lennart Poettering c8c535d589 namespace: tweak checks whether we can mount image read-only
So far we set up a loopback file read-only iff ProtectSystem= and
ProtectHome= both where set to values that mark these dirs read-only.
Let's extend that and also be happy if /home and the root dir are marked
read-only by some other means.

Fixes: #14442
2020-01-09 11:18:02 +01:00
Lennart Poettering 9a2ec8f7a6 install: use path_strv_contains() where appropriate 2020-01-09 11:17:59 +01:00
Lennart Poettering 3593fa60f2 path-util: express PATH_IN_SET() through path_strv_contains() 2020-01-09 11:17:47 +01:00
Lennart Poettering 3841fee822 path-util: introduce path_strv_contains() helper
it's like strv_contains() but uses path_equal() rather than streq() to
compare strings.
2020-01-09 11:17:21 +01:00
Lennart Poettering ab015b13df man: small casing fix 2020-01-09 11:04:41 +01:00
Lennart Poettering f2e5e70410 man: document that scope units can fail, but not due to process exit statusses
Let's clarify that scope units can fail, but not due to process exit
statusses.

This hopefully clears up some confusion that manifested in #14142: scope
units can fail, but for other reasons than assumed there.

Fixes: #14142
2020-01-09 11:04:27 +01:00
Lennart Poettering c80a9a33d0 core: clearly refuse OnFailure= deps on units that can't fail
Similar, refuse triggering deps on units that cannot trigger.

And rework how we ignore After= dependencies on device units, to work
the same way.

See: #14142
2020-01-09 11:03:53 +01:00
Yu Watanabe 125c7814fa
Merge pull request #14523 from keszybz/refactorings
Refactorings inspired by recent pull requests
2020-01-09 12:50:11 +09:00
Zbigniew Jędrzejewski-Szmek b44d87e200 sd-event: use _cleanup_ in one more place 2020-01-08 17:15:54 +01:00
Zbigniew Jędrzejewski-Szmek 1eac79486e sd-event: use RAII for struct epoll_event
Inspired by #14353.
2020-01-08 17:15:46 +01:00
Zbigniew Jędrzejewski-Szmek 0475919b56 network: use automatic stack allocation and structured init 2020-01-08 17:15:19 +01:00
Zbigniew Jędrzejewski-Szmek 6666c4faee network: do not require ethtool_get_permanent_macaddr() to get an fd 2020-01-08 17:14:56 +01:00
Lennart Poettering 6a6078a585 test: minor typo fix
As pointed out on: https://github.com/systemd/systemd/pull/14465#discussion_r364152064
2020-01-08 14:50:30 +00:00
Lennart Poettering 0aa9bffe10
Merge pull request #14448 from yuwata/network-permanent-mac-address
network, udev: support permanent mac address
2020-01-08 15:36:27 +01:00
Lennart Poettering 3bfcfcf942
Merge pull request #14518 from keszybz/interface-text
doc: tweak grammar in CONTAINER_INTERFACE description
2020-01-08 14:26:33 +01:00
Lennart Poettering a1edbc5118
Merge pull request #14511 from keszybz/sleep-check-rework
Sleep check rework
2020-01-08 14:26:17 +01:00
Lennart Poettering 48dfa8b0e1
Merge pull request #14512 from poettering/root-image-devices
Make RootImage= work reliable with DeviceAllow= in the mix
2020-01-08 12:18:38 +01:00
Frantisek Sumsal 514793658c test: pin meson to 0.52.1 for fuzzit/fuzzbuzz
Latest meson doesn't work with older python 3.5, which is present on
Ubuntu 16.04. Let's pin in to the latest working version (0.52.1) until
we properly bump all necessary Ubuntu images to 18.04.

See: https://github.com/mesonbuild/meson/issues/6427
2020-01-08 13:56:30 +03:00
Zbigniew Jędrzejewski-Szmek 64be35ab02 network: rename *fd to *ethtool_fd 2020-01-08 11:55:07 +01:00
Zbigniew Jędrzejewski-Szmek d9b204544b man: use xi:include to avoid duplication
... and fix some unwarranted discrepancies between the two man pages.
2020-01-08 11:43:09 +01:00
Zbigniew Jędrzejewski-Szmek 06ae8800d0
Merge pull request #14465 from poettering/setprio-rework
When Nice= is used, clamp to RLIMIT_NICE
2020-01-08 11:06:46 +01:00
Zbigniew Jędrzejewski-Szmek 629548c405
Merge pull request #14488 from yuwata/networkctl-show-logs
networkctl: status command also shows logs of networkd
2020-01-08 10:49:39 +01:00
Zbigniew Jędrzejewski-Szmek 9552209292 man: fix option name 2020-01-08 10:39:44 +01:00
Zbigniew Jędrzejewski-Szmek d2e825b4ab doc: tweak grammar in CONTAINER_INTERFACE description
The only non-stylistic change is to replace descriptions of how we are
encouraging people to use PrivateTmp= and such, because now they are widely
used.
2020-01-08 10:29:10 +01:00
Zbigniew Jędrzejewski-Szmek af6a2a1e57
Merge pull request #14494 from poettering/container-interface
Let's import the container interface description text from the fdo wiki
2020-01-08 09:58:57 +01:00
Yu Watanabe caa8538a22 networkctl: show permanent mac address if it is not used now 2020-01-08 17:54:59 +09:00
Yu Watanabe 4bb7cc8287 network, udev: introduce PermanentMACAddress= setting in [Match] section
Closes #13983.
2020-01-08 17:54:54 +09:00
ezst036 95f2b4dd23 Support Plugable UD-PRO8 dock
Add support for Plugable Pro8 docking station for auto-configuring seat
2020-01-08 09:54:25 +01:00
Yu Watanabe 79b4428a7d ethtool: introduce ethtool_get_permanent_macaddr()
Will be used in later commits.
2020-01-08 17:51:56 +09:00
Lennart Poettering 4f0840669e gpt-auto: don't assume XBOOTLDR is vfat
Let's not assume "umask=" is a valid mount option for XBOOTLDR
partitions unconditionally.

Fixes: #14165
2020-01-08 09:51:42 +01:00
Robert Scheck 5ac8b50d58 network, meson: allow statically linked build
Build option "link-networkd-shared" to build a statically linked
systemd-networkd by using

  -Dlink-udev-shared=false -Dlink-networkd-shared=false

on systems with full systemd stack except systemd-networkd, such
as RHEL/CentOS 8.
2020-01-08 09:50:32 +01:00
Zbigniew Jędrzejewski-Szmek 31ffbfd101
Merge pull request #14510 from poettering/net-naming-scheme-fixlets
some net naming scheme documentation fixes
2020-01-08 09:46:49 +01:00
Daniel Shahaf 356873ddec zsh: Complete systemctl subcommands in separate tags
Fixes #14422
2020-01-08 09:43:01 +01:00
Zbigniew Jędrzejewski-Szmek 8f817cb888 shared/sleep-config: do not ignore resume_offset when resume not set
This is most likely a user error, let's make it easier to diagnose.
2020-01-08 08:07:14 +01:00
Zbigniew Jędrzejewski-Szmek 8efc2c1608 shared/sleep-config: make swap detection stricter again
To make this easier to understand, let's always log (at debug level)
when we accept or reject each device:
/swapfile: detection of swap file offset on Btrfs is not supported
/swapfile: is a candidate device.
/dev/zram0: ignoring zram swap
/dev/vdb: ignoring device with lower priority
/dev/vdc: ignoring device with lower usable space
...

If we know that hibernation will fail, refuse. This includes cases where
/sys/power/resume is set and doesn't match any device, or
/sys/power/resume_offset is set and we're not on btrfs and it doesn't match.
If /sys/power/resume is not set at all, we still accept the device with the
highest priority (see 6d176522f5 and
88bc86fcf8)

Tested cases:
1. no swap active → refuse
2. just zram swap active → refuse
3. swapfile on btrfs with /sys/power/resume{,_offset} set → OK
4. swapfile on btrfs with /sys/power/resume set, offset not set → refuse
5. swapfile on btrfs with /sys/power/resume set to nonexistent device, offset set → refuse
6. /sys/power/resume not set, offset set, candidate exists → OK (*)
7. /sys/power/resume not set, offset not set, candidate exists → OK

(*) I think this should fail, but I'm leaving that for the next commit.
2020-01-08 08:07:14 +01:00