]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
3 years agocore: reorder where we add units to queues in unit_notify()
Lennart Poettering [Mon, 26 Apr 2021 20:07:24 +0000 (22:07 +0200)] 
core: reorder where we add units to queues in unit_notify()

This moves all calls that shall do deferred work on detecting whether to
start/stop the unit or dependent units after a unit state change to the
end of the function, to make things easier to read.

So far, these calls were spread all over the function, and
conditionalized needlessly on MANAGER_RELOADING(). This is unnecessary,
since the queues are not dispatched while reloading anyway, and
immediately before acting on a queued unit we'll check if the suggested
operation really makes sense.

The only conditionalizaiton we leave in is on checking the new unit
state itself, since we have that in a local variable anyway.

3 years agocore: change BoundBy= dependency handling to be processed by a deferred work queue
Lennart Poettering [Thu, 8 Apr 2021 20:05:15 +0000 (22:05 +0200)] 
core: change BoundBy= dependency handling to be processed by a deferred work queue

So far StopWhenUnneeded= handling and UpheldBy= handling was already
processed by a queue that is dispatched in a deferred mode of operation
instead of instantly. This changes BoundBy= handling to be processed the
same way.

This should ensure that all *event*-to-job propagation is done directly
from unit_notify(), while all *state*-to-job propagation is done from a
deferred work queue, quite systematically. The work queue is submitted
to by unit_notify() too.

Key really is the difference between event and state: some jobs shall be
queued one-time on events (think: OnFailure= + OnSuccess= and similar),
others shall be queued continuously when a specific state is in effect
(think: UpheldBy=).  The latter cases are usually effect of the
combination of states of a few units (e.g. StopWhenUnneeded= checks
wether any of the Wants=/Requires=/… deps are still up before acting),
and hence it makes sense to trigger them to be run after an individual
unit's state changed, but process them on a queue that runs whenever
there's nothing else to do that ensures the decision on them is only
taken after all jobs/queued IO events are dispatched, and things
settled, so that it makes sense to come to a combined conclusion. If
we'd dispatch this work immediately inside of unit_notify() we'd always
act instantly, even though another event from another unit that is
already queued might make the work unnecessary or invalid.

This is mostly a commit to make things philosophically clean. It does
not add features, but it should make corner cases more robust.

3 years agocore: make unneeded check a bit tighter
Lennart Poettering [Mon, 26 Apr 2021 19:02:31 +0000 (21:02 +0200)] 
core: make unneeded check a bit tighter

Let's not consider a unit unneeded while it is reloading.

Uneeded should be a pretty weak concept: if there's any doubt that
something bit be needed, then assume it is.

3 years agocore: order reverse dep table in same way as enum
Lennart Poettering [Wed, 14 Apr 2021 16:38:42 +0000 (18:38 +0200)] 
core: order reverse dep table in same way as enum

3 years agocore: implement Uphold= dependency type
Lennart Poettering [Wed, 14 Apr 2021 13:24:08 +0000 (15:24 +0200)] 
core: implement Uphold= dependency type

This is like a really strong version of Wants=, that keeps starting the
specified unit if it is ever found inactive.

This is an alternative to Restart= inside a unit, acknowledging the fact
that whether to keep restarting the unit is sometimes not a property of
the unit itself but the state of the system.

This implements a part of what #4263 requests. i.e. there's no
distinction between "always" and "opportunistic". We just dumbly
implement "always" and become active whenever we see no job queued for
an inactive unit that is supposed to be upheld.

3 years agocore: add new OnSuccess= dependency type
Lennart Poettering [Wed, 14 Apr 2021 12:36:15 +0000 (14:36 +0200)] 
core: add new OnSuccess= dependency type

This is similar to OnFailure= but is activated whenever a unit returns
into inactive state successfully.

I was always afraid of adding this, since it effectively allows building
loops and makes our engine Turing complete, but it pretty much already
was it was just hidden.

Given that we have per-unit ratelimits as well as an event loop global
ratelimit I feel safe to add this finally, given it actually is useful.

Fixes: #13386
3 years agocore: use StopPropagatedFrom= as default for .mount → .device unit dependencies
Lennart Poettering [Wed, 14 Apr 2021 09:22:44 +0000 (11:22 +0200)] 
core: use StopPropagatedFrom= as default for .mount → .device unit dependencies

Let's make use of the new dependency type for .mount/.device units,
after all we added it for this purpose.

Fixes: #9869
3 years agocore: add new PropagateStopTo= dependency (and inverse)
Lennart Poettering [Tue, 13 Apr 2021 20:30:31 +0000 (22:30 +0200)] 
core: add new PropagateStopTo= dependency (and inverse)

This takes inspiration from PropagatesReloadTo=, but propagates
stop jobs instead of restart jobs.

