Commit Graph

5770 Commits

Author SHA1 Message Date
Zach Smith ae463e4ef2 systemd-sleep: Set SYSTEMD_SLEEP_ACTION for systemd-sleep hooks.
When suspend-then-hibernate is called, hooks have no ability to determine which
stage of the request is being handled; they only see 'pre' and 'post' with the
verb 'suspend-then-hibernate'. This change introduces an environment variable
called SYSTEMD_SLEEP_ACTION that contains the name of the action that is
processing: 'suspend', 'hibernate', 'hybrid-sleep', or
'suspend-after-failed-hibernate'.
2021-01-09 18:11:01 +09:00
Yu Watanabe 83f0ff1eda
Merge pull request #18137 from keszybz/deprecate-blanket-import-environment
Deprecate blanket import-environment
2021-01-09 09:24:16 +09:00
Yu Watanabe 66bf4617b1
Merge pull request #18169 from OnkelUlla/can_bus_error_reporting
network: can: add support for bus error reporting
2021-01-09 09:21:54 +09:00
Ulrich Ölmann 77b674049b network: can: add support for bus error reporting
Enhance systemd-networkd to be able to control a CAN device's berr-reporting
flag via the new boolean directive BusErrorReporting= to be used in network
files.
2021-01-08 20:23:12 +01:00
Zbigniew Jędrzejewski-Szmek 32854f7044 systemctl: deprecate blanket import-environment
Importing the full environment is convenient, but it doesn't work too well in
practice, because we get a metric ton of shell-specific crap that should never
end up in the global environment block:

$ systemctl --user show-environment
...
SHELL=/bin/zsh
AUTOJUMP_ERROR_PATH=/home/zbyszek/.local/share/autojump/errors.log
AUTOJUMP_SOURCED=1
CONDA_SHLVL=0
CVS_RSH=ssh
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
DESKTOP_SESSION=gnome
DISPLAY=:0
FPATH=/usr/share/Modules/init/zsh-functions:/usr/local/share/zsh/site-functions:/usr/share/zsh/site-functions:/usr/share/zsh/5.8/functions
GDMSESSION=gnome
GDM_LANG=en_US.UTF-8
GNOME_SETUP_DISPLAY=:1
GUESTFISH_INIT=$'\\e[1;34m'
GUESTFISH_OUTPUT=$'\\e[0m'
GUESTFISH_PS1=$'\\[\\e[1;32m\\]><fs>\\[\\e[0;31m\\] '
GUESTFISH_RESTORE=$'\\e[0m'
HISTCONTROL=ignoredups
HISTSIZE=1000
LOADEDMODULES=
OLDPWD=/home/zbyszek
PWD=/home/zbyszek
QTDIR=/usr/lib64/qt-3.3
QTINC=/usr/lib64/qt-3.3/include
QTLIB=/usr/lib64/qt-3.3/lib
QT_IM_MODULE=ibus
SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS=0
SESSION_MANAGER=local/unix:@/tmp/.ICE-unix/2612,unix/unix:/tmp/.ICE-unix/2612
SHLVL=0
STEAM_FRAME_FORCE_CLOSE=1
TERM=xterm-256color
USERNAME=zbyszek
WISECONFIGDIR=/usr/share/wise2/
...

Plenty of shell-specific and terminal-specific stuff that have no global
significance.

Let's start warning when this is used to push people towards importing only
specific variables.

Putative NEWS entry:
  * systemctl import-environment will now emit a warning when called without
    any arguments (i.e. to import the full environment block of the called
    program). This command will usually be invoked from a shell, which means
    that it'll inherit a bunch of variables which are specific to that shell,
    and usually to the tty the shell is connected to, and don't have any
    meaning in the global context of the system or user service manager.
    Instead, only specific variables should be imported into the manager
    environment block.

    Similarly, programs which update the manager environment block by directly
    calling the D-Bus API of the manager, should also push specific variables,
    and not the full inherited environment.
