systemd/.git
5 years agoman: fix typo in net-naming-scheme man page
Lennart Poettering [Wed, 11 Dec 2019 10:52:00 +0000 (11:52 +0100)]
man: fix typo in net-naming-scheme man page

(cherry picked from commit 955ed5d540fe090687e085d894381f6bf0e57688)
(cherry picked from commit cbced49daaa664484ede8561f417dc767487eaf4)

5 years agoman: fix typos (#14304)
cheese1 [Wed, 11 Dec 2019 09:33:13 +0000 (10:33 +0100)]
man: fix typos (#14304)

(cherry picked from commit f32d15b0e4f5a0d2c31b22cb66f690a158ae9dfd)
(cherry picked from commit bf4b7d07baa7e917aa4b3addc10e8c55b65771ee)

5 years agoipv4ll: do not reset conflict counter on restart
AJ Bagwell [Tue, 10 Dec 2019 16:27:31 +0000 (16:27 +0000)]
ipv4ll: do not reset conflict counter on restart

Don't reset the conflict counter when trying a new pseudo random
address, so that after trying 10 addresses the londer timeout is used in
accordance with the RFC

Fixes #14299.

(cherry picked from commit e92b60b20f21111a0c28135c1b5c78fc851a4f15)
(cherry picked from commit 1ba2e7a73000fedbf4b9a9af3a3e893f5f26eb9d)

5 years agoFix typo (duplicate "or")
Timo Wilken [Thu, 5 Dec 2019 18:36:57 +0000 (18:36 +0000)]
Fix typo (duplicate "or")

This fixes a double "or" in the text of `systemctl --help`.

(cherry picked from commit ab4fae0c8c3fae4d3d67bf6e1176bbda1dfa208e)
(cherry picked from commit bcf0aa02bf68cfd8b55ecaa5221a246a63a9646f)

5 years agonetwork: if /sys is rw, then udev should be around
Yu Watanabe [Wed, 4 Dec 2019 10:12:36 +0000 (19:12 +0900)]
network: if /sys is rw, then udev should be around

This switches detect_container() to path_is_read_only_rw("/sys"), as if
systemd-udevd.service is conditionalized with that way.

This also updates the log message.

(cherry picked from commit bf331d87171b7750d1c72ab0b140a240c0cf32c3)
(cherry picked from commit 96d7083c5499b264ecebd6a30a92e0e8fda14cd5)

5 years agonspawn: do not fail if udev is not running
Yu Watanabe [Mon, 2 Dec 2019 15:51:44 +0000 (00:51 +0900)]
nspawn: do not fail if udev is not running

If /sys is read only filesystem, e.g., nspawn is running in container,
then usually udev is not running. In such a case, let's assume that
the interface is already initialized. Also, this makes nspawn refuse
to use the network interface which is under renaming.

Fixes #14223.

(cherry picked from commit 26208d5b9674079dcf2c9d301f09a7c7b23bfdc3)
(cherry picked from commit e874419902892d4bc272475b14446fe8385b0e8b)

5 years agoCreate parent directories when creating systemd-private subdirs
Jérémy Rosen [Fri, 29 Nov 2019 19:28:35 +0000 (20:28 +0100)]
Create parent directories when creating systemd-private subdirs

This is needed when systemd is compiled without systemd-tmpfiles

(cherry picked from commit a652f050a78616efb9e75c5b49c925400c64dded)
(cherry picked from commit 29c9144655de34494c424a36b6b42e2776db817e)

5 years agonetwork: do not return error but return UINT64_MAX if speed meter is disabled
Yu Watanabe [Mon, 2 Dec 2019 15:29:44 +0000 (00:29 +0900)]
network: do not return error but return UINT64_MAX if speed meter is disabled

Fixes #14222.

(cherry picked from commit e813de549b17f2601750c95825d8e0740cbee38c)
(cherry picked from commit 9cbb8b5254378de10f6be06585cf264ab4457dac)

5 years agocore: swap priority can be negative
Topi Miettinen [Tue, 3 Dec 2019 18:36:37 +0000 (20:36 +0200)]
core: swap priority can be negative

Negative priorities are useful for swap targets which should be only used as
last resort.

(cherry picked from commit 7477451b691d288dad67b4c8ce9e519e9b75770d)
(cherry picked from commit c08429ae339089a04be21c65d2ecd0dd784102ba)

5 years agosystemctl: enhance message about kexec missing kernel
Zbigniew Jędrzejewski-Szmek [Tue, 3 Dec 2019 11:54:52 +0000 (11:54 +0000)]
systemctl: enhance message about kexec missing kernel

Fixes #7730.

(cherry picked from commit 2fec5854baa6f1262b9cb827bc4a8eb27b376b7d)
(cherry picked from commit 65fd2fce5972d93c38986d9166dc1dd9bba346cf)

5 years agoman: use mkswap@ instead of makeswap@
Jan Tojnar [Thu, 28 Nov 2019 11:42:01 +0000 (12:42 +0100)]
man: use mkswap@ instead of makeswap@

That is what is linked from systemd.swap(5) and also what the systemd.generator produces.

(cherry picked from commit 88eb0519722f285e5264a909f16ddf2648190681)

5 years agojournald: don't ask for the machine ID if we don't need it
Lennart Poettering [Mon, 25 Nov 2019 13:08:53 +0000 (14:08 +0100)]
journald: don't ask for the machine ID if we don't need it

(cherry picked from commit 806c6a5b97a0bec371c782101a28ff706417b021)

5 years agojournalctl: pager_close() calls fflush(stdout) anyway as first thing
Lennart Poettering [Tue, 26 Nov 2019 10:28:33 +0000 (11:28 +0100)]
journalctl: pager_close() calls fflush(stdout) anyway as first thing

(cherry picked from commit 3aebd9d6dd85c8d949b3b22cf6e96e98febcf157)

5 years agojournald: remove unused field
Lennart Poettering [Wed, 27 Nov 2019 12:03:26 +0000 (13:03 +0100)]
journald: remove unused field

(cherry picked from commit c31469e2ee0c84007a1a901bf792a6c0841267b1)

5 years agojournalctl: return EOPNOTSUPP if pcre is not enabled
Lennart Poettering [Mon, 25 Nov 2019 17:44:40 +0000 (18:44 +0100)]
journalctl: return EOPNOTSUPP if pcre is not enabled

(cherry picked from commit 2275b747414eed2db96d9f276aa53d9a6eaf8be6)

5 years agoman: drop reference to machined, add one for journald instead
Lennart Poettering [Thu, 28 Nov 2019 09:36:08 +0000 (10:36 +0100)]
man: drop reference to machined, add one for journald instead

We dropped documentation from sd_journal_open_container() long ago
(since the call is obsolete), hence drop the reference to machined. But
add one in for journald instead.

(cherry picked from commit d18df32d8229aff0bed41e9fe2a7a61598d70c89)

5 years agopid1: make TimeoutAbortSec settable for transient units
Zbigniew Jędrzejewski-Szmek [Wed, 27 Nov 2019 12:42:57 +0000 (13:42 +0100)]
pid1: make TimeoutAbortSec settable for transient units

It was documented to be, but implementation was missing.

(cherry picked from commit e737017b856e9c8638a049bb0114eb7d51d6c3cc)

5 years agopid1: fix setting of DefaultTimeoutAbortSec
Zbigniew Jędrzejewski-Szmek [Wed, 27 Nov 2019 12:13:17 +0000 (13:13 +0100)]
pid1: fix setting of DefaultTimeoutAbortSec

This partially reverts a07a7324adf504381e9374d1f1a5db6edaa46435.
We have two pieces of information: the value and a boolean.
config_parse_timeout_abort() added in the reverted commit would write
the boolean to the usec_t value, making a mess.

The code is reworked to have just one implementation and two wrappers
which pass two pointers.

(cherry picked from commit a61d68748afef4814760774eb0458a46d4ea9922)

5 years agoshared/ask-password-api: modify keyctl break value
Kevin Kuehler [Thu, 28 Nov 2019 00:35:15 +0000 (16:35 -0800)]
shared/ask-password-api: modify keyctl break value

We can break if KEYCTL_READ return value is equal to our buffer size.

From keyctl(2):

On a successful return, the return value is always the total size of
the payload data.  To determine whether the buffer was of sufficient
size, check to see that the return value is less than or equal to the
value supplied in arg4.

(cherry picked from commit 6da498c28f2598bea4d651756485f57d54e379f4)

5 years agocryptsetup: reduce the chance that we will be OOM killed
Michal Sekletár [Wed, 27 Nov 2019 13:27:58 +0000 (14:27 +0100)]
cryptsetup: reduce the chance that we will be OOM killed

cryptsetup introduced optional locking scheme that should serialize
unlocking keyslots which use memory hard key derivation
function (argon2). Using the serialization should prevent OOM situation
in early boot while unlocking encrypted volumes.

(cherry picked from commit 408c81f62454684dfbff1c95ce3210d06f256e58)

5 years agocore: write out correct field name when creating transient service units
Lennart Poettering [Wed, 27 Nov 2019 11:05:38 +0000 (12:05 +0100)]
core: write out correct field name when creating transient service units

(cherry picked from commit f14bf013126ebcdc689995234cb15fc0b605a262)

5 years agoudevd: don't use monitor after manager_exit()
Martin Wilck [Tue, 26 Nov 2019 17:39:09 +0000 (18:39 +0100)]
udevd: don't use monitor after manager_exit()

If udevd receives an exit signal, it releases its reference on the udev
monitor in manager_exit(). If at this time a worker is hanging, and if
the event timeout for this worker expires before udevd exits, udevd
crashes in on_sigchld()->udev_monitor_send_device(), because the monitor
has already been freed.

Fix this by testing the validity of manager->monitor in on_sigchld().

(cherry picked from commit 030f4571670537c76355c5d923468c9a61aa77e9)

5 years agoRevert "udevd: fix crash when workers time out after exit is signal caught"
Martin Wilck [Tue, 26 Nov 2019 17:36:46 +0000 (18:36 +0100)]
Revert "udevd: fix crash when workers time out after exit is signal caught"

This reverts commit 5db454b8031c58a743cc4ee3d5d1dd01dcff17e8.
See https://github.com/systemd/systemd/issues/14128

(cherry picked from commit 3cabdc2345608b01e344a52fe6f8c3c378406ebc)

5 years agoman/systemd.link: Add missing verb *be*
Paul Menzel [Tue, 26 Nov 2019 21:52:17 +0000 (22:52 +0100)]
man/systemd.link: Add missing verb *be*

(cherry picked from commit a19b9a382711110c99365a24bd4da2b848f2b7d5)

5 years agoman: document all pager variables for systemctl and systemd
Zbigniew Jędrzejewski-Szmek [Sun, 24 Nov 2019 12:59:32 +0000 (13:59 +0100)]
man: document all pager variables for systemctl and systemd

In those two pages, we need to include individual entries with xi:include to
merge the list less-variables.xml with the other entries, which is obviously
error prone. All variables are supported in both tools so add them.

(cherry picked from commit 3d58bfc01c9283eded77736990ea09b0ee4f6e23)

5 years agocore.timer: fix "systemd-analyze dump" and docs syntax inconsistencies wrt OnTimezone...
Mike Kazantsev [Mon, 25 Nov 2019 23:29:03 +0000 (04:29 +0500)]
core.timer: fix "systemd-analyze dump" and docs syntax inconsistencies wrt OnTimezoneChange=

(cherry picked from commit 0810e396284998afef945f982304bc86d245e26d)

5 years agocore/service: downgrade "scheduling restart" message to debug
Zbigniew Jędrzejewski-Szmek [Fri, 22 Nov 2019 13:19:51 +0000 (14:19 +0100)]
core/service: downgrade "scheduling restart" message to debug

I see we log this during every boot, even though it is a routine expected event:
Nov 12 14:50:01 krowka systemd[1]: systemd-journald.service: Service has no hold-off time (RestartSec=0), scheduling restart.
(and for other services too). Let's downgrade this to debug level.

https://bugzilla.redhat.com/show_bug.cgi?id=1614871
(cherry picked from commit 868f7d36cc26552cc7377a6a81913fa8803bc3bb)

5 years agotravis: add missing closing quote sign
Yu Watanabe [Sun, 24 Nov 2019 09:29:57 +0000 (18:29 +0900)]
travis: add missing closing quote sign

Fixes #14127.

(cherry picked from commit 8c99d40d47292e8c1be8c159943a2d8781b9d3e9)

5 years agosystemd-tmpfiles: don't install timer when service isn't installed either
Pascal de Bruijn [Fri, 22 Nov 2019 08:20:20 +0000 (09:20 +0100)]
systemd-tmpfiles: don't install timer when service isn't installed either

Fixes: systemd-tmpfiles-clean.timer: Refusing to start, unit
systemd-tmpfiles-clean.service to trigger not loaded.

(cherry picked from commit b4e2236a724274887c561434468387d4945ec61e)

5 years agopam_systemd: prolong method call timeout when allocating session
Lennart Poettering [Mon, 19 Aug 2019 13:15:13 +0000 (15:15 +0200)]
pam_systemd: prolong method call timeout when allocating session

Starting a session might involve starting the user@.service instance,
hence let's make the bus call timeout substantially longer.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=83828
(cherry picked from commit fbcb630045f9d13d6d4b16ba376b0cf27bf1e2d5)

6 years agoman: add entry about SpeedMeter= v243.4
Yu Watanabe [Mon, 18 Nov 2019 15:03:35 +0000 (00:03 +0900)]
man: add entry about SpeedMeter=

Closes #14002.

(cherry picked from commit c9fdaed079524942445a1bbbb975766768ad9b04)

6 years agoudev: silence warning about PROGRAM+= or IMPORT+= rules
Yu Watanabe [Mon, 18 Nov 2019 10:28:11 +0000 (19:28 +0900)]
udev: silence warning about PROGRAM+= or IMPORT+= rules

Closes #14062.

(cherry picked from commit f0beb6f816035e438d684cc52ae76fc4a44fc197)

6 years agoudevadm: ignore EROFS and return earlier
Yu Watanabe [Mon, 18 Nov 2019 09:47:16 +0000 (18:47 +0900)]
udevadm: ignore EROFS and return earlier

Fixes #14060.

(cherry picked from commit dc11d2bf6602558770e61f772d925ba8dcc71233)

6 years agobasic: add vmware hypervisor detection from device-tree
Cyprien Laplace [Thu, 14 Nov 2019 14:42:14 +0000 (09:42 -0500)]
basic: add vmware hypervisor detection from device-tree

Allow ConditionVirtualization=vmware to work on ESXi on arm VMs
using device-tree.

(cherry picked from commit 4d4ac92c928fcbc60b85fcbf8370af3883ee63db)

6 years agoumount: be happy if /proc/swaps doesn't exist
Lennart Poettering [Fri, 15 Nov 2019 13:57:27 +0000 (14:57 +0100)]
umount: be happy if /proc/swaps doesn't exist

Kernels work without swap just fine.

Fixes: #13993
(cherry picked from commit 2cdd0d612d18732db845f2f44f217d6e00c62010)

6 years agoshutdown: make logging more useful if NULL swap/mount table files are specified
Lennart Poettering [Fri, 15 Nov 2019 13:56:35 +0000 (14:56 +0100)]
shutdown: make logging more useful if NULL swap/mount table files are specified

Makes the error output seen in #13993 more readable.

(cherry picked from commit f795267e3ad419c1f40dec0d3aef77cb8db3b841)

6 years agoman: share description of $SYSTEMD_COLORS in other tools
Zbigniew Jędrzejewski-Szmek [Fri, 15 Nov 2019 10:59:34 +0000 (11:59 +0100)]
man: share description of $SYSTEMD_COLORS in other tools

It was only described in systemd(1), making it hard to discover.
Fixes #13561.

The same for $SYSTEMD_URLIFY.

I think all the tools whose man pages include less-variables.xml support
those variables.

(cherry picked from commit 339bf2076b3294e5f7b59e84c59ba8c55ded3c25)

6 years agocore: do not propagate polkit error to caller
Zbigniew Jędrzejewski-Szmek [Thu, 14 Nov 2019 13:28:05 +0000 (14:28 +0100)]
core: do not propagate polkit error to caller

If we fail to start polkit, we get a message like
"org.freedesktop.DBus.Error.NameHasNoOwner: Could not activate remote peer.",
which has no meaning for the caller of our StartUnit method. Let's just
return -EACCES.

$ systemctl start apache
Failed to start apache.service: Could not activate remote peer. (before)
Failed to start apache.service: Access denied                   (after)

Fixes #13865.

(cherry picked from commit 7edd8fb198f3e8a95677df8a8f5016ed40dcff54)

6 years agoask-password: don't hit assert() when we query pw which the user C-d and caching...
Lennart Poettering [Wed, 13 Nov 2019 19:07:31 +0000 (20:07 +0100)]
ask-password: don't hit assert() when we query pw which the user C-d and caching is enabled

(cherry picked from commit e013e10d0e96917b627d54f20e3dba80a17df0d5)

6 years agoman: mention $RUNTIME_DIRECTORY & friends in environment list
Zbigniew Jędrzejewski-Szmek [Wed, 13 Nov 2019 20:55:30 +0000 (21:55 +0100)]
man: mention $RUNTIME_DIRECTORY & friends in environment list

(cherry picked from commit 1f6597a84cd3891a69a630c6c4b168da46b1c160)

6 years agocryptsetup-generator: guess whether the keyfile argument is two items or one
Zbigniew Jędrzejewski-Szmek [Wed, 13 Nov 2019 09:32:30 +0000 (10:32 +0100)]
cryptsetup-generator: guess whether the keyfile argument is two items or one

Fixes #13615.

See the inline comment for documentation.

(cherry picked from commit 32c6237a7c2e697d2fc4f3403319db16858fb8e3)

6 years agoverify: fix segmentation fault
HATAYAMA Daisuke [Wed, 13 Nov 2019 11:30:58 +0000 (06:30 -0500)]
verify: fix segmentation fault

systemd-analyze verify command now results in segmentation fault if two
consecutive non-existent unit file names are given:

    # ./build/systemd-analyze a.service b.service
    ...<snip irrelevant part>...
    Unit a.service not found.
    Unit b.service not found.
    Segmentation fault (core dumped)

The cause of this is a wrong handling of return value of
manager_load_startable_unit_or_warn() in verify_units() in failure case.

It looks that the current logic wants to assign the first error status
throughout verify_units() into variable r and count up variable count only when
a given unit file exists.

However, due to the wrong handling of the return value of
manager_load_startable_unit_or_warn() in verify_units(), the variable count is
unexpectedly incremented even when there is no such unit file because the
variable r already contains non-zero value in the 2nd failure, set by the 1st
failure, and then the condition k < 0 && r == 0 evaluates to false.

This commit fixes the wrong handling of return value of
manager_load_startable_unit_or_warn() in verify_units().

(cherry picked from commit fc9de36a3b60c69a17442aabf215e2d87e697e6f)

6 years agotimedated: it might be that tzinfo files are just not installed
Lennart Poettering [Wed, 13 Nov 2019 09:39:09 +0000 (10:39 +0100)]
timedated: it might be that tzinfo files are just not installed

(cherry picked from commit 5322db0651e1c29b61e2b42764b538722106522c)

6 years agotimedated: handle UTC specially, when generating /etc/localtime
Lennart Poettering [Wed, 13 Nov 2019 09:32:44 +0000 (10:32 +0100)]
timedated: handle UTC specially, when generating /etc/localtime

(cherry picked from commit 9193af0f059538f4e5ca06502a998e9cc02819a1)

6 years agotime-util: treat /etc/localtime missing as UTC
Lennart Poettering [Wed, 13 Nov 2019 09:32:26 +0000 (10:32 +0100)]
time-util: treat /etc/localtime missing as UTC

(cherry picked from commit bc9ecd484f1ebfe0de8b567c90f6cd867fbd5894)

6 years agobpf: fix off-by-one in class whitelisting
Zbigniew Jędrzejewski-Szmek [Sun, 10 Nov 2019 12:32:36 +0000 (13:32 +0100)]
bpf: fix off-by-one in class whitelisting

We would jump one insn too many, landing in the middle of the subsequent block.

(cherry picked from commit a72a5326a47733f057d1bea1ddb319b779165f8d)

6 years agobpf: fix device type filter
Zbigniew Jędrzejewski-Szmek [Sun, 10 Nov 2019 12:13:31 +0000 (13:13 +0100)]
bpf: fix device type filter

On big endian arches, we were taking the wrong half-word, so the check
was giving bogus results.

https://bugzilla.redhat.com/show_bug.cgi?id=1769148.
(cherry picked from commit 415fe5ec7d38db5e8e0b97c68e462734f543ad17)

6 years agocore: constify bpf program arrays
Zbigniew Jędrzejewski-Szmek [Fri, 8 Nov 2019 07:55:54 +0000 (08:55 +0100)]
core: constify bpf program arrays

In cases where the programs were modified after being initially declared,
reorder operations so that the declaration is already in final form.

(cherry picked from commit 2899aac46a8d8d5cf1aa5cbf04f755ef7b9f9643)

6 years agorun: propagate return code/status from the child
Zbigniew Jędrzejewski-Szmek [Tue, 29 Oct 2019 17:07:07 +0000 (18:07 +0100)]
run: propagate return code/status from the child

Fixes #13756. We were returning things that didn't make much sense:
we would always use the exit_code value as the exit code. But it sometimes
contains a exit code from the process, and sometimes the number of a signal
that was used to kill the process. We would also ignore SuccessExitStatus=
and in general whether systemd thinks the service exited successfully
(hence the issue in #13756, where systemd would return success/SIGTERM,
but we'd just look at the SIGTERM part.)

If we are doing --wait, let's always propagate the exit code/status from
the child.

While at it, make the documentation useful.

(cherry picked from commit 7f3614e5479446bbd5a2bdf6aed4962e8d803e35)

6 years agoudevd: fix crash when workers time out after exit is signal caught
Martin Wilck [Tue, 12 Nov 2019 15:43:42 +0000 (16:43 +0100)]
udevd: fix crash when workers time out after exit is signal caught

If udevd receives an exit signal, it releases its reference on the udev
monitor in manager_exit(). If at this time a worker is hanging, and if
the event timeout for this worker expires before udevd exits, udevd
crashes in on_sigchld()->udev_monitor_send_device(), because the monitor
has already been freed.

Fix this by releasing the main process's monitor ref later, in
manager_free().

(cherry picked from commit 7b6596d7489421842af854ed16333ea747879732)

6 years agoudev: ignore error caused by device disconnection
Yu Watanabe [Tue, 12 Nov 2019 05:58:25 +0000 (14:58 +0900)]
udev: ignore error caused by device disconnection

During an add or change event, the device may be disconnected.

Fixes #13976.

(cherry picked from commit b64b83d13eedfdfc616c16c4a108ef28bf6d3b33)

6 years agoudev: fix error code in the log message
Yu Watanabe [Tue, 12 Nov 2019 05:58:19 +0000 (14:58 +0900)]
udev: fix error code in the log message

(cherry picked from commit ffdc9c891f00f79aa7df3ac25ad141db74686fbe)

6 years agoudev: ignore ENOENT when chmod_and_chown() device node
Yu Watanabe [Tue, 12 Nov 2019 05:57:48 +0000 (14:57 +0900)]
udev: ignore ENOENT when chmod_and_chown() device node

(cherry picked from commit 4b613ec212bfd06fd9d9487bd37b0791fa6dff9e)

6 years agoudev: do not append newline when write attributes
Yu Watanabe [Sun, 10 Nov 2019 05:42:55 +0000 (14:42 +0900)]
udev: do not append newline when write attributes

Before 25de7aa7b90c23d33ea50ada1e50c5834a414237, the content is written
by `fprintf()` without new line. So WRITE_STRING_FILE_AVOID_NEWLINE flag
is necessary.

Fixes #13985.

(cherry picked from commit a566ed2c82d81cc6416fe0da0a14f6d5fe5d83b4)

6 years agotime-util: uniquify timezone list, in case UTC is listed in timezone1970.tab, too
Lennart Poettering [Mon, 11 Nov 2019 15:56:31 +0000 (16:56 +0100)]
time-util: uniquify timezone list, in case UTC is listed in timezone1970.tab, too

(cherry picked from commit 55fd6dca071d3a83da31d2c5d106adba0a380f8c)

6 years agotime-util: always accept UTC as valid timezone
Lennart Poettering [Mon, 11 Nov 2019 15:53:52 +0000 (16:53 +0100)]
time-util: always accept UTC as valid timezone

We already handle it specially in get_timezones(), hence we should OK it
here too, even if the timezone file doesn't actually exist.

Prompted by:

https://serverfault.com/questions/991172/invalid-time-zone-utc

(Yes, Ubuntu should install the UTC timezone data unconditionally: it
should not be an option, even if all other timezone data is excluded,
but since it's our business to validate user input but not out business
to validate distros, let's just accept "UTC" unconditionally, it's magic
after all)

(cherry picked from commit e8b9e9c4705b4bc157ff460371387339977f233b)

6 years agoseccomp: add all *time64 syscalls
Zbigniew Jędrzejewski-Szmek [Fri, 8 Nov 2019 13:00:10 +0000 (14:00 +0100)]
seccomp: add all *time64 syscalls

From https://bugzilla.redhat.com/show_bug.cgi?id=1770154:
> utime is an obsolete system call. The current kernel interface is
> utimensat_time64. New 32-bit architectures do not even provide the utime
> system call.

Also add all other *time64 syscalls listed in
https://fedora.juszkiewicz.com.pl/syscalls.html.

(cherry picked from commit 6ca677106992321326427c89a40e1c9673a499b2)

6 years agolibblkid: open device in nonblock mode.
Michal Suchanek [Mon, 4 Nov 2019 20:23:15 +0000 (21:23 +0100)]
libblkid: open device in nonblock mode.

When autoclose is set (kernel default but many distributions reverse the
setting) opening a CD-rom device causes the tray to close.

The function of blkid is to report the current state of the device and
not to change it. Hence it should use O_NONBLOCK when opening the
device to avoid closing a CD-rom tray.

blkid is used liberally in scripts so it can potentially interfere with
the user operating the CD-rom hardware.

[kzak@redhat.com: add O_NONBLOCK also to:
                  - wipefs
                  - blkid_new_probe_from_filename()
                  - blkid_evaluate_tag()]

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
(cherry picked from commit 39f5af25982d8b0244000e92a9d0e0e6557d0e17)
(cherry picked from commit 581e2d96fccde1d367ead9f12fadf4a1ea6affe3)

6 years agoman: describe ordering in case of Conflicts=
Zbigniew Jędrzejewski-Szmek [Wed, 6 Nov 2019 12:42:13 +0000 (13:42 +0100)]
man: describe ordering in case of Conflicts=

Fixes #13421.

(cherry picked from commit 38c432b37c1db7b02f9d6bd7a864a7aa88571441)

6 years agoman: put description of Wants= above Requires=
Zbigniew Jędrzejewski-Szmek [Wed, 6 Nov 2019 12:26:29 +0000 (13:26 +0100)]
man: put description of Wants= above Requires=

We want users to use Wants, but we'd describe Requires first and ask users to
look for Wants instead. While at it, let's split the wall of text into sensible
paragraphs: syntax first, followed by semantics and longer description, and
finally hints and comparison to other configuration items last.

(cherry picked from commit d19cd71a8a6dca4565d7d1c8766127b70c10ebe0)

6 years agomeson: remove strange dep that causes meson to enter infinite loop
Zbigniew Jędrzejewski-Szmek [Wed, 6 Nov 2019 11:44:39 +0000 (12:44 +0100)]
meson: remove strange dep that causes meson to enter infinite loop

The value is obviously bogus, but didn't seem to cause problems so far.
With meson-0.52.0, it causes a hang. The number of aliases is always rather
small (usually just one or two, possibly up to a dozen in a few cases), so
even if this causes some looping, it is strange that it has such a huge impact.
But let's just remove it.

Fixes #13742.

Tested with meson-0.52.0-1.module_f31+6771+f5d842eb.noarch,
meson-0.51.1-1.fc29.noarch.

(cherry picked from commit af336643a01d0b210b18312c253a50594ba54b0a)

6 years agoman: fix option typo in pam_systemd man page
Dominique Martinet [Wed, 6 Nov 2019 06:32:17 +0000 (07:32 +0100)]
man: fix option typo in pam_systemd man page

The session= option does not exist, XDG_SESSION_TYPE overrides the type=
option.

(cherry picked from commit 98647fa0faaff21b53f8a01b9804fc0669fb6d19)

6 years agoman: save pull-raw example file without underscores
Anita Zhang [Wed, 6 Nov 2019 00:04:27 +0000 (16:04 -0800)]
man: save pull-raw example file without underscores

Destination file needs to be a valid hostname and underscores
are not valid hostname characters.

Closes #13542

(cherry picked from commit b12a67ae145ce01d3dc97fc76fed8c1698125dc6)

6 years agoman: small grammatical/word choice fixes to crypttab man page
Anita Zhang [Wed, 6 Nov 2019 00:20:42 +0000 (16:20 -0800)]
man: small grammatical/word choice fixes to crypttab man page

Closes #13608

(cherry picked from commit 7792d9cdd484dcd8552cce0ea778eb09ed7fbc10)

6 years agoshared/format-table: disable ellipsization when piped
Zbigniew Jędrzejewski-Szmek [Mon, 4 Nov 2019 13:59:31 +0000 (14:59 +0100)]
shared/format-table: disable ellipsization when piped

Fixes #13461.

Before:
$ systemd-inhibit --no-pager
WHO            UID  USER    PID   COMM           WHAT                                  WHY          MODE
ModemManager   0    root    1093  ModemManager   sleep                                 ModemManage… delay
NetworkManager 0    root    1400  NetworkManager sleep                                 NetworkMana… delay
UPower         0    root    5141  upowerd        sleep                                 Pause devic… delay
zbyszek        1000 zbyszek 10036 gsd-power      handle-lid-switch                     External mo… block
zbyszek        1000 zbyszek 10035 gsd-media-keys handle-power-key:handle-suspend-key:… GNOME handl… block
zbyszek        1000 zbyszek 10035 gsd-media-keys sleep                                 GNOME handl… delay
zbyszek        1000 zbyszek 10036 gsd-power      sleep                                 GNOME needs… delay

7 inhibitors listed.
$ systemd-inhibit --no-pager|grep suspend
$ systemd-inhibit --no-pager|cat
WHO            UID  USER    PID   COMM           WHAT                WHY   MODE
ModemManager   0    root    1093  ModemManager   sleep               Mode… delay
NetworkManager 0    root    1400  NetworkManager sleep               Netw… delay
UPower         0    root    5141  upowerd        sleep               Paus… delay
zbyszek        1000 zbyszek 10036 gsd-power      handle-lid-switch   Exte… block
zbyszek        1000 zbyszek 10035 gsd-media-keys handle-power-key:h… GNOM… block
zbyszek        1000 zbyszek 10035 gsd-media-keys sleep               GNOM… delay
zbyszek        1000 zbyszek 10036 gsd-power      sleep               GNOM… delay

After:
$ build/systemd-inhibit --no-pager
(same as above)

$ build/systemd-inhibit --no-pager|grep suspend
zbyszek        1000 zbyszek 10035 gsd-media-keys handle-power-key:handle-suspend-key:handle-hibernate-key GNOME handling keypresses                                   block
$ build/systemd-inhibit --no-pager|cat
WHO            UID  USER    PID   COMM           WHAT                                                     WHY                                                         MODE
ModemManager   0    root    1093  ModemManager   sleep                                                    ModemManager needs to reset devices                         delay
NetworkManager 0    root    1400  NetworkManager sleep                                                    NetworkManager needs to turn off networks                   delay
UPower         0    root    5141  upowerd        sleep                                                    Pause device polling                                        delay
zbyszek        1000 zbyszek 10036 gsd-power      handle-lid-switch                                        External monitor attached or configuration changed recently block
zbyszek        1000 zbyszek 10035 gsd-media-keys handle-power-key:handle-suspend-key:handle-hibernate-key GNOME handling keypresses                                   block
zbyszek        1000 zbyszek 10035 gsd-media-keys sleep                                                    GNOME handling keypresses                                   delay
zbyszek        1000 zbyszek 10036 gsd-power      sleep                                                    GNOME needs to lock the screen                              delay

7 inhibitors listed.

Note that this affect all tools that use format-table.c: machinectl, busctl,
loginctl, systemd-analyze, networkctl, portablectl.

(cherry picked from commit 0db41a8f1f8eda49ce60e7efa23d17a5e24673e3)

6 years agosd-device-enumerator: do not return error when a device is removed
Yu Watanabe [Tue, 5 Nov 2019 14:02:31 +0000 (23:02 +0900)]
sd-device-enumerator: do not return error when a device is removed

Fixes #13814.

(cherry picked from commit 3126d64e5f04cd39033f8c5055e80440b8680d86)

6 years agobootctl: create leading dirs when "bootctl random-seed" is called if needed
Lennart Poettering [Mon, 4 Nov 2019 13:25:57 +0000 (14:25 +0100)]
bootctl: create leading dirs when "bootctl random-seed" is called if needed

Prompted by: #13603

(cherry picked from commit a4a55e9ace3e97ee35c89bb2964330cba69e4edb)

6 years agocore, job: fix breakage of ordering dependencies by systemctl reload command
HATAYAMA Daisuke [Mon, 28 Oct 2019 10:35:24 +0000 (19:35 +0900)]
core, job: fix breakage of ordering dependencies by systemctl reload command

Currently, systemctl reload command breaks ordering dependencies if it's
executed when its target service unit is in activating state.

For example, prepare A.service, B.service and C.target as follows:

    # systemctl cat A.service B.service C.target
    # /etc/systemd/system/A.service
    [Unit]
    Description=A

    [Service]
    Type=oneshot
    ExecStart=/usr/bin/echo A1
    ExecStart=/usr/bin/sleep 60
    ExecStart=/usr/bin/echo A2
    ExecReload=/usr/bin/echo A reloaded
    RemainAfterExit=yes

    # /etc/systemd/system/B.service
    [Unit]
    Description=B
    After=A.service

    [Service]
    Type=oneshot
    ExecStart=/usr/bin/echo B
    RemainAfterExit=yes

    # /etc/systemd/system/C.target
    [Unit]
    Description=C
    Wants=A.service B.service

Start them.

    # systemctl daemon-reload
    # systemctl start C.target

Then, we have:

    # LANG=C journalctl --no-pager -u A.service -u B.service -u C.target -b
    -- Logs begin at Mon 2019-09-09 00:25:06 EDT, end at Thu 2019-10-24 22:28:47 EDT. --
    Oct 24 22:27:47 localhost.localdomain systemd[1]: Starting A...
    Oct 24 22:27:47 localhost.localdomain systemd[1]: A.service: Child 967 belongs to A.service.
    Oct 24 22:27:47 localhost.localdomain systemd[1]: A.service: Main process exited, code=exited, status=0/SUCCESS
    Oct 24 22:27:47 localhost.localdomain systemd[1]: A.service: Running next main command for state start.
    Oct 24 22:27:47 localhost.localdomain systemd[1]: A.service: Passing 0 fds to service
    Oct 24 22:27:47 localhost.localdomain systemd[1]: A.service: About to execute: /usr/bin/sleep 60
    Oct 24 22:27:47 localhost.localdomain systemd[1]: A.service: Forked /usr/bin/sleep as 968
    Oct 24 22:27:47 localhost.localdomain systemd[968]: A.service: Executing: /usr/bin/sleep 60
    Oct 24 22:27:52 localhost.localdomain systemd[1]: A.service: Trying to enqueue job A.service/reload/replace
    Oct 24 22:27:52 localhost.localdomain systemd[1]: A.service: Merged into running job, re-running: A.service/reload as 1288
    Oct 24 22:27:52 localhost.localdomain systemd[1]: A.service: Enqueued job A.service/reload as 1288
    Oct 24 22:27:52 localhost.localdomain systemd[1]: A.service: Unit cannot be reloaded because it is inactive.
    Oct 24 22:27:52 localhost.localdomain systemd[1]: A.service: Job 1288 A.service/reload finished, result=invalid
    Oct 24 22:27:52 localhost.localdomain systemd[1]: B.service: Passing 0 fds to service
    Oct 24 22:27:52 localhost.localdomain systemd[1]: B.service: About to execute: /usr/bin/echo B
    Oct 24 22:27:52 localhost.localdomain systemd[1]: B.service: Forked /usr/bin/echo as 970
    Oct 24 22:27:52 localhost.localdomain systemd[970]: B.service: Executing: /usr/bin/echo B
    Oct 24 22:27:52 localhost.localdomain systemd[1]: B.service: Failed to send unit change signal for B.service: Connection reset by peer
    Oct 24 22:27:52 localhost.localdomain systemd[1]: B.service: Changed dead -> start
    Oct 24 22:27:52 localhost.localdomain systemd[1]: Starting B...
    Oct 24 22:27:52 localhost.localdomain echo[970]: B
    Oct 24 22:27:52 localhost.localdomain systemd[1]: B.service: Child 970 belongs to B.service.
    Oct 24 22:27:52 localhost.localdomain systemd[1]: B.service: Main process exited, code=exited, status=0/SUCCESS
    Oct 24 22:27:52 localhost.localdomain systemd[1]: B.service: Changed start -> exited
    Oct 24 22:27:52 localhost.localdomain systemd[1]: B.service: Job 1371 B.service/start finished, result=done
    Oct 24 22:27:52 localhost.localdomain systemd[1]: Started B.
    Oct 24 22:27:52 localhost.localdomain systemd[1]: C.target: Job 1287 C.target/start finished, result=done
    Oct 24 22:27:52 localhost.localdomain systemd[1]: Reached target C.
    Oct 24 22:27:52 localhost.localdomain systemd[1]: C.target: Failed to send unit change signal for C.target: Connection reset by peer
    Oct 24 22:28:47 localhost.localdomain systemd[1]: A.service: Child 968 belongs to A.service.
    Oct 24 22:28:47 localhost.localdomain systemd[1]: A.service: Main process exited, code=exited, status=0/SUCCESS
    Oct 24 22:28:47 localhost.localdomain systemd[1]: A.service: Running next main command for state start.
    Oct 24 22:28:47 localhost.localdomain systemd[1]: A.service: Passing 0 fds to service
    Oct 24 22:28:47 localhost.localdomain systemd[1]: A.service: About to execute: /usr/bin/echo A2
    Oct 24 22:28:47 localhost.localdomain systemd[1]: A.service: Forked /usr/bin/echo as 972
    Oct 24 22:28:47 localhost.localdomain systemd[972]: A.service: Executing: /usr/bin/echo A2
    Oct 24 22:28:47 localhost.localdomain echo[972]: A2
    Oct 24 22:28:47 localhost.localdomain systemd[1]: A.service: Child 972 belongs to A.service.
    Oct 24 22:28:47 localhost.localdomain systemd[1]: A.service: Main process exited, code=exited, status=0/SUCCESS
    Oct 24 22:28:47 localhost.localdomain systemd[1]: A.service: Changed start -> exited

The issue occurs not only in reload command, i.e.:

  - reload
  - try-restart
  - reload-or-restart
  - reload-or-try-restart commands

The cause of this issue is that job_type_collapse() doesn't take care of the
activating state.

Fixes: #10464
(cherry picked from commit d1559793df555212271e490a4a72f55826caf5b4)

6 years agojournalctl: allow running vacuum on remote journals, too
Jan Kundrát [Sat, 2 Nov 2019 15:42:01 +0000 (16:42 +0100)]
journalctl: allow running vacuum on remote journals, too

Right now the `systemd-journal-remote` service does not constrain its
resource usage (I just run out of space on my 100GB partition, for
example). This patch does not change that, but it at least makes it
possible to run something like:

  journalctl --directory /var/log/journal/remote --rotate --vacuum-size=90G

fixes #2376

Co-authored-by: Mike Auty <ikelos@gentoo.org>
(cherry picked from commit c488660e6edb3c1375ab62514a8df035c3d712bf)

6 years agoallow an empty DefaultInstance= in configuration files
Jérémy Rosen [Fri, 1 Nov 2019 23:03:54 +0000 (00:03 +0100)]
allow an empty DefaultInstance= in configuration files

It is currently possible to override the DefaultInstance via drop-ins but
not remove it completely. Allow to do that by specifying an empty
DefaultInstance=

(cherry picked from commit b5395600a0b0a4e01f3f50a860547060290aca34)

6 years agoman/systemd.net-naming-scheme: fix typo
Jan Synacek [Mon, 4 Nov 2019 09:43:05 +0000 (10:43 +0100)]
man/systemd.net-naming-scheme: fix typo

(cherry picked from commit ce6304f78e57f2038f62cb923f48ad4f11e71720)

6 years agonspawn: respect quiet on capabilities warning
Justin Trudell [Fri, 1 Nov 2019 19:00:16 +0000 (12:00 -0700)]
nspawn: respect quiet on capabilities warning

(cherry picked from commit 0ccdaa79ca69a40e4ad8b3e63b1236734751452e)

6 years agonspawn: mangle slice name
Lennart Poettering [Fri, 1 Nov 2019 10:21:05 +0000 (11:21 +0100)]
nspawn: mangle slice name

It's user-facing, parsed from the command line and we typically mangle
in these cases, let's do so here too. (In particular as the identical
switch for systemd-run already does it.)

(cherry picked from commit 43c3fb4680c8a2f8f417a71d7fbedde2db30f0c8)

6 years agomkosi: Find hostname command on Arch Linux
Kevin Kuehler [Thu, 31 Oct 2019 22:41:32 +0000 (15:41 -0700)]
mkosi: Find hostname command on Arch Linux

exec-specifier.service: Executing: /usr/bin/sh -c 'test mkosi-7d5e81c7b81c42338d060a6b98edd44a = $(hostname)'
/usr/bin/sh: hostname: command not found
/usr/bin/sh: line 0: test: mkosi-7d5e81c7b81c42338d060a6b98edd44a: unary operator expected
Received SIGCHLD from PID 7389 (sh).
Child 7389 (sh) died (code=exited, status=2/INVALIDARGUMENT)

gettext provides the hostname binary, but puts it in
/usr/lib/gettext/hostname, which is not part of the default $PATH. Using
inetutils instead puts the binary in /usr/bin/hostname.

(cherry picked from commit b9dc511954b080d8b05a44f1758be6dbb4078852)

6 years agoFix mkosi on Arch Linux
Kevin Kuehler [Thu, 31 Oct 2019 09:32:23 +0000 (02:32 -0700)]
Fix mkosi on Arch Linux

/* test compression */
XZ compression finished (38280 -> 11756 bytes, 30.7%)
sh: diff: command not found
Assertion 'system(cmd) == 0' failed at src/journal/test-compress.c:198,
function test_compress_stream(). Aborting.

The journal compression test shells out to diff, so include diffutils as
a BuildPackage on Arch.

Remaining fixes in https://github.com/systemd/mkosi/pull/377

(cherry picked from commit 9e05564006ada86f6e2777506a5e2b45308a4e5c)

6 years agoUpdate to Fedora31
Jóhann B. Guðmundsson [Thu, 31 Oct 2019 14:51:41 +0000 (14:51 +0000)]
Update to Fedora31

(cherry picked from commit 294eeed1443c88b2cf54a1e02c66697cb65d7aec)

6 years agosd-boot: Silence compiler warning when building with -O2
Jan Janssen [Wed, 30 Oct 2019 16:44:59 +0000 (17:44 +0100)]
sd-boot: Silence compiler warning when building with -O2

(cherry picked from commit d9690d8fe9016783ef164c9a006e30987c359c6f)

6 years agosd-boot: Don't loudly complain if RNG protocol isn't available
Jan Janssen [Sun, 15 Sep 2019 14:12:03 +0000 (16:12 +0200)]
sd-boot: Don't loudly complain if RNG protocol isn't available

Fixes #13503

(cherry picked from commit 391719682bf68134b01cf422eb92e3ec4686fa7b)

6 years agosd-boot: Only disable optimization on debug builds
Jan Janssen [Sun, 15 Sep 2019 13:56:30 +0000 (15:56 +0200)]
sd-boot: Only disable optimization on debug builds

(cherry picked from commit 9ea4d81c12e8a3f7ee081f9eac7e77256f43b7b0)

6 years agomeson: correct man page deps
Lennart Poettering [Wed, 30 Oct 2019 17:55:45 +0000 (18:55 +0100)]
meson: correct man page deps

(cherry picked from commit 20bae8b94d34d75fe2572738e466abc37563bf88)

6 years agosd-event: don't invalidate source type on disconnect
Lennart Poettering [Wed, 30 Oct 2019 15:37:42 +0000 (16:37 +0100)]
sd-event: don't invalidate source type on disconnect

This fixes fd closing if fd ownership is requested.

(cherry picked from commit f59825595182d70b9ead238d1e885d0db99cc201)

6 years agoanalyze: fix minor memleak
Lennart Poettering [Fri, 25 Oct 2019 14:05:11 +0000 (16:05 +0200)]
analyze: fix minor memleak

(cherry picked from commit 81610e9609c966a33dcff15a4f3b173aa8f07e4b)

6 years agoanalyze: sort list of unknown syscalls kernel implements
Lennart Poettering [Fri, 25 Oct 2019 14:05:35 +0000 (16:05 +0200)]
analyze: sort list of unknown syscalls kernel implements

(cherry picked from commit ea334dc328c9bbba68098d2f779293528a123c23)

6 years agoseccomp: add new Linux 5.3 syscalls to syscall filter lists
Lennart Poettering [Wed, 30 Oct 2019 10:11:05 +0000 (11:11 +0100)]
seccomp: add new Linux 5.3 syscalls to syscall filter lists

Many syscalls added and all fit nicely into existing groups, hence lets
add them there.

(cherry picked from commit 9e486265716963439fb0fd7f2a97abf109f24f75)

6 years agoresolved: check for IP in certificate when using DoT with GnuTLS
Iwan Timmer [Tue, 29 Oct 2019 19:32:18 +0000 (20:32 +0100)]
resolved: check for IP in certificate when using DoT with GnuTLS

Validate the IP address in the certificate for DNS-over-TLS in strict mode when GnuTLS is used. As this is not yet the case in contrast to the documentation.

(cherry picked from commit 7f2f4faced3fda47e6b76ab73cde747cc20cf8b8)

6 years agoresolved: require at least version 3.6.0 of GnuTLS for DNS-over-TLS
Iwan Timmer [Tue, 29 Oct 2019 19:26:05 +0000 (20:26 +0100)]
resolved: require at least version 3.6.0 of GnuTLS for DNS-over-TLS

Increase the required version to ensure TLS 1.3 is always supported when using GnuTLS for DNS-over-TLS and allow further changes to use recent API additions.

(cherry picked from commit 38e053c58fa139e0f546f327b5d8ce3db7cf1647)

6 years agocoverity: replace python with jq
Evgeny Vereshchagin [Tue, 29 Oct 2019 19:07:15 +0000 (19:07 +0000)]
coverity: replace python with jq

Judging by https://travis-ci.org/systemd/systemd/jobs/604425785
(where the script failed with "tools/coverity.sh: line 45: python: command not found")
python-unversioned-command is no longer installed by default with python2.
Given that it's not the first time python has vanished and it's not clear
what exactly should be installed to make sure it's there, let's just use jq instead.

(cherry picked from commit 738606e45251b73950a52e62e7186fe4516a018a)

6 years agonetwork-generator: Add missing help for --root
David Pedersen [Mon, 28 Oct 2019 17:47:14 +0000 (18:47 +0100)]
network-generator: Add missing help for --root

(cherry picked from commit e6d6645517759f5eb419f6754bd4c12dfa151b21)

6 years agomodules-load: do not fail service if modules are not present
Zbigniew Jędrzejewski-Szmek [Sun, 27 Oct 2019 09:00:31 +0000 (10:00 +0100)]
modules-load: do not fail service if modules are not present

It is pretty common for the service to fail in the initramfs (for example
because certain modules have not been copied over or haven't been built yet in
case of dkms modules). This seems to be more trouble than it is worth. Let's
change the service to simply log any missing modules at error level, but not
fail the whole service.

https://bugzilla.redhat.com/show_bug.cgi?id=1254340
(cherry picked from commit fec837e96e902c041adae552aa3101b8a8132869)

6 years agopid1: order .automount units after local-fs-pre.target
Zbigniew Jędrzejewski-Szmek [Fri, 25 Oct 2019 14:57:37 +0000 (16:57 +0200)]
pid1: order .automount units after local-fs-pre.target

From the bug:
> According to the documentation of systemd.automount if the automoint point is
> automagically created if it doesn't exist yet. This ofcourse means the
> filesystem underneath has to be writable, which for / means not only does
> -.mount need to be started but also systemd-remount-fs.service has to be run,
> which isn't guaranteed by the default automount dependencies.
>
> For .mount units there is an automatic default After= dependency on
> local-fs-pre.target, would probably make sense to do the same for automount
> units to avoid it failing on the corner-case where it has to create directory.

Fixes #13306.

(cherry picked from commit 9432f882a53e7152a75007fd7f001f9a74f2a0d7)

6 years agoshared/install: failing with -ELOOP can be due to the use of an alias in install_error()
Franck Bui [Tue, 24 Sep 2019 16:54:15 +0000 (18:54 +0200)]
shared/install: failing with -ELOOP can be due to the use of an alias in install_error()

-ELOOP can happen also when enabling an alias name (which is admittedly useless
since the unit it belongs to was already enabled) so let's mention this
possibility when reporting the corresponding error.

(cherry picked from commit 22683674716fd0e5b016ce5a7d8fd90df5f9f9e7)

6 years agoshared/install: fix error codes returned by install_context_apply()
Franck Bui [Tue, 24 Sep 2019 16:33:54 +0000 (18:33 +0200)]
shared/install: fix error codes returned by install_context_apply()

(cherry picked from commit 56a4ce2417ff74f82a48e3a5c6e36edad8d4bc6c)

6 years agoman: alias names can't be used with enable command
Franck Bui [Tue, 24 Sep 2019 07:16:49 +0000 (09:16 +0200)]
man: alias names can't be used with enable command

(cherry picked from commit faf205de3ba9a11b0ba17682123d7f3fedc7da24)

6 years agoresolved: set stream type during DnsStream creation
Dan Streetman [Wed, 23 Oct 2019 18:47:59 +0000 (14:47 -0400)]
resolved: set stream type during DnsStream creation

The DnsStreamType was added to track different types of DNS TCP streams,
instead of refcounting all of them together.  However, the stream type was
not actually set into the stream->type field, so while the reference count
was correctly incremented per-stream-type, the reference count was always
decremented in the cleanup function for stream type 0, leading to
underflow for the type 0 stream (unsigned) refcount, and preventing new
type 0 streams from being created.

Since type 0 is DNS_STREAM_LOOKUP, which is used to communicate with
upstream nameservers, once the refcount underflows the stub resolver
no longer is able to successfully fall back to TCP upstream lookups
for any truncated UDP packets.

This was found because lookups of A records with a large number of
addresses, too much to fit into a single 512 byte DNS UDP reply,
were causing getaddrinfo() to fall back to TCP and trigger this bug,
which then caused the TCP fallback for later large record lookups
to fail with 'connection timed out; no servers could be reached'.

The stream type was introduced in commit:
652ba568c6624bf40d735645f029d83d21bdeaa6

(cherry picked from commit 1c089741d3b56ab096c5c401089f68b293b5fa38)

6 years agosd-device: allow sd_device_get_devtype to be called with NULL arg and do not assert
Zbigniew Jędrzejewski-Szmek [Wed, 23 Oct 2019 15:49:03 +0000 (17:49 +0200)]
sd-device: allow sd_device_get_devtype to be called with NULL arg and do not assert

We shouldn't call assert() on user-specified arguments in public functions.
While at it, let's return 1 if the type exists, and 0 otherwise.

(cherry picked from commit 730b76bd2cd5f0866baa738ae283e3b62544a28f)

6 years agoRemove unused plymouth_running() function
Zbigniew Jędrzejewski-Szmek [Wed, 23 Oct 2019 20:56:24 +0000 (22:56 +0200)]
Remove unused plymouth_running() function

(cherry picked from commit 8a2c82ac882f4adfb0f7bdc039c84e880ddd689a)

6 years agomachine-id-setup: avoid unexpected aborting
Chen Qi [Thu, 24 Oct 2019 09:40:05 +0000 (17:40 +0800)]
machine-id-setup: avoid unexpected aborting

Code should not be reached 'Unhandled option' at src/machine-id-setup/machine-id-setup-main.c:97, function parse_argv(). Aborting.
Aborted

This behaviour is not good and will confuse user.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
(cherry picked from commit 4a434023d2380ef04492ae3ca41781738ba4d133)

6 years agotest-socket-util: avoid writing past the defined buffer
Zbigniew Jędrzejewski-Szmek [Thu, 24 Oct 2019 07:15:29 +0000 (09:15 +0200)]
test-socket-util: avoid writing past the defined buffer

.sun_path has 108 bytes, and we'd write a string of 108 bytes + NUL.
I added this test, but I don't know what it was supposed to test. Let's
just remove.

Fixes #13713. CID#1405854.

(cherry picked from commit 58ce85f6a17b6db03265e6a974120b18d1c0855a)

6 years agotest: drop duplicated 's'
Yu Watanabe [Thu, 24 Oct 2019 02:08:48 +0000 (11:08 +0900)]
test: drop duplicated 's'

This fixes the following log message
```
Container TEST-07-ISSUE-1981 terminated by signal KILL.
E: test timed out after 30s s
```

(cherry picked from commit 235ecb6d75f00384b3f42f449c769340e13fbd0b)

6 years agonspawn: fix handling of --console=help
Zbigniew Jędrzejewski-Szmek [Wed, 23 Oct 2019 07:20:46 +0000 (09:20 +0200)]
nspawn: fix handling of --console=help

We shouldn't continue to run the container after printing help.

(cherry picked from commit dce66ffedbd4e72c2a1a35a55dc26c0e1029e8e3)