This is defined based on exactly two atoms: UNIT_ATOM_PROPAGATE_STOP +
UNIT_ATOM_RETROACTIVE_STOP_ON_STOP. The former ensures that when the
unit the dependency is originating from is stopped based on user
request, we'll propagate the stop job to the target unit, too. In
addition, when the originating unit suddenly stops from external causes
the stopping is propagated too. Note that this does *not* include the
UNIT_ATOM_CANNOT_BE_ACTIVE_WITHOUT atom (which is used by BoundBy=),
i.e. this dependency is purely about propagating "edges" and not
"levels", i.e. it's about propagating specific events, instead of
continious states.

This is supposed to be useful for dependencies between .mount units and
their backing .device units. So far we either placed a BindsTo= or
Requires= dependency between them. The former gave a very clear binding
of the to units together, however was problematic if users establish
mounnts manually with different block device sources than our
configuration defines, as we there might come to the conclusion that the
backing device was absent and thus we need to umount again what the user
mounted. By combining Requires= with the new StopPropagatedFrom= (i.e.
the inverse PropagateStopTo=) we can get behaviour that matches BindsTo=
in every single atom but one: UNIT_ATOM_CANNOT_BE_ACTIVE_WITHOUT is
absent, and hence the level-triggered logic doesn't apply.

Replaces: #11340

3 years agocore: add a reverse dep for OnFailure=
Lennart Poettering [Tue, 13 Apr 2021 18:50:21 +0000 (20:50 +0200)] 
core: add a reverse dep for OnFailure=

Let's add an implicit reverse dep OnFailureOf=. This is exposed via the
bus to make things more debuggable: you can now ask systemd for which
units a specific unit is the failure handler.

OnFailure= was the only dependency type that had no inverse, this fixes
that.

Now that deps are a bit cheaper, it should be OK to add deps that only
serve debug purposes.

3 years agocore: hide cgroup fields in unit_dump() for non-cgroup unit types
Lennart Poettering [Tue, 13 Apr 2021 18:24:15 +0000 (20:24 +0200)] 
core: hide cgroup fields in unit_dump() for non-cgroup unit types

A bunch of properties in the main Unit strcture only make sense for
cgroup units. Let's hide them from unit types that have no relation to
cgroups.

3 years agocore: convert Slice= into a proper dependency (and add a back dependency)
Lennart Poettering [Tue, 13 Apr 2021 16:37:25 +0000 (18:37 +0200)] 
core: convert Slice= into a proper dependency (and add a back dependency)

The slice a unit is assigned to is currently a UnitRef reference. Let's
turn it into a proper dependency, to simplify and clean up code a bit.
Now that new dep types are cheaper, deps should generally be preferable
over everything else, if the concept applies.

This brings one major benefit: we often have to iterate through all unit
a slice contains. So far we iterated through all Before= dependencies of
the slice unit to achieve that, filtering out unrelated units, and
taking benefit of the fact that slice units are implicitly ordered
Before= the units they contain. By making Slice= a proper dependency,
and having an accompanying SliceOf= dependency type, this is much
simpler and nicer as we can directly enumerate the units a slice
contains.

The forward dependency is actually called InSlice internally, since we
already used the UNIT_SLICE name as UnitType field. However, since we
don't intend to expose the dependency to users as dep anyway (we already
have the regular Slice D-Bus property for this) this shouldn't matter.
The SliceOf= implicit dependency type (the erverse of Slice=/InSlice=)
is exported over the bus, to make things a bit nicer to debug and
discoverable.

3 years agocore: add UNIT_GET_SLICE() helper
Lennart Poettering [Mon, 26 Apr 2021 16:14:07 +0000 (18:14 +0200)] 
core: add UNIT_GET_SLICE() helper

In a later commit we intend to move the slice logic to use proper
dependencies instead of a "UnitRef" object. This preparatory commit
drops direct use of the slice UnitRef object for a static inline
function UNIT_GET_SLICE() that is both easier to grok, and allows us to
easily replace its internal implementation later on.

3 years agotest-engine: extend engine test
Lennart Poettering [Tue, 13 Apr 2021 14:50:45 +0000 (16:50 +0200)] 
test-engine: extend engine test

Let's verify that the dependency type to atom mapping is consistent.

Let's also verify that dependency merging works correctly.

3 years agocore: rebreak a few comments
Lennart Poettering [Tue, 13 Apr 2021 15:26:16 +0000 (17:26 +0200)] 
core: rebreak a few comments

3 years agocore: split dependency types into atoms
Lennart Poettering [Tue, 13 Apr 2021 15:25:42 +0000 (17:25 +0200)] 
core: split dependency types into atoms

3 years agohashmap: add helper to test if iterator is still at beginning
Lennart Poettering [Tue, 13 Apr 2021 15:20:58 +0000 (17:20 +0200)] 
hashmap: add helper to test if iterator is still at beginning

