Commit Graph

58597 Commits

Author SHA1 Message Date
Michal Sekletar
1611606fd9 NEWS: mention change in default behavior of background sessions 2022-07-07 10:11:45 +09:00
Michal Sekletar
bf40417c7c tests: add test for handling of background sessions 2022-07-07 10:11:43 +09:00
Michal Sekletar
e73bf3425c logind: don't start user@UID.service instance for background sessions
We have had background session class for a long time (since commit
e2acb67baa), but so far the only difference in handling of background
sessions was logging, i.e. we log some messages with LOG_DEBUG for such
sessions.

Previously there were complains [1] about excessive logging for each
time cron session is started. We used to advise user to enable lingering
for users if they want to avoid these log messages. However, on servers
with a lot of users the extra processes that result from lingering just
adds too much overhead. Hence I think that our current handling of
background sessions is not ideal and we should make better use of this
attribute.

This commit introduces a change in default behavior of logind. Logind is
now not going to start user instance of systemd when background session
is created and that should address excessive logging problem for cron
where background class is used by default. When the same user actually
logs in normally then user instance will be started as previously.

Also note that PAM_TTY variable is now always set to some value for PAM
sessions started via PAMName= option. Otherwise we would categorize such
sessions as "background" and user manager won't be started.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1825942
2022-07-07 10:10:42 +09:00
Yu Watanabe
948fce5118 test: fix typo 2022-07-07 09:33:11 +09:00
Yu Watanabe
47b86590af TODO: fix typo 2022-07-07 09:31:43 +09:00
Yu Watanabe
99080ed3f0
Merge pull request #23396 from msekletar/fix-idle-action-lock
logind: remember our idle state and use it to detect idle level transitions
2022-07-07 07:42:51 +09:00
Zbigniew Jędrzejewski-Szmek
2615c1f17a os-release: define SUPPORT_END=
Fixes #21764.

I think is very simple, but flexible. The date may be set early, for distros
that have a fixed schedule, but it doesn't have to. So for example Debian could
push out an update that sets a few months before the release goes EOL. And
various tools, in particular graphical desktops, can start nagging people to
upgrade a few weeks before the date.

As discussed in the bug, we don't need granularity higher than a day. And this
means that we can use a simple human- and machine-readable format.
I was considering other names, e.g. something with "EOL", but I think that
"SUPPORT_END" is better because it doesn't imply that the machine will somehow
stop working. This is supposed to be an advisory, nothing more.
2022-07-07 07:35:17 +09:00
Luca Boccassi
c235945bd5
Merge pull request #23918 from yuwata/dissect
Revert "dissect: ID from os-release should be non-empty, not just non-NULL"
2022-07-06 21:31:04 +01:00
Thomas Haller
da519f8c81 fundamental: adjust #if conditional for _fallthrough_ for clang
NetworkManager takes systemd sources. It gets compiler warnings
related to _fallthrough_. They probably can also affect systemd
itself.

A) on RHEL-7, gcc 4.8.5-44.el7 we get:

    ../src/libnm-systemd-shared/src/fundamental/macro-fundamental.h:45:22: error: "__clang__" is not defined [-Werror=undef]
     #if __GNUC__ >= 7 || __clang__
                          ^

   Presumably gcc older than 7 is supported, so fix this.

B) on Ubuntu 18.04, clang 1:6.0-41~exp5~ubuntu1 we get:

    ../src/libnm-systemd-core/src/libsystemd-network/sd-dhcp6-client.c:746:17: error: declaration does not declare anything [-Werror,-Wmissing-declarations]
                    _fallthrough_;
                    ^
    ../src/libnm-systemd-shared/src/fundamental/macro-fundamental.h:46:25: note: expanded from macro '_fallthrough_'
    #  define _fallthrough_ __attribute__((__fallthrough__))
                            ^

   Granted, README comments that clang >= 10 is required. However,
   parts of systemd build just fine with older clang. It seems unnecessary
   to break this and the fix helps NetworkManager.