2021-01-08 20:01:40 +01:00
Zbigniew Jędrzejewski-Szmek 82651d5b6b man: improve description of environment block creation
This adds a general description of "philosphy" of keeping the environemnt
block small and hints about systemd-run -P env.

The list of generated variables is split out to a subsection. Viewing
the patch with ignoring whitespace changes is recommended.

We don't ignore invalid assignments (except in import-environment to some
extent), previous description was wrong.

For https://bugzilla.redhat.com/show_bug.cgi?id=1912046#c17.
2021-01-08 20:01:40 +01:00
Susant Sahani 007cac09a2 network: route - add support to configure tcp advmss 2021-01-08 14:06:13 +00:00
AJ Jordan c6ef002b80 man: clarify that coredumps are gc'd after 3 days 2021-01-07 16:18:29 +01:00
Susant Sahani 0a9fb9bad8 network: Allow to set device's receive queues and transmit queues 2021-01-05 12:46:28 +09:00
Lennart Poettering c024f320ff man: use 'weak' and 'strong' for explaining difference between Wants= + Requires=
A minor tweak, that hopefully makes things a bit clearer, given that we
previously used "requirement dependency" when referring to Wants=, which
might be confusing given that we have Requires=
2021-01-04 16:48:51 +01:00
Darren Ng 63d9fe0f6d fix typo 2021-01-04 11:01:17 +00:00
Lucas Werkmeister a1de7d01ff man: systemd-sysusers does not create home dir
Document that systemd-sysusers doesn’t create the specified home
directory, and point to systemd-tmpfiles as the service that can create
the home directory instead. (systemd-tmpfiles-setup.service is ordered
After=systemd-sysusers.service, so by the time systemd-tmpfiles would
create the home directory, sysusers would have created the owning user
already, and it should all work out.)
2021-01-03 22:51:07 +01:00
Gaël PORTAY 0215f04a7e man: fix path reference to unit file
The unit files are located at path /usr/lib/systemd/system.

This fixes the path reference to the unit file by adding the missing
path component system.
2020-12-31 11:43:44 +00:00
Lennart Poettering 57b3b8f48c man: apply @Minoru's suggestions from code review
Co-authored-by: Alexander Batischev <eual.jp@gmail.com>
2020-12-28 10:53:20 +01:00
Lennart Poettering b149d230ea man: extend time-{set,sync}.target + systemd-timesyncd/wait-sync docs
Let's link the three man pages together more tightly and explain what
the two targets are about, emphasizing local/quick/reliable/approximate
vs remote/slow/unreliable/accurate synchronization.

Follow-up for: 1431b2f701 fe934b42e4
2020-12-28 10:52:33 +01:00
Yu Watanabe 75d2641190 network: introduce RouterAllowList= and RouterDenyList= in [IPv6AcceptRA] 2020-12-24 17:16:15 +09:00
Susant Sahani de6b6ff84c networkd: add support for prefix allow-list and route allow-list 2020-12-24 17:16:13 +09:00
Yu Watanabe 3f0af4a5f9 network: rename DenyList= -> PrefixDenyList= 2020-12-24 17:15:44 +09:00
Jonathan G. Underwood 227acf0009 cryptsetup: add support for workqueue options
This commit adds support for disabling the read and write
workqueues with the new crypttab options no-read-workqueue
and no-write-workqueue. These correspond to the cryptsetup
options --perf-no_read_workqueue and --perf-no_write_workqueue
respectively.
2020-12-23 11:07:48 +00:00
Dmitry Borodaenko 68709a636c man/systemd-nspawn: document hashing machine name for uid base
Explicitly document the behavior introduced in #7437: when picking a new
UID shift base with "-U", a hash of the machine name will be tried
before falling back to fully random UID base candidates.
2020-12-23 10:18:03 +00:00
Luca BRUNO 3d909037e3 man/localtime: document default timezone
This explicitly documents the default `UTC` timezone which is used
by systemd and (other softwares) when `/etc/localtime` is not present.