3 years agoMerge pull request #19716 from yuwata/sd-netlink-NETLINK_GET_STRICT_CHK
Yu Watanabe [Tue, 25 May 2021 13:38:59 +0000 (22:38 +0900)] 
Merge pull request #19716 from yuwata/sd-netlink-NETLINK_GET_STRICT_CHK

sd-netlink: enable NETLINK_GET_STRICT_CHK socket option to filter out message on kernel

3 years agocore: make libbpf a dlopen() dependency 19705/head
Luca Boccassi [Sun, 23 May 2021 12:04:53 +0000 (13:04 +0100)] 
core: make libbpf a dlopen() dependency

3 years agomeson: look for bpftool in /usr/sbin too
Luca Boccassi [Sun, 23 May 2021 12:43:38 +0000 (13:43 +0100)] 
meson: look for bpftool in /usr/sbin too

On Debian, bpftool is installed in /usr/sbin, which is not in $PATH for
non-root users by default, so finding it fails.
Add a secondary, hard-coded '/usr/sbin/bpftool' after 'bpftool' so that
meson can find it.

https://packages.debian.org/sid/amd64/bpftool/filelist

3 years agotest-parse-argument: Include signal.h
Khem Raj [Tue, 25 May 2021 01:26:27 +0000 (18:26 -0700)] 
test-parse-argument: Include signal.h

Fixes
src/test/test-parse-argument.c:49:29: error: use of undeclared identifier 'SIGABRT'

Signed-off-by: Khem Raj <raj.khem@gmail.com>
3 years agoREADME: point at IRC channel on the new network
Mantas Mikulėnas [Tue, 25 May 2021 10:09:05 +0000 (13:09 +0300)] 
README: point at IRC channel on the new network

3 years agoMerge pull request #19709 from keszybz/sysusers-no-proc
Zbigniew Jędrzejewski-Szmek [Tue, 25 May 2021 06:20:56 +0000 (08:20 +0200)] 
Merge pull request #19709 from keszybz/sysusers-no-proc

Add more logs and make sysusers works in dnf --installroot

3 years agoMerge pull request #19715 from yuwata/network-link-group
Yu Watanabe [Tue, 25 May 2021 04:29:50 +0000 (13:29 +0900)] 
Merge pull request #19715 from yuwata/network-link-group

network: allow to set Group=0 in [Link] section

3 years agosystemctl: avoid crash when pattern expands to empty unit list
Zbigniew Jędrzejewski-Szmek [Mon, 24 May 2021 20:49:56 +0000 (22:49 +0200)] 
systemctl: avoid crash when pattern expands to empty unit list

Fixes #19652.

3 years agoMerge pull request #19713 from nabijaczleweli/bootctlpsko-liter
Yu Watanabe [Mon, 24 May 2021 23:31:38 +0000 (08:31 +0900)] 
Merge pull request #19713 from nabijaczleweli/bootctlpsko-liter

The "obviously good stuff" from #19006 again

3 years agotest: add testcases of filtering on dumping addresses 19716/head
Yu Watanabe [Mon, 24 May 2021 23:15:36 +0000 (08:15 +0900)] 
test: add testcases of filtering on dumping addresses

3 years agolocal-addresses: set ifindex when dump addresses on an interface
Yu Watanabe [Mon, 24 May 2021 21:54:15 +0000 (06:54 +0900)] 
local-addresses: set ifindex when dump addresses on an interface

3 years agonetwork: set ifindex when dump addresses on an interface
Yu Watanabe [Sun, 23 May 2021 14:21:30 +0000 (23:21 +0900)] 
network: set ifindex when dump addresses on an interface

3 years agosd-netlink: set NETLINK_GET_STRICT_CHK socket option
Yu Watanabe [Fri, 21 May 2021 21:03:40 +0000 (06:03 +0900)] 
sd-netlink: set NETLINK_GET_STRICT_CHK socket option

Then kernel filters out unnecessary info on dumping, e.g. RTM_GETADDR.

3 years agosd-netlink: do not set route type and table by default for RTM_GETROUTE or friends
Yu Watanabe [Mon, 24 May 2021 21:49:51 +0000 (06:49 +0900)] 
sd-netlink: do not set route type and table by default for RTM_GETROUTE or friends

3 years agosd-netlink: do not set action for RTM_GETRULE message
Yu Watanabe [Mon, 24 May 2021 13:32:00 +0000 (22:32 +0900)] 
sd-netlink: do not set action for RTM_GETRULE message

Otherwise, when NETLINK_GET_STRICT_CHK socket option is enabled, no rule
will be dumped.

3 years agosd-netlink: do not enable dump flag by default for RTM_GETADDR message
Yu Watanabe [Mon, 24 May 2021 13:47:01 +0000 (22:47 +0900)] 
sd-netlink: do not enable dump flag by default for RTM_GETADDR message