Fixes: c0f5d58c9a ('meson: Document why -Wimplicit-fallthrough is not used with clang')
2022-07-06 22:10:23 +02:00
Zbigniew Jędrzejewski-Szmek
132b63bd31
Merge pull request #15205 from jlebon/pr/preset-all-firstboot
manager: optionally, do a full preset on first boot
2022-07-06 19:11:01 +02:00
Daan De Meyer
13f4f0fd81 mkosi: Update to latest release
This fixes the mkosi github action to unbreak the mkosi CI
2022-07-06 15:57:12 +02:00
Lennart Poettering
0c772b1cc1 man: "enabled commands are started at boot" is rubbish
it's enabled units, and they might be started by various forms of
activation, not just "at boot".

Fix that.
2022-07-06 15:56:53 +02:00
Lennart Poettering
2df264e60c update TODO 2022-07-06 13:13:03 +02:00
Yu Watanabe
d30d86b7ed dissect: refuse empty release ID 2022-07-06 19:16:24 +09:00
Yu Watanabe
8b2dcbbd00 Revert "dissect: ID from os-release should be non-empty, not just non-NULL"
This reverts commit a2cf73f0b6.

This is not necessary after 78ab2b5064.

Addresses https://github.com/systemd/systemd/pull/23454#discussion_r913611798.
2022-07-06 14:39:54 +09:00
Yu Watanabe
917c6bb4b3
Merge pull request #23916 from keszybz/assorted-patches
Assorted patches
2022-07-06 14:15:50 +09:00
Lennart Poettering
93258c7d72 json: actually use numeric C locale we just allocated
This fixes formatting of JSON real values, and uses C locale for them.
It's kinda interesting that this wasn't noticed before: the C locale
object we allocated was not used, hence doing the dance had zero effect.

This makes "test-varlink" pass again on systems with non-C locale.

(My guess: noone noticed this because "long double" was used before by
the JSON code and that had no locale supporting printer or so?)
2022-07-05 22:14:50 +02:00
Daan De Meyer
977ad21b5b journal: Make sd_journal_previous/next() return 0 at HEAD/TAIL
Currently, both these functions don't return 0 if we're at HEAD/TAIL
and move in the corresponding direction. Let's fix that.

Replaces #23480
2022-07-05 22:13:40 +02:00
Lennart Poettering
e07ed99dd7 docs: normalize uppercasing of titles of network doc 2022-07-05 22:12:08 +02:00
Zbigniew Jędrzejewski-Szmek
891fc28b45 tree-wide: drop duplicated semicolons 2022-07-05 21:49:12 +02:00
Zbigniew Jędrzejewski-Szmek
6f52e1c63b man: fix link to glob(3) 2022-07-05 21:49:12 +02:00
Zbigniew Jędrzejewski-Szmek
cec3e9a774 fuzz: rename samples to avoid long test names 2022-07-05 21:49:12 +02:00
Lennart Poettering
a87af99ef1
Merge pull request #23855 from keszybz/drop-list-is-empty
basic/list: drop LIST_IS_EMPTY
2022-07-05 17:29:53 +02:00
Daan De Meyer
87a3a4a802 firstboot: Don't skip passwd/shadow logic if only one of the files exists
If one of the files exists but not the other one, we want to make sure
we create the other file to make sure the passwd database is in a valid
state.
2022-07-05 17:09:16 +02:00
Lennart Poettering
e386a6d69b
Merge pull request #23906 from poettering/isdigitisalpha
tree-wide: add global ascii_isalpha() + ascii_isdigit() and use it everywhere
2022-07-05 16:40:39 +02:00
Quentin Deslandes
57f28dee00 machine: switch to BusLocator-oriented helpers
Replace existing sd_bus_x calls with counterparts from bus-locator.h.
2022-07-05 16:40:16 +02:00
Zbigniew Jędrzejewski-Szmek
b8df7f8629 user: delegate cpu controller, assign weights to user slices
So far we didn't enable the cpu controller because of overhead of the
accounting. If I'm reading things correctly, delegation was enabled for a while
for the units with user and pam context set, i.e. for user@.service too.
a931ad47a8 added the explicit Delegate=yes|no
switch, but it was initially set to 'yes'.
acc8059129 disabled delegation for user@.service
with the justication that CPU accounting is expensive, but half a year later
a88c5b8ac4 changed DefaultCPUAccounting=yes for
kernels >=4.15 with the justification that CPU accounting is inexpensive there.