Ref: https://github.com/systemd/systemd/blob/v247/src/basic/time-util.c#L1460-L1469
2020-12-21 12:39:18 +00:00
Florian Klink c6b90e5c5e man/systemd.netdev: clarify the wireguard AllowedIPs= setting
`AllowedIPs=` only affects "routing inside the network interface
itself", as in, which wireguard peer packets with a specific destination
address are sent to, and what source addresses are accepted from which
peer.

To cause packets to be sent via wireguard in first place, a route via
that interface needs to be added - either in the `[Routes]` section on
the `.network` matching the wireguard interface, or outside of networkd.

This is a common cause of misunderstanding, because tools like wg-quick
also add routes to the interface. However, those tools are meant as a
"extremely simple script for easily bringing up a WireGuard interface,
suitable for a few common use cases (from their manpage).

Networkd also should support other usecases - like setting AllowedIPs to
0.0.0.0/0 and ::/0 and having a dynamic routing protocol setting more
specific routes (or the user manually setting them).

Reported-In: https://github.com/systemd/systemd/issues/14176
2020-12-21 15:47:00 +09:00
Alexander Batischev 1431b2f701
man: Advertise systemd-time-wait-sync.service more (#17729)
* man: Advertise systemd-time-wait-sync.service more

The description of time-sync.target says that NTP services *should* pull
that target, but doesn't mention that e.g. systemd-timesyncd.service
doesn't actually do that. As a result, time-sync.target is reached way
earlier than people expect; see #5097, #8861, #11008.

systemd provides systemd-time-wait-sync.service to ameliorate this
problem, but doesn't feature it prominently in relevant manpages. In
fact, it's only mentioned in passing in systemd-timesyncd.service(8). As
a result, I ended up re-implementing that service, and I'm not the first
one: https://github.com/NixOS/nixpkgs/pull/51338

This patch adds a mention right in the description of time-sync.target,
which will hopefully raise awareness of this helper service.
2020-12-19 11:17:49 +00:00
Yu Watanabe a4c3c5b751 man: update org.freedesktop.hostname1.xml 2020-12-18 23:25:43 +09:00
Devon Pringle 16c89e649d networkd: add RouteDenyList
Allow configuration for IPv6 discovered routes to be ignored instead of
adding them as a route. This can be used to block unwanted routes, for
example, you may wish to not receive some set of routes on an interface
if they are causing issues.
2020-12-18 21:44:32 +09:00
Yu Watanabe 9f62de5762
Merge pull request #18011 from yuwata/trivial-fixes
Trivial fixes for recently merged PRs
2020-12-18 20:12:02 +09:00
Yu Watanabe ee672fd30b
Merge pull request #18009 from poettering/time-set-sync-target
tweaks for time-sync.target and time-set.target
2020-12-18 16:02:56 +09:00
Yu Watanabe 458610429f tree-wide: fix typo 2020-12-18 12:59:29 +09:00
Susant Sahani d7d1d18fd2
network: Allow to configure unreachable/blackhole RoutingPolicyRule (#17984) 2020-12-18 12:21:15 +09:00
Lennart Poettering 08e77eb88d man: document that .timer units now have After= on both time-set.target + time-sync.target 2020-12-17 20:26:24 +01:00
Lennart Poettering cf1e172d58 man: document new features 2020-12-17 20:02:32 +01:00
Lennart Poettering e4dde4e87d
Merge pull request #17702 from rnhmjoj/master
Extend $SYSTEMD_COLORS to switch colors mode
2020-12-16 19:26:40 +01:00
Yu Watanabe 84a1ff9457 tree-wide: fix typo 2020-12-16 18:30:15 +01:00
Yu Watanabe 24ee0f9d16 tree-wide: fix typo 2020-12-16 17:21:48 +01:00
Zbigniew Jędrzejewski-Szmek 60e4fb4240 hostnamed,shared/hostname-setup: expose the origin of the current hostname
In hostnamed this is exposed as a dbus property, and in the logs in both
places.

This is of interest to network management software and such: if the fallback
hostname is used, it's not as useful as the real configured thing. Right now
various programs try to guess the source of hostname by looking at the string.
E.g. "localhost" is assumed to be not the real hostname, but "fedora" is. Any
such attempts are bound to fail, because we cannot distinguish "fedora" (a
fallback value set by a distro), from "fedora" (received from reverse dns),
from "fedora" read from /etc/hostname.

/run/systemd/fallback-hostname is written with the fallback hostname when
either pid1 or hostnamed sets the kernel hostname to the fallback value. Why
remember the fallback value and not the transient hostname in /run/hostname
instead?
We have three hostname types: "static", "transient", fallback".
– Distinguishing "static" is easy: the hostname that is set matches what
  is in /etc/hostname.
– Distingiushing "transient" and "fallback" is not easy. And the
  "transient" hostname may be set outside of pid1+hostnamed. In particular,
  it may be set by container manager, some non-systemd tool in the initramfs,
  or even by a direct call. All those mechanisms count as "transient". Trying
  to get those cases to write /run/hostname is futile. It is much easier to
  isolate the "fallback" case which is mostly under our control.
And since the file is only used as a flag to mark the hostname as fallback,
it can be hidden inside of our /run/systemd directory.

For https://bugzilla.redhat.com/show_bug.cgi?id=1892235.
2020-12-16 11:03:36 +01:00
Zbigniew Jędrzejewski-Szmek d39079fcaa hostnamed: stop discriminating against "localhost" in /etc/hostname
We would sometimes ignore localhost-style names in /etc/hostname. That is
brittle. If the user configured some hostname, it's most likely because they
want to use that as the hostname. If they don't want to use such a hostname,
they should just not create the config. Everything becomes simples if we just
use the configured hostname as-is.

This behaviour seems to have been a workaround for Anaconda installer and other
tools writing out /etc/hostname with the default of "localhost.localdomain".
Anaconda PR to stop doing that: https://github.com/rhinstaller/anaconda/pull/3040.
That might have been useful as a work-around for other programs misbehaving if
/etc/hostname was not present, but nowadays it's not useful because systemd
mostly controls the hostname and it is perfectly happy without that file.

Apart from making things simpler, this allows users to set a hostname like
"localhost" and have it honoured, if such a whim strikes them.
2020-12-16 11:02:18 +01:00
Zbigniew Jędrzejewski-Szmek ce6b138c75 hostnamed: expose the fallback-hostname setting as a const dbus property
Various users want to know what the fallback hostname is. Since it was made
configurable in 8146c32b92, we didn't expose this
nicely.
2020-12-16 10:54:57 +01:00
Zbigniew Jędrzejewski-Szmek de31bbc6b1 man/hostnamectl,hostaned,hostname1: adjust the docs to match reality
The semantics were significantly changed in c779a44222
("hostnamed: Fix the way that static and transient host names interact", Feb. 2014),
but when the dbus api documentation was imported much later, it wasn't properly
adjusted to describe those new semantics.

34293dfafd which added systemd.hostname= also
added new behaviour.

Let's ove various bits and pieces around so that they are in more appropriate
places. Drop recommendations to set the hostname for DHCP or mDNS purposes.
Nowadays we expect tools that want to expose some different hostname to the
outside to manage that internally without affecting visible state. Also drop
mentions of DHCP or mDNS directly setting the hostname, since nowadays network
management software is expected to (and does) go through hostnamed.

Also, add a high-level description of semantics. It glosses over the details of
handling of localhost-style names. Later commits will remove this special handling
anyway.
2020-12-16 10:54:57 +01:00
Michal Fabik a2be8be2cf coredumpctl: Add --debugger-args= option
This commit adds the possibility to pass command line options to the
debugger invoked with coredumpctl debug.

Resolves: #9905
2020-12-16 12:42:53 +09:00
Susant Sahani 937e305e93 network: Allow to configure interface promiscuous mode 2020-12-15 20:25:08 +00:00
rnhmjoj c4fea19abb
basic/term-util: extend $SYSTEMD_COLORS
This commit extends $SYSTEMD_COLORS to an enum variable (compared to
a simple boolean) which specifies the "colors mode". This means that, in
addition to disabling colors altogether, it's now possible to restrict
the console output to 16 or 256 colors only.
2020-12-15 19:29:42 +01:00
Lennart Poettering ba4a31b7a6 man: document new ability to connect to user of container 2020-12-15 18:01:01 +01:00
Susant Sahani e81a44bf5f timesync: Make delaying attempts to contact servers configurable
```
❯ ssh sus@xx.xx.xx.xx
Last login: Sat Nov 14 17:32:08 2020 from 10.104.45.138
 17:36:19 up 0 min,  0 users,  load average: 0.00, 0.00, 0.00
> systemd-analyze blame
Bootup is not yet finished (org.freedesktop.systemd1.Manager.FinishTimestampMonotonic=0).
Please try again later.
Hint: Use 'systemctl list-jobs' to see active jobs
> systemd-analyze blame
43.954s systemd-time-wait-sync.service
 1.969s systemd-networkd-wait-online.service
 1.559s cloud-init-local.service
 1.039s cloud-init.service
  414ms cloud-final.service
  387ms dracut-initqueue.service
  382ms initrd-switch-root.service
  380ms cloud-config.service
  198ms systemd-journal-flush.service
  136ms systemd-udev-trigger.service
  115ms initrd-parse-etc.service
   97ms systemd-timesyncd.service
   84ms systemd-journald.service

```

After made it configurable and set to 5s

```
❯ ssh sus@xx.xx.xx.xx
Last login: Sat Nov 14 18:41:42 2020 from 10.104.45.138
 18:42:36 up 0 min,  0 users,  load average: 0.16, 0.03, 0.01
> systemd-analyze blame
10.450s systemd-time-wait-sync.service
 8.303s systemd-networkd-wait-online.service
 1.621s cloud-init-local.service
 1.068s cloud-init.service
```
2020-12-15 08:52:51 +09:00
Yu Watanabe 28423d9a75 tree-wide: fix typo 2020-12-14 12:05:55 +00:00
Yu Watanabe 563a94d080 man: mention new OPTIONS=log_level= udev rule 2020-12-10 12:33:34 +09:00
Lennart Poettering eef34a1d8f man: document that automount units are privileged
Fixes: #17886
2020-12-09 18:25:32 +01:00
Yu Watanabe 78bc702503 man: synthetize(d) -> synthesize(d) 2020-12-08 09:24:11 +01:00
Torsten Hilbrich 88fc9c9bad systemd-nspawn: Allow setting ambient capability set
The old code was only able to pass the value 0 for the inheritable
and ambient capability set when a non-root user was specified.

However, sometimes it is useful to run a program in its own container
with a user specification and some capabilities set. This is needed
when the capabilities cannot be provided by file capabilities (because
the file system is mounted with MS_NOSUID for additional security).

This commit introduces the option --ambient-capability and the config
file option AmbientCapability=. Both are used in a similar way to the
existing Capability= setting. It changes the inheritable and ambient
set (which is 0 by default). The code also checks that the settings
for the bounding set (as defined by Capability= and DropCapability=)
and the setting for the ambient set (as defined by AmbientCapability=)
are compatible. Otherwise, the operation would fail in any way.

Due to the current use of -1 to indicate no support for ambient
capability set the special value "all" cannot be supported.

Also, the setting of ambient capability is restricted to running a
single program in the container payload.
2020-12-07 19:56:59 +01:00
Lennart Poettering bce334a31c core: add ConditionSecurity=tpm2 support 2020-12-03 12:03:58 +01:00
Steve Ramage 7d27d39aa7
Adds missing documentation for Assertions (#17825) 2020-12-03 08:47:24 +09:00