3 years agosd-netlink: do not append prefixlen by default
Yu Watanabe [Mon, 24 May 2021 13:30:44 +0000 (22:30 +0900)] 
sd-netlink: do not append prefixlen by default

Otherwise, when NETLINK_GET_STRICT_CHK socket option is enabled, no
address will be dumped.

3 years agonetwork: add several assertions in conf parsers 19715/head
Yu Watanabe [Mon, 24 May 2021 22:11:36 +0000 (07:11 +0900)] 
network: add several assertions in conf parsers

3 years agonetwork: allow to set Group=0 in [Link] section
Yu Watanabe [Fri, 21 May 2021 05:11:36 +0000 (14:11 +0900)] 
network: allow to set Group=0 in [Link] section

Previously, when a link has already in a numbered group, we cannot
remove the link from the group.

This also fixes the range mentioned in the man page.

3 years agokernel-install: don't erase previous errors if a hook returns 77 19713/head
наб [Tue, 16 Mar 2021 15:59:07 +0000 (16:59 +0100)] 
kernel-install: don't erase previous errors if a hook returns 77

The manpage says that exiting 77 is the same as exiting 0,
then skipping all other hooks, but the behaviour heretofor
was to exit 0, skip all, and behave as if all hooks exited 0

3 years agosysusers: make sysusers work with dnf --installroot 19709/head
Zbigniew Jędrzejewski-Szmek [Mon, 24 May 2021 09:34:16 +0000 (11:34 +0200)] 
sysusers: make sysusers work with dnf --installroot

This is not very pretty, but the code in fs-util.c already provisions for
missing /proc. We ourselves are careful to set up /proc, but not everybody
is and it is important for sysusers to also work where shadow-utils would:
I would like to replace calls to useradd and groupadd in Fedora systemd rpm
scriptlets with a call to sysusers. It has a number of advantages:
- dogfooding
- we don't need to manually duplicate the information from our sysusers
  files to scriptlets
- a dependency on shadow-utils is dropped, which transitively drops dependencies
  on setup and fedora-repos and bunch of other stuff.

We could try to get 'dnf' and 'rpm --root' and such to be reworked,
but not in any reasonable timeframe. And even if this was done, we'd still
want to support older rpm/dnf versions.

3 years agobasic: allow copy_rights() to work without mounted /proc
Zbigniew Jędrzejewski-Szmek [Mon, 24 May 2021 09:33:50 +0000 (11:33 +0200)] 
basic: allow copy_rights() to work without mounted /proc

This will be used in sysusers later on.

3 years agosysusers: add debug lines to failing getent/putent operations
Zbigniew Jędrzejewski-Szmek [Mon, 24 May 2021 08:35:13 +0000 (10:35 +0200)] 
sysusers: add debug lines to failing getent/putent operations

I'm trying to use systemd-sysusers for systemd.rpm itself, and the invocation
in dnf chroot is failing like this:
...
Creating group input with gid 999.
Creating group kvm with gid 36.
Creating group render with gid 998.
Creating group sgx with gid 997.
Creating group systemd-journal with gid 190.
Creating group systemd-network with gid 192.
Creating user systemd-network (systemd Network Management) with uid 192 and gid 192.
Creating group systemd-oom with gid 996.
Creating user systemd-oom (systemd Userspace OOM Killer) with uid 996 and gid 996.
Creating group systemd-resolve with gid 193.
Creating user systemd-resolve (systemd Resolver) with uid 193 and gid 193.
Creating group systemd-timesync with gid 995.
Creating user systemd-timesync (systemd Time Synchronization) with uid 995 and gid 995.
Creating group systemd-coredump with gid 994.
Creating user systemd-coredump (systemd Core Dumper) with uid 994 and gid 994.
Failed to write files: Function not implemented

Let's add more info to make such failures easier to debug.

3 years agosysusers: reduce scope of variables and drop unnecessary initializations
Zbigniew Jędrzejewski-Szmek [Mon, 24 May 2021 07:15:39 +0000 (09:15 +0200)] 
sysusers: reduce scope of variables and drop unnecessary initializations

3 years agokernel-install/90-loaderentry: use install(1) instead of cp/chown/chmod chains
наб [Tue, 16 Mar 2021 15:08:34 +0000 (16:08 +0100)] 
kernel-install/90-loaderentry: use install(1) instead of cp/chown/chmod chains

Also fix typo in error message

3 years agorules.d: Properly quote $env{MODALIAS}
Roshan Shariff [Mon, 24 May 2021 07:30:38 +0000 (01:30 -0600)] 
rules.d: Properly quote $env{MODALIAS}

 Add quotes around use of $env{MODALIAS} in rules.d/80-drivers.rules. The
 modalias can contain whitespace, for example when it is dynamically generated
 using device or vendor IDs.