In my (very noncomprehensive) testing, I don't see a measurable overhead if the
cpu controller is enabled for user slices. I tried some repeated compilations,
and there is was no statistical difference, but the noise level was fairly
high. Maybe better benchmarking would reveal a difference.

The goal of this change is very simple: currently all of the user session,
including services like the display server and pipewire are under user@.service.
This means that when e.g. a compilation job is started in the session's
app.slice, the processes in session.slice compete for CPU and can be starved.
In particular, audio starts to stutter, etc. With CPU controller enabled,
I can start start 'ninja -C build -j40' in a tab and this doesn't have any
noticable effect on audio.

I don't think the particular values matter too much: the CPU controller is
work-convserving, and presumably the session slice would never need more than
e.g. one 1 full CPU, i.e. half or a quarter of available CPU resources on even
the smallest of today's machines. app.slice and session.slice are assigned
equal weights, background.slice is assigned a smaller fraction. CPUWeight=100
is the default, but I wrote it explicitly to make it easier for users to see
how the split is done. So effectively this should result in session.slice
getting as much power as it needs.

If if turns out that this does have a noticable overhead, we could make it
opt-in. But I think that the benefit to usability is important enough to enable
it by default. W/o something like this the session is not really usable with
background tasks.
2022-07-05 14:40:01 +02:00
Lennart Poettering
ff25d3385d tree-wide: add global ascii_isdigit() + ascii_isalpha()
We now have a local implementation in string-util-fundamental.c, but
it's useful at a lot of other places, hence let's give it a more
expressive name and share it across the tree.

Follow-up for: 8d9156660d
2022-07-05 14:25:07 +02:00
Lennart Poettering
82c3a0b74c sd-id128: don't allow chars > f in valid id128 values 2022-07-05 14:23:11 +02:00
Lennart Poettering
d486b26fe3 update TODO 2022-07-05 14:22:03 +02:00
Lennart Poettering
a22a4e1d1a docs: move some stuff into "Networking" section
The "Networking" section has a lonely single document listed right now,
even though the "Concepts" section has two more network related docs.
Move them over, let's end this loneliness.
2022-07-05 11:22:06 +01:00
Li kunyu
aea29a300d
tree-wide: Remove the repeated ';' from code (#23901) 2022-07-05 16:06:47 +09:00
nl6720
0e68582323 tree-wide: link to docs.kernel.org for kernel documentation
https://www.kernel.org/ links to https://docs.kernel.org/ for the documentation.
See https://git.kernel.org/pub/scm/docs/kernel/website.git/commit/?id=ebc1c372850f249dd143c6d942e66c88ec610520

These URLs are shorter and nicer looking.
2022-07-04 19:56:53 +02:00
Yu Watanabe
7c38952e68
Merge pull request #23104 from mrc0mmand/resolved-tests
Introduce systemd-resolved test suite
2022-07-04 23:46:16 +09:00
Daan De Meyer
c3191c6d4f meson: Assign tests a suite based on their directory
This can be used to run only a subset of tests, e.g.
"meson test -C build --suite journal" to run only the journal
unit tests.
2022-07-04 14:46:30 +02:00
Michal Sekletar
181656fc0f tests: verify that Lock D-Bus signal is sent when IdleAction=lock 2022-07-04 14:22:15 +02:00
Frantisek Sumsal
fb6f25d7b9 test: Introduce systemd-resolved test suite
Resolves: #19599
2022-07-04 12:21:55 +02:00
Frantisek Sumsal
17082e8ac1 test: resize the terminal automagically with INTERACTIVE_DEBUG=yes 2022-07-04 09:41:06 +02:00
Frantisek Sumsal
8afe2f53b2 test: install /usr/libexec/vi as well
since `/bin/vi` (at least on Fedora) is a shell wrapper which runs
either `/bin/vim` or `/usr/libexec/vi` based on availability.
2022-07-04 09:41:06 +02:00
Yu Watanabe
5932c87000
Merge pull request #23886 from keszybz/https-links-kernel
tree-wide: use html links for kernel docs
2022-07-03 00:55:59 +09:00
Zbigniew Jędrzejewski-Szmek
025f1279c7
Merge pull request #23088 from yuwata/udev-event-blocker
udev: cleanups for event blocker
2022-07-02 17:08:45 +02:00
Zbigniew Jędrzejewski-Szmek
7b3b2e5ad6
Merge pull request #23865 from keszybz/drop-memcpy-call
sd-id128: avoid an unnecessary function call in inline helper
2022-07-02 16:59:32 +02:00
Nick Rosbrook
ddbc88188c test: copy libgcc_s.so.1 to TPM2 test image on Debian-like systems
On Ubuntu, cryptsetup does not link against libgcc_s.so.1 which leads to
the following test failure in TEST-70-TPM2:

 systemd[1]: Starting testsuite-70.service...
 systemd[329]: testsuite-70.service: Executing: /usr/lib/systemd/tests/testdata/units/testsuite-70.sh
 testsuite-70.sh[329]: + export SYSTEMD_LOG_LEVEL=debug
 testsuite-70.sh[329]: + SYSTEMD_LOG_LEVEL=debug
 testsuite-70.sh[329]: + img=/var/tmp/test.img
 testsuite-70.sh[329]: + dd if=/dev/zero of=/var/tmp/test.img bs=1024k count=20 status=none
 testsuite-70.sh[329]: + echo -n passphrase
 testsuite-70.sh[329]: + cryptsetup luksFormat -q --use-urandom /var/tmp/test.img /tmp/passphrase
 testsuite-70.sh[333]: libgcc_s.so.1 must be installed for pthread_exit to work
 testsuite-70.sh[329]: /usr/lib/systemd/tests/testdata/units/testsuite-70.sh:
     line 12: 333 Aborted (core dumped) cryptsetup luksFormat -q --use-urandom $img /tmp/passphrase

To fix this, manually install libgcc_s.so.1 to the test image if running
on Debian-like systems.
2022-07-02 15:01:30 +01:00
Zbigniew Jędrzejewski-Szmek
f217f9a8b3 man/network: fix wording and syntax
Follow-up for 0bcc6557fb. Docbook doesn't
know <variable>.
2022-07-02 13:40:49 +02:00
Zbigniew Jędrzejewski-Szmek
4b2942aaea
Merge pull request #23835 from yuwata/nspawn-private-users-identity
nspawn: follow-ups for --private-users=identity
2022-07-02 12:58:06 +02:00
Zbigniew Jędrzejewski-Szmek
c4f2bff121 test-list: rename field to indicate that it's a list
With this commit, lists are generally either names with plural (items),
or in a way that indicates a multi-item container (queue, *_list, or similar).
2022-07-02 12:51:37 +02:00
Zbigniew Jędrzejewski-Szmek
eb506199f0 systemctl: rename field for clarity 2022-07-02 12:51:37 +02:00
Zbigniew Jędrzejewski-Szmek
d5fe7f7fb1 udev: rename field
When we start, the contents of the variable match the name. But then
in the loop, the variable doesn't point at the old head any more. So let's
rename it to something with a plural.
2022-07-02 12:46:19 +02:00
Zbigniew Jędrzejewski-Szmek
ed828563a5 sd-event: rename field to indicate that it's a list 2022-07-02 12:46:19 +02:00
Zbigniew Jędrzejewski-Szmek
0601b95877 sd-event: rename field to indicate that it's a list 2022-07-02 12:46:19 +02:00