3 years agoTypo in service.c
Vincent Dechenaux [Mon, 24 May 2021 12:31:06 +0000 (14:31 +0200)] 
Typo in service.c

use => user

3 years agoman: we is OK too -> which is OK too (#19708)
наб [Mon, 24 May 2021 09:39:38 +0000 (11:39 +0200)] 
man: we is OK too -> which is OK too (#19708)

3 years agoMerge pull request #19701 from yuwata/network-udev-do-not-manage-loopback-interfaces
Zbigniew Jędrzejewski-Szmek [Mon, 24 May 2021 05:26:18 +0000 (07:26 +0200)] 
Merge pull request #19701 from yuwata/network-udev-do-not-manage-loopback-interfaces

udev: do not manage loopback interfaces

3 years agoMerge pull request #19704 from yuwata/network-small-fixes
Yu Watanabe [Sun, 23 May 2021 14:02:07 +0000 (23:02 +0900)] 
Merge pull request #19704 from yuwata/network-small-fixes

network: several tiny cleanups

3 years agoudev/net: do not manage loopback interfaces 19701/head
Yu Watanabe [Sun, 23 May 2021 07:59:40 +0000 (16:59 +0900)] 
udev/net: do not manage loopback interfaces

There are nothing we can configure in udevd for loopback interfaces;
no ethertool configs can be applied, MAC address, interface name should
not be touched.

3 years agosd-netlink: rename rtnl_get_link_iftype() -> rtnl_get_link_info() and make it optiona...
Yu Watanabe [Sun, 23 May 2021 07:56:47 +0000 (16:56 +0900)] 
sd-netlink: rename rtnl_get_link_iftype() -> rtnl_get_link_info() and make it optionally return link flags

3 years agoudev/net: rename link_config -> LinkConfig
Yu Watanabe [Sun, 23 May 2021 07:44:03 +0000 (16:44 +0900)] 
udev/net: rename link_config -> LinkConfig

3 years agoudev/net: rename link_config_ctx -> LinkConfigContext
Yu Watanabe [Sun, 23 May 2021 07:37:28 +0000 (16:37 +0900)] 
udev/net: rename link_config_ctx -> LinkConfigContext

3 years agonetwork: IPv6LinkLocalAddressGenerationMode=none disables IPv6LL addressing 19704/head
Yu Watanabe [Fri, 21 May 2021 23:15:00 +0000 (08:15 +0900)] 
network: IPv6LinkLocalAddressGenerationMode=none disables IPv6LL addressing

3 years agonetwork: make link_configure() static
Yu Watanabe [Thu, 20 May 2021 19:02:01 +0000 (04:02 +0900)] 
network: make link_configure() static

3 years agoordered-set: introduce ordered_set_get()
Yu Watanabe [Thu, 20 May 2021 19:01:24 +0000 (04:01 +0900)] 
ordered-set: introduce ordered_set_get()

3 years agoMerge pull request #19681 from yuwata/ethtool-util-log
Yu Watanabe [Sun, 23 May 2021 06:24:46 +0000 (15:24 +0900)] 
Merge pull request #19681 from yuwata/ethtool-util-log

ethtool-util: several cleanups

3 years agoethtool-util: drop unused function 19681/head
Yu Watanabe [Fri, 21 May 2021 19:37:54 +0000 (04:37 +0900)] 
ethtool-util: drop unused function

3 years agoudev/net: drop unnecessary conditions
Yu Watanabe [Fri, 21 May 2021 19:23:51 +0000 (04:23 +0900)] 
udev/net: drop unnecessary conditions

3 years agoudev/net: drop fallback logic to set speed
Yu Watanabe [Thu, 20 May 2021 21:22:37 +0000 (06:22 +0900)] 
udev/net: drop fallback logic to set speed

ethtool_set_glinksettings() already fallback to use ETHTOOL_GSET/ETHTOOL_SSET
commands when ETHTOOL_GLINKSETTINGS/ETHTOOL_SLINKSETTINGS are not
supported.

3 years agoethtool-util: do not touch anything if nothing is requested
Yu Watanabe [Fri, 21 May 2021 18:15:16 +0000 (03:15 +0900)] 
ethtool-util: do not touch anything if nothing is requested

And update settings only when it is necessary.

3 years agoethtool-util: disable autonegotiation when speed, duplex, or port is specified
Yu Watanabe [Thu, 20 May 2021 21:03:14 +0000 (06:03 +0900)] 
ethtool-util: disable autonegotiation when speed, duplex, or port is specified

And if autonegotiation is enabled, speed, duplex, and port are ignored.

Fixes #19625.

3 years agoethtool-util: move and rebreak comments
Yu Watanabe [Thu, 20 May 2021 20:32:17 +0000 (05:32 +0900)] 
ethtool-util: move and rebreak comments

3 years agoethtool-util: make ethtool_connect() open fd only when it is not opened
Yu Watanabe [Fri, 21 May 2021 19:07:01 +0000 (04:07 +0900)] 
ethtool-util: make ethtool_connect() open fd only when it is not opened

3 years agoMerge pull request #19697 from jwrdegoede/hwdb-more-accel-quirks
Luca Boccassi [Sat, 22 May 2021 22:57:18 +0000 (23:57 +0100)] 
Merge pull request #19697 from jwrdegoede/hwdb-more-accel-quirks

Hwdb more accel quirks

3 years agoMerge pull request #19700 from keszybz/check-os-release-fixups
Luca Boccassi [Sat, 22 May 2021 22:56:59 +0000 (23:56 +0100)] 
Merge pull request #19700 from keszybz/check-os-release-fixups

Fixups for man/check-os-release.*

3 years agohwdb: keyboard: Ignore duplicate atkbd keypresses on touchpad on/off toggle
Hans de Goede [Sat, 22 May 2021 17:42:21 +0000 (19:42 +0200)] 
hwdb: keyboard: Ignore duplicate atkbd keypresses on touchpad on/off toggle

The atkbd device on the Lenovo Yoga 300-11IBR 2-in-1 sends unknown
keycodes when the touchpad is toggled on/off:

[ 1918.995562] atkbd serio0: Unknown key pressed (translated set 2, code 0x63 on isa0060/serio0).
[ 1918.995610] atkbd serio0: Use 'setkeycodes 63 <keycode>' to make it known.
[ 1919.032121] atkbd serio0: Unknown key released (translated set 2, code 0x63 on isa0060/serio0).
[ 1919.032135] atkbd serio0: Use 'setkeycodes 63 <keycode>' to make it known.
[ 1926.098414] atkbd serio0: Unknown key pressed (translated set 2, code 0x62 on isa0060/serio0).
[ 1926.098461] atkbd serio0: Use 'setkeycodes 62 <keycode>' to make it known.
[ 1926.146537] atkbd serio0: Unknown key released (translated set 2, code 0x62 on isa0060/serio0).
[ 1926.146583] atkbd serio0: Use 'setkeycodes 62 <keycode>' to make it known.

The "Ideapad extra buttons" driver alreadys sends f22 / f23 key-events
when the touchpad is toggles off, so map the keycodes for the duplicate
atkbd events to unknown to silence these kernel warnings.

3 years agoman/check-os-release.*: allow ID_LIKE to have multiple values 19700/head
Zbigniew Jędrzejewski-Szmek [Sat, 22 May 2021 18:29:03 +0000 (20:29 +0200)] 
man/check-os-release.*: allow ID_LIKE to have multiple values

I missed the fact that it is documented to be a space-separated list.

3 years agoman/check-os-release.py: ignore comment and empty lines
Zbigniew Jędrzejewski-Szmek [Sat, 22 May 2021 18:23:02 +0000 (20:23 +0200)] 
man/check-os-release.py: ignore comment and empty lines

Plus fix off-by-one in error printing.

3 years agohwdb: Add accel orientation quirk for the Lenovo Yoga 300-11IBR 2-in-1 19697/head
Hans de Goede [Sat, 22 May 2021 14:22:36 +0000 (16:22 +0200)] 
hwdb: Add accel orientation quirk for the Lenovo Yoga 300-11IBR 2-in-1

Add a quirk for the accelerometer orientation and location for the
2 accelerometers inside the Lenovo Yoga 300-11IBR 2-in-1.

3 years agoMerge pull request #19686 from keszybz/os-release-modernization-and-examples
Lennart Poettering [Sat, 22 May 2021 12:44:50 +0000 (14:44 +0200)] 
Merge pull request #19686 from keszybz/os-release-modernization-and-examples

os-release modernization and examples

3 years agoMerge pull request #19693 from poettering/sleep-tweaks
Lennart Poettering [Sat, 22 May 2021 12:35:26 +0000 (14:35 +0200)] 
Merge pull request #19693 from poettering/sleep-tweaks

sleep code refactoring + automatic fallback from hybrid sleep to suspend

3 years agoman/check-os-release.py: strip trailing whitespace 19686/head
Zbigniew Jędrzejewski-Szmek [Fri, 21 May 2021 13:02:23 +0000 (15:02 +0200)] 
man/check-os-release.py: strip trailing whitespace

The shell parser would do that, so so should we.

3 years agoman: say that initrd-release is like os-release
Zbigniew Jędrzejewski-Szmek [Fri, 21 May 2021 09:11:01 +0000 (11:11 +0200)] 
man: say that initrd-release is like os-release

3 years agohwdb: Add accel orientation quirk for the KD Kurio Smart C15200 tablet
Hans de Goede [Wed, 12 May 2021 17:05:18 +0000 (19:05 +0200)] 
hwdb: Add accel orientation quirk for the KD Kurio Smart C15200 tablet

Add a quirk to fix the accelerometer orientation on the
KD Kurio Smart C15200 tablet.

3 years agosleep: clarify that failure setting env var is not fatal 19693/head
Lennart Poettering [Fri, 21 May 2021 18:24:54 +0000 (20:24 +0200)] 
sleep: clarify that failure setting env var is not fatal

3 years agosleep: if hybrid sleep fails, do regular suspend
Lennart Poettering [Fri, 21 May 2021 16:39:38 +0000 (18:39 +0200)] 
sleep: if hybrid sleep fails, do regular suspend

Fixes #19550

3 years agosleep: remove duplicate logging
Lennart Poettering [Fri, 21 May 2021 16:39:06 +0000 (18:39 +0200)] 
sleep: remove duplicate logging

execute() logs about all errors, hence only log about what's new, i.e.
what we'll do as consequence, and don't mention the error cause again.

3 years agosleep: don't check for EADV
Lennart Poettering [Fri, 21 May 2021 16:27:04 +0000 (18:27 +0200)] 
sleep: don't check for EADV

EADV is not generated anymore since
6d176522f5480ea9e9a83de5ef5ea5e0d95b79cb, let's hence not check for it
anymore.

3 years agosleep: can_sleep_state() + can_sleep_disk() don#t return plain booleans
Lennart Poettering [Fri, 21 May 2021 16:26:48 +0000 (18:26 +0200)] 
sleep: can_sleep_state() + can_sleep_disk() don#t return plain booleans

3 years agosleep: use SleepOperation enum everywhere and drop sleep_settings()
Lennart Poettering [Fri, 21 May 2021 16:23:42 +0000 (18:23 +0200)] 
sleep: use SleepOperation enum everywhere and drop sleep_settings()

Instead of comparing strings everywhere, let's use the new enum. This
allows us to drop sleep_settings(), since the operation enum can be
directly used as index into the config settings.

Some minor other refactoring is done, but mostly just shifting thing
around a bit, no actual change in behaviour.

3 years agosleep: introduce high-level SleepOperation enum
Lennart Poettering [Thu, 20 May 2021 20:31:17 +0000 (22:31 +0200)] 
sleep: introduce high-level SleepOperation enum

3 years agounits: make sure importd has CAP_LINUX_IMMUTABLE flag
Lennart Poettering [Fri, 21 May 2021 20:04:33 +0000 (22:04 +0200)] 
units: make sure importd has CAP_LINUX_IMMUTABLE flag

Since d8f9686c0f1f276c0a687d9bd69f3adf33f15a95 we use the chattr +i flag
for marking containers in directories as reead-only. But to do so we
need the cap for it, hence grant it.

Fixes: #19115
3 years agoMerge pull request #19594 from yuwata/network-nexthop-group
Yu Watanabe [Sat, 22 May 2021 07:01:13 +0000 (16:01 +0900)] 
Merge pull request #19594 from yuwata/network-nexthop-group

network: nexthop: add Group= setting to configure multipath route with group nexthop

3 years agoMerge pull request #19691 from poettering/read-virtual-file-tweaks
Yu Watanabe [Sat, 22 May 2021 06:59:17 +0000 (15:59 +0900)] 
Merge pull request #19691 from poettering/read-virtual-file-tweaks

tweaks to read_virtual_file()

3 years agounits: skip some units in the initrd
Zbigniew Jędrzejewski-Szmek [Fri, 21 May 2021 08:53:25 +0000 (10:53 +0200)] 
units: skip some units in the initrd

I'm working on building initramfs images directly from normal packages, and it
doesn't make sense for those units to be started. Pristine system rpms need to
behave correctly as much as possible also in the initrd, and those units are
enabled by the rpms. There usually isn't enough time for the timer to actually
fire, but starting it gives a line on the console and generally looks confusing
and sloppy. Flushing the journal means that its actually lost, since the real
/var is not available yet.

Another approach would be not enable those units, but right now they are
statically enabled, and changing that would be more work, and doesn't really
seem necessary, since the condition checks are very quick.

Checking for /etc/initrd-release is the standard condition that the initrd
units use, so let's do the same here.

3 years agotest-network: add a test case for nexthop Group= setting 19594/head
Yu Watanabe [Thu, 13 May 2021 02:11:48 +0000 (11:11 +0900)] 
test-network: add a test case for nexthop Group= setting

3 years agonetwork: nexthop: add Group= setting to configure multipath route with group nexthop
Yu Watanabe [Fri, 14 May 2021 01:15:23 +0000 (10:15 +0900)] 
network: nexthop: add Group= setting to configure multipath route with group nexthop

3 years agonetwork: nexthop: IFF_UP flag is required for nexthops which attached to a link
Yu Watanabe [Tue, 18 May 2021 03:20:46 +0000 (12:20 +0900)] 
network: nexthop: IFF_UP flag is required for nexthops which attached to a link

3 years agonetwork: make nexthop_add(), nexthop_configure() and friends return 0 on success
Yu Watanabe [Wed, 12 May 2021 19:59:56 +0000 (04:59 +0900)] 
network: make nexthop_add(), nexthop_configure() and friends return 0 on success

After request queue is introduced, the return value on success is unused.

3 years agofileio: read_virtual_file(): on last attempt ignore file size 19691/head
Lennart Poettering [Fri, 21 May 2021 15:40:19 +0000 (17:40 +0200)] 
fileio: read_virtual_file(): on last attempt ignore file size

Apparently the reported file size was misleading on this file, hence
ignore it on our last loop attempt and just pretend it wasn't reported
at all.

3 years agotest-fileio: run read_virtual_file() for a couple of more interesting sizes
Lennart Poettering [Fri, 21 May 2021 15:36:40 +0000 (17:36 +0200)] 
test-fileio: run read_virtual_file() for a couple of more interesting sizes

3 years agotest-fileio: fix confusing log output
Lennart Poettering [Fri, 21 May 2021 15:35:12 +0000 (17:35 +0200)] 
test-fileio: fix confusing log output

Previously we'd pass all return values of read_virtual_file() to
log_info_errno() as error, but that makes no sense, given that we
sometimes return positive one with means "not truncated" but we'd show
as "Permission denied. Let's fix this, and log differently for sucess
and error.

3 years agofileio: read_virtual_file() don't tweak buffer for returning it when we aren't return...
Lennart Poettering [Fri, 21 May 2021 15:33:32 +0000 (17:33 +0200)] 
fileio: read_virtual_file() don't tweak buffer for returning it when we aren't returning it

Let's avoid some redundant work.

Moreover, let' not check for NUL bytes in the buffer if we don't return
the buffer.

3 years agofileio: fix typo in comment
Lennart Poettering [Fri, 21 May 2021 14:32:37 +0000 (16:32 +0200)] 
fileio: fix typo in comment

3 years agofileio: read_virtual_file(): exit once the max_size limit is reached
Lennart Poettering [Fri, 21 May 2021 14:31:52 +0000 (16:31 +0200)] 
fileio: read_virtual_file(): exit once the max_size limit is reached

Alternative to: #19682

3 years agofileio: if we try to read a file larger than SIZE_MAX this is not a problem if a...
Lennart Poettering [Fri, 21 May 2021 14:30:52 +0000 (16:30 +0200)] 
fileio: if we try to read a file larger than SIZE_MAX this is not a problem if a max_size is specified

i.e. 32bit userspace reading /proc/kcore on a 64bit kernel with max_size
should not needlessly fail.

3 years agonetwork: route: make stored multipath route weight equivalent to hop of nexthop
Yu Watanabe [Thu, 13 May 2021 06:07:35 +0000 (15:07 +0900)] 
network: route: make stored multipath route weight equivalent to hop of nexthop

3 years agoethtool-util: downgrade log level
Yu Watanabe [Thu, 20 May 2021 20:30:28 +0000 (05:30 +0900)] 
ethtool-util: downgrade log level

This just hides issue #19625. It will be fixed in later commits.

3 years agotest-env-util: use streq_ptr when comparing directly the result of getenv
Luca Boccassi [Fri, 21 May 2021 12:39:24 +0000 (13:39 +0100)] 
test-env-util: use streq_ptr when comparing directly the result of getenv

It might return NULL.

Fixes CID #1453247

3 years agosd-device: use strjoina() more again in sd_device_new_from_subsystem_sysname()
Lennart Poettering [Mon, 10 May 2021 14:41:46 +0000 (16:41 +0200)] 
sd-device: use strjoina() more again in sd_device_new_from_subsystem_sysname()

This reverts a major part of: e17c95af8e450caacde692875b30675cea75211f

Using format strings for concatenating strings is pretty unefficient,
and using PATH_MAX buffers unpretty as well. Let's revert to using
strjoina() as before.

However, to fix the fuzz issue at hand, let's explicitly verify the two
input strings ensuring they are valid path names. This includes a length
check (to 2K each), thus making things prettier, faster and using less
memory again.

3 years agoMerge pull request #19676 from bluca/coverity
Lennart Poettering [Fri, 21 May 2021 15:52:36 +0000 (17:52 +0200)] 
Merge pull request #19676 from bluca/coverity

Fix two new coverity issues

3 years agoMerge pull request #19672 from yuwata/strextend
Lennart Poettering [Fri, 21 May 2021 15:52:14 +0000 (17:52 +0200)] 
Merge pull request #19672 from yuwata/strextend

tree-wide: introduce strextendf_with_separator() and use strextend() or freinds