]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
6 years agocgroup: assume the use of v1 when all the preceding checks fail (#7366)
Evgeny Vereshchagin [Fri, 17 Nov 2017 08:47:49 +0000 (11:47 +0300)] 
cgroup: assume the use of v1 when all the preceding checks fail (#7366)

This patch restores the default that was changed in 2977724b09eb997fc8,
making the tools depending on it work again.

Closes: #6477 and https://github.com/lxc/lxc/issues/1669
6 years agoMerge pull request #7314 from poettering/gc-mode
Lennart Poettering [Thu, 16 Nov 2017 15:32:36 +0000 (16:32 +0100)] 
Merge pull request #7314 from poettering/gc-mode

add new CollectMode= unit file setting for tweaking the unit garbage collection logic

6 years agoupdate TODO 7314/head
Lennart Poettering [Mon, 13 Nov 2017 16:21:27 +0000 (17:21 +0100)] 
update TODO

6 years agorun: add "-G" as shortcut for "--property=CollectMode=inactive-or-failed"
Lennart Poettering [Mon, 13 Nov 2017 16:17:53 +0000 (17:17 +0100)] 
run: add "-G" as shortcut for "--property=CollectMode=inactive-or-failed"

This option is likely to be very useful for systemd-run invocations,
hence let's add a shortcut for it.

With this new concepts it's now very easy to put together systemd-run
invocations that leave zero artifacts in the system, including when they
fail.

6 years agocore: add a new unit file setting CollectMode= for tweaking the GC logic
Lennart Poettering [Mon, 13 Nov 2017 16:14:07 +0000 (17:14 +0100)] 
core: add a new unit file setting CollectMode= for tweaking the GC logic

Right now, the option only takes one of two possible values "inactive"
or "inactive-or-failed", the former being the default, and exposing same
behaviour as the status quo ante. If set to "inactive-or-failed" units
may be collected by the GC logic when in the "failed" state too.

This logic should be a nicer alternative to using the "-" modifier for
ExecStart= and friends, as the exit data is collected and logged about
and only removed when the GC comes along. This should be useful in
particular for per-connection socket-activated services, as well as
"systemd-run" command lines that shall leave no artifacts in the
system.

I was thinking about whether to expose this as a boolean, but opted for
an enum instead, as I have the suspicion other tweaks like this might be
a added later on, in which case we extend this setting instead of having
to add yet another one.

Also, let's add some documentation for the GC logic.

6 years agounit: rework a bit how we keep the service fdstore from being destroyed during servic...
Lennart Poettering [Mon, 13 Nov 2017 14:08:49 +0000 (15:08 +0100)] 
unit: rework a bit how we keep the service fdstore from being destroyed during service restart

When preparing for a restart we quickly go through the DEAD/INACTIVE
service state before entering AUTO_RESTART. When doing this, we need to
make sure we don't destroy the FD store. Previously this was done by
checking the failure state of the unit, and keeping the FD store around
when the unit failed, under the assumption that the restart logic will
then get into action.

This is not entirely correct howver, as there might be failure states
that will no result in restarts.

With this commit we slightly alter the logic: a ref counter for the fd
store is added, that is increased right before we handle the restart
logic, and decreased again right-after.

This should ensure that the fdstore lives exactly as long as it needs.

Follow-up for f0bfbfac43b7faa68ef1bb2ad659c191b9ec85d2.

6 years agoMerge pull request #7246 from poettering/journal-extra-fields
Zbigniew Jędrzejewski-Szmek [Thu, 16 Nov 2017 13:24:53 +0000 (14:24 +0100)] 
Merge pull request #7246 from poettering/journal-extra-fields

add new per-unit LogLevelMax= and LogExtraField= setting

6 years agoman: mention how to provision Ubuntu and Tanglu for nspawn (#7359)
Zbigniew Jędrzejewski-Szmek [Thu, 16 Nov 2017 12:40:35 +0000 (13:40 +0100)] 
man: mention how to provision Ubuntu and Tanglu for nspawn (#7359)

Also add urls. Urls are nice.

6 years agotest-unit-file: add test for config_parse_log_extra_fields() 7246/head
Zbigniew Jędrzejewski-Szmek [Tue, 14 Nov 2017 13:58:37 +0000 (14:58 +0100)] 
test-unit-file: add test for config_parse_log_extra_fields()

6 years agoman: document LogFieldMax= and LogExtraFields=
Lennart Poettering [Thu, 2 Nov 2017 18:53:45 +0000 (21:53 +0300)] 
man: document LogFieldMax= and LogExtraFields=

6 years agocore: implement /run/systemd/units/-based path for passing unit info from PID 1 to...
Lennart Poettering [Thu, 2 Nov 2017 18:43:32 +0000 (21:43 +0300)] 
core: implement /run/systemd/units/-based path for passing unit info from PID 1 to journald

And let's make use of it to implement two new unit settings with it:

1. LogLevelMax= is a new per-unit setting that may be used to configure
   log priority filtering: set it to LogLevelMax=notice and only
   messages of level "notice" and lower (i.e. more important) will be
   processed, all others are dropped.

2. LogExtraFields= is a new per-unit setting for configuring per-unit
   journal fields, that are implicitly included in every log record
   generated by the unit's processes. It takes field/value pairs in the
   form of FOO=BAR.

Also, related to this, one exisiting unit setting is ported to this new
facility:

3. The invocation ID is now pulled from /run/systemd/units/ instead of
   cgroupfs xattrs. This substantially relaxes requirements of systemd
   on the kernel version and the privileges it runs with (specifically,
   cgroupfs xattrs are not available in containers, since they are
   stored in kernel memory, and hence are unsafe to permit to lesser
   privileged code).

/run/systemd/units/ is a new directory, which contains a number of files
and symlinks encoding the above information. PID 1 creates and manages
these files, and journald reads them from there.

Note that this is supposed to be a direct path between PID 1 and the
journal only, due to the special runtime environment the journal runs
in. Normally, today we shouldn't introduce new interfaces that (mis-)use
a file system as IPC framework, and instead just an IPC system, but this
is very hard to do between the journal and PID 1, as long as the IPC
system is a subject PID 1 manages, and itself a client to the journal.

This patch cleans up a couple of types used in journal code:
specifically we switch to size_t for a couple of memory-sizing values,
as size_t is the right choice for everything that is memory.

Fixes: #4089
Fixes: #3041
Fixes: #4441
6 years agoman: update SyslogXYZ= documentation a bit
Lennart Poettering [Thu, 2 Nov 2017 18:40:35 +0000 (21:40 +0300)] 
man: update SyslogXYZ= documentation a bit

Let's clarify that these settings only apply to stdout/stderr logging.
Always mention the journal before syslog (as the latter is in most ways
just a legacy alias these days). Always mention the +console cases too.

6 years agoman: rework the discussion of Storage= a bit
Lennart Poettering [Thu, 2 Nov 2017 10:33:01 +0000 (11:33 +0100)] 
man: rework the discussion of Storage= a bit

Most distributions default to persistent storage these days, hence don't
claim otherwise.

6 years agojournald: when logging about dropped messages, include more meta data
Lennart Poettering [Mon, 30 Oct 2017 19:01:50 +0000 (20:01 +0100)] 
journald: when logging about dropped messages, include more meta data

When we drop messages of a unit, we log about. Let's add some structured
data to that. Let's include how many messages we dropped, but more
importantly, let's link up the message we generate to the unit we
dropped the messages from by using the "OBJECT" logic, i.e. by
generating OBJECT_SYSTEMD_UNIT= fields and suchlike, that "journalctl
-u" and friends already look for.

Fixes: #6494
6 years agojournal: reindent field mapping tables
Lennart Poettering [Mon, 30 Oct 2017 18:54:39 +0000 (19:54 +0100)] 
journal: reindent field mapping tables

Let's fix up whitespace so that the tables look nicely aligned.

6 years agojournal: make use of IOVEC_MAKE() where it makes sense
Lennart Poettering [Mon, 30 Oct 2017 18:54:13 +0000 (19:54 +0100)] 
journal: make use of IOVEC_MAKE() where it makes sense

6 years agojournal: move valid_user_field() to journal-util.[ch] and rename it → journal_field_v...
Lennart Poettering [Mon, 30 Oct 2017 18:53:01 +0000 (19:53 +0100)] 
journal: move valid_user_field() to journal-util.[ch] and rename it → journal_field_valid()

Being able to validate journal field names is useful outside of the
journal itself.

6 years agoMerge pull request #7356 from keszybz/cgroup-and-manager-cleanups
Lennart Poettering [Thu, 16 Nov 2017 10:37:20 +0000 (11:37 +0100)] 
Merge pull request #7356 from keszybz/cgroup-and-manager-cleanups

Cgroup and manager cleanups

6 years agoman: fix wrong tag (#7358)
Yu Watanabe [Thu, 16 Nov 2017 10:35:30 +0000 (19:35 +0900)] 
man: fix wrong tag (#7358)

6 years agotmpfiles: when /etc is not fully initialized, some specifiers are expected to be...
Franck Bui [Thu, 16 Nov 2017 10:27:29 +0000 (11:27 +0100)] 
tmpfiles: when /etc is not fully initialized, some specifiers are expected to be unresolvable (#6860)

In chroot environments, /etc might not be fully initialized: /etc/machine-id
can be missing for example. This makes the expansions of affected specifiers
impossible at that time.

These cases should not be considered as errors and such failures shouldn't be
logged at an error level therefore this patch downgrades the level used to
LOG_NOTICE in such cases.

Also this is logged at LOG_NOTICE only the first time and then downgrade to
LOG_DEBUG for the rest. That way, if debugging is enabled we get the full
output, but otherwise we only see only one message.

The expansion of specifiers is now self contained in a dedicated function
instead of being spread all over the place.

6 years agosystemctl: other wayland sessions should inhibit shutdown, like x11 sessions do ...
Alan Jenkins [Thu, 16 Nov 2017 10:02:34 +0000 (10:02 +0000)] 
systemctl: other wayland sessions should inhibit shutdown, like x11 sessions do (#7353)

Update systemctl code to match the manpage for sd_session_get_type().

"wayland" sessions should be treated the same as "x11".  "mir" too, fwiw.

6 years agosd-dhcp6-client: Implement FQDN Option (#7309)
Stefan Agner [Thu, 16 Nov 2017 09:07:07 +0000 (10:07 +0100)] 
sd-dhcp6-client: Implement FQDN Option (#7309)

Implement DHCPv6 option to exchange information about the Fully
Qualified Domain Name (FQDN) according to RFC 4704.

The RFC 4704 describes two models of operations in section 3,
currently only the second model is supported (DHCPv6 server
updates both the AAAA and the PTR RRs).

The existing DHCP Section Options SendHostname and Hostname are
sent as FQDN to the server. According to section 4.2 sending
only parts of its FQDN is allowed.

Fixes #4682.

6 years agosd-dhcp-client: validate hostnames stricter (#7308)
Stefan Agner [Thu, 16 Nov 2017 09:05:44 +0000 (10:05 +0100)] 
sd-dhcp-client: validate hostnames stricter (#7308)

Technically DNS allows any ASCII character to be used in the
domain name. Also the DHCP specification for the FQDN option
(RFC 4702) does not put restriction on labels.

However, hostnames do have stricter requirements and typically
should only use characters from a-z (case insensitve), 0-9 and
minus.

Currently we require hostname/FQDN to be either a hostname or
a valid DNS name. Since dns_name_is_valid() allows any ASCII
characters this allows to specify hostnames which are typically
not valid.

Check hostname/FQDN more strictly and require them to pass both
tests. Specifically this requires the entire FQDN to be below 63.

6 years agoman: document that noauto doesn't affect automount units configured through /etc...
Lennart Poettering [Thu, 16 Nov 2017 03:05:15 +0000 (04:05 +0100)] 
man: document that noauto doesn't affect automount units configured through /etc/fstab (#7350)

Fixes: #6937
6 years agoman: document interaction of --root= and the user/group databases (#7344)
Lennart Poettering [Thu, 16 Nov 2017 03:00:56 +0000 (04:00 +0100)] 
man: document interaction of --root= and the user/group databases (#7344)

Fixes: #7032
6 years agoNEWS: document the systemd-logind IP firewalling incompatibility (#7343)
Lennart Poettering [Thu, 16 Nov 2017 02:57:32 +0000 (03:57 +0100)] 
NEWS: document the systemd-logind IP firewalling incompatibility (#7343)

Fixes: #7074
6 years agoman: document that generators can generate instances+templates and regular unit files...
Lennart Poettering [Thu, 16 Nov 2017 02:37:25 +0000 (03:37 +0100)] 
man: document that generators can generate instances+templates and regular unit files (#7342)

This addition is kept brief on purpose, since in order to write a good
generator users don't really need to grok templating/instantiation.

Fixes: #7257
6 years agoman: document explicitly that network-online.target doesn't track connectivity state...
Lennart Poettering [Thu, 16 Nov 2017 02:26:27 +0000 (03:26 +0100)] 
man: document explicitly that network-online.target doesn't track connectivity state dynamically (#7345)

Fixes: #5909
6 years agocore/manager: just return an error if we fail halfway 7356/head
Zbigniew Jędrzejewski-Szmek [Wed, 15 Nov 2017 09:38:04 +0000 (10:38 +0100)] 
core/manager: just return an error if we fail halfway

We would continue, but still return an error at the end. This isn't useful
because we'd still error-out in main().

Also, add a missing error message when we fail to mkdir.

6 years agocore: fix message about detected memory hierarchy
Zbigniew Jędrzejewski-Szmek [Wed, 15 Nov 2017 09:19:45 +0000 (10:19 +0100)] 
core: fix message about detected memory hierarchy

Just the error check and message were wrong, otherwise the logic was OK.

6 years agotest-cgroup-util: add basic test for cg_all_unified/cg_hybrid_unified/cg_unified_cont...
Zbigniew Jędrzejewski-Szmek [Wed, 15 Nov 2017 09:17:10 +0000 (10:17 +0100)] 
test-cgroup-util: add basic test for cg_all_unified/cg_hybrid_unified/cg_unified_controller

6 years agoutil-lib: add debug messages when checking cgroup layout
Zbigniew Jędrzejewski-Szmek [Wed, 15 Nov 2017 09:04:29 +0000 (10:04 +0100)] 
util-lib: add debug messages when checking cgroup layout

This has become very complex, let's make it a bit easier to diagnose.

6 years agoUse plural DelegateControllers= consistently
Zbigniew Jędrzejewski-Szmek [Tue, 14 Nov 2017 20:29:40 +0000 (21:29 +0100)] 
Use plural DelegateControllers= consistently

6 years agoUpdate TODO
Zbigniew Jędrzejewski-Szmek [Tue, 14 Nov 2017 20:28:43 +0000 (21:28 +0100)] 
Update TODO

6 years agoman/systemd-socket-proxyd: fix unit dependencies in examples (#7340)
Roland Hieber [Wed, 15 Nov 2017 10:51:56 +0000 (11:51 +0100)] 
man/systemd-socket-proxyd: fix unit dependencies in examples (#7340)

This was probably a typo, since depending proxy-to-nginx.service on
itself makes no sense, but depending on the socket does.

Signed-off-by: Roland Hieber <r.hieber@pengutronix.de>
6 years agoMerge pull request #6866 from sourcejedi/set-linger2
Lennart Poettering [Wed, 15 Nov 2017 10:15:15 +0000 (11:15 +0100)] 
Merge pull request #6866 from sourcejedi/set-linger2

logind: fix `loginctl enable-linger`

6 years agopo: specify a glib preset (#7333)
Piotr Drąg [Wed, 15 Nov 2017 06:45:24 +0000 (07:45 +0100)] 
po: specify a glib preset (#7333)

It gives us a list of standard arguments passed to gettext,
see <http://mesonbuild.com/i18n-module.html#i18ngettext>.

6 years agocore: fix bus property logic for RequiresMountsFor= dependencies (#7332)
Lennart Poettering [Tue, 14 Nov 2017 20:50:59 +0000 (21:50 +0100)] 
core: fix bus property logic for RequiresMountsFor= dependencies (#7332)

We get a pointer to a pointer to a Hashmap, instead of just a pointer to
a Hashmap, let's handle that properly.

6 years agoMerge pull request #7313 from keszybz/msgformat
Zbigniew Jędrzejewski-Szmek [Tue, 14 Nov 2017 20:48:42 +0000 (21:48 +0100)] 
Merge pull request #7313 from keszybz/msgformat

i18n: drop intltool use, use meson's merge_file directly

6 years agoudev: net_setup_link: don't error out when we couldn't apply link config (#7328)
Michal Sekletar [Tue, 14 Nov 2017 18:29:37 +0000 (19:29 +0100)] 
udev: net_setup_link: don't error out when we couldn't apply link config (#7328)

It is possible that kernel will reject our netlink message that
configures the link. However, we should always make sure that interface
will be named properly otherwise we can leave interfaces having
unpredictable kernel names. Thus we don't return early and continue to
export name and link file properties.

Suggested-by: Tom Gundersen <teg@jklm.no>
6 years agologind: fix SetLinger to authorize by client's effective User ID 6866/head
Alan Jenkins [Fri, 15 Sep 2017 16:35:02 +0000 (17:35 +0100)] 
logind: fix SetLinger to authorize by client's effective User ID

SetLinger is authorized by the PolicyKit action "set-self-linger", if it is
not passed an explicit UID.

According to comments we were determining the default UID from the client's
session.  However, user processes e.g. which are run from a terminal
emulator do not necessarily belong to a session scope unit.  They may
equally be started from the systemd user manager [1][2].  Actually the
comment was wrong, and it would also have worked for processes
started from the systemd user manager.

Nevertheless it seems to involve fetching "augmented credentials" i.e.
it's using a racy method, so we shouldn't have been authenticating based
on it.

We could change the default UID, but that raises issues especially for
consistency between the methods.  Instead we can just use the clients
effective UID for authorization.

This commit also fixes `loginctl enable-linger $USER` to match the docs
that say it was equivalent to `loginctl enable-linger` (given that $USER
matches the callers user and owner_uid).  Previously, the former would not
have suceeded for unpriviliged users in the default configuration.

[1] It seems the main meaning of per-session scopes is tracking the PAM
login process.  Killing that provokes logind to revoke device access.  Less
circularly, killing it provokes getty to hangup the TTY.

[2] User units may be started with an environment which includes
XDG_SESSION_ID (presuambly GNOME does this?).  Or not.

6 years agologinctl: enable-linger does not need fallback to XDG_SESSION_ID
Alan Jenkins [Mon, 18 Sep 2017 17:04:59 +0000 (18:04 +0100)] 
loginctl: enable-linger does not need fallback to XDG_SESSION_ID

To maintain consistency with `loginctl user-status`, drop the fallback to
XDG_SESSION_ID for `loginctl enable-linger`.  The fallback was unnecessary
and also incorrect: it passed the numeric value of the session identifier
as a UID value.

6 years agologind: comment use of *_get_session()
Alan Jenkins [Sun, 17 Sep 2017 14:49:12 +0000 (15:49 +0100)] 
logind: comment use of *_get_session()

The manpages tell that such calls have quite limited meaning.  logind has
a few in the implementation of what remains of the session concept.

At the same time, logind basically exposes sd_pid_get_session() as public
API.  This is absolutely required, to retain compatability e.g. with Xorg.
But client code will work in more situations if it avoids assuming that it
runs in a session itself.

Its use inside the login session could be replaced with $XDG_SESSION_ID
(which pam_systemd sets).  I don't know whether it would be useful to
change Xorg at this point or not.  But if you were building something new,
you would think about whether you want to support running it in a systemd
service.

Comment these logind API features, acknowledging the reason they exist is
based in history.  I.e. help readers avoid drawing implications from their
existence which apply to history, but not the current general case.

Finally, searching these revealed a call to sd_pid_get_session() in
implementing some types of logind inhibitors.  So these inhibitors don't
work as intended when taken from inside a systemd user service :(.  Comment
this as well, deferring it as ticket #6852.

6 years agologind: more specific error message for unknown users
Alan Jenkins [Tue, 17 Oct 2017 15:03:58 +0000 (16:03 +0100)] 
logind: more specific error message for unknown users

If you try to run `loginctl user-status` on a non-logged in user to see
whether "Linger" is enabled, it doesn't work.

If you're already an expert in logind, the fact that the user is considered
unknown actually tells you the user is not lingering.  So, probably they
they do not have lingering enabled.  I think we can point towards this
without being misleading.

I also reword it because I thought it was slightly confusing to run
`loginctl user-status root` and get an error back about "User 0".  Try to
be more specific, that it is "User ID 0".

6 years agologind: "self" objects which do not apply - return specific error messages
Alan Jenkins [Sat, 14 Oct 2017 08:25:56 +0000 (09:25 +0100)] 
logind: "self" objects which do not apply - return specific error messages

It's confusing that the bus API has aliases like "session/self" that return
an error based on ENXIO, when it also has methods that return e.g.
NO_SESSION_FOR_PID for the same problem.  The latter kind of error includes
more specifically helpful messages.

"user/self" is the odd one out; it returns a generic UnknownObject error
when it is not applicable to the caller.  It's not clear whether this was
intentional, but at first I thought it was more correct.  More
specifically, user_object_find() was returning 0 for "user/self", in the
same situations (more or less) where user_node_enumerator() was omitting
"user/self".  I thought that was a good idea, because returning e.g. -ENXIO instead
suggested that there _is_ something specific on that path.  And it could be
confused with errors of the method being called.

Therefore I suggested changing the enumerator, always admitting that there
is a handler for the path "foo/self", but returning a specific error when
queried.  However this interacts poorly with tools like D-Feet or `busctl`.
In either tool, looking at logind would show an error message, and then go
on to omit "user/self" in the normal listing.  These tools are very useful,
so we don't want to interfere with them.

I think we can change the error codes without causing problems.  The self
objects were not listed in the documentation.  They have been suggested to
other projects - but without reference to error reporting.  "seat/self" is
used by various Wayland compositors for VT switching, but they don't appear
to reference specific errors.

We _could_ insist on the link between enumeration and UnknownObject, and
standardize on that as the error for the aliases.  But I'm not aware of any
practical complaints, that we returned an error from an object that didn't
exist.

Instead, let's unify the codepaths for "user/self" vs GetUserByPid(0) etc.
We will return the most helpful error message we can think of, if the
object does not exist.  E.g. for "session/self", we might return an error
that the caller does not belong to a session.  If one of the compositors is
ever simplified to use "session/self" in initialization, users would be
able to trigger such errors (e.g. run `gnome-shell` inside gnome-terminal).
The message text will most likely be logged.  The user might not know what
the "session" is, but at least we'll be pointing towards the right
questions.  I think it should also be clearer for development / debugging.

Unifying the code paths is also slightly helpful for auditing / marking
calls to sd_bus_creds_get_session() in subsequent commits.

6 years agologind: remove an obscure dbus error from GetSessionByPID(0) and friends
Alan Jenkins [Sat, 7 Oct 2017 11:24:02 +0000 (12:24 +0100)] 
logind: remove an obscure dbus error from GetSessionByPID(0) and friends

GetSessionByPID(0) can fail with NO_SESSION_FOR_PID.  More obscurely, if
the session is abandoned, it can return NO_SUCH_SESSION.  It is not clear
that the latter was intended.  The message associated with the former,
hints that this was overlooked.

We don't have a document enumerating the errors.  Any specific
error-handling in client code, e.g. translated messages, would also be
liable to overlook the more obscure error code.

I can't see any equivalent condition for GetUserByPID(0).  On the other
hand, the code did not return NO_USER_FOR_PID where it probably should.
The relevant code is right next to that for GetSessionByPID(0), so it will
be simpler to understand if both follow the same pattern.

6 years agobusctl: fix minor memory leak in busctl (#7331) 6444/head
Lennart Poettering [Tue, 14 Nov 2017 16:59:50 +0000 (17:59 +0100)] 
busctl: fix minor memory leak in busctl (#7331)

Fixes: #7330
6 years agopo: add a copy of polkit its rules 7313/head
Zbigniew Jędrzejewski-Szmek [Mon, 13 Nov 2017 20:54:45 +0000 (21:54 +0100)] 
po: add a copy of polkit its rules

It's just a few lines, but this way we avoid a dependency on polkit, and
can use meson's i18n stuff on older distros.

6 years agoRemove TODO entry (#7326)
Lucas Werkmeister [Tue, 14 Nov 2017 09:57:54 +0000 (10:57 +0100)] 
Remove TODO entry (#7326)

This was documented in b0e8cec2dd (#7317).

6 years agoman: document > /dev/stderr pitfalls (#7317)
Lennart Poettering [Tue, 14 Nov 2017 09:51:09 +0000 (10:51 +0100)] 
man: document > /dev/stderr pitfalls (#7317)

Fixes: #7254
See: #2473

6 years agocore/dbus-unit: add property_get_requires_mounts_for() to send correct message (...
Yu Watanabe [Tue, 14 Nov 2017 08:01:21 +0000 (17:01 +0900)] 
core/dbus-unit: add property_get_requires_mounts_for() to send correct message (#7322)

PR #7186 changes requires_mounts_for from strv to Hashmap.
So, it is necessary to implement a function for getting the property RequiresMountsFor=.
This introduces property_get_requires_mounts_for() which reads the Hashmap
and sends messages to bus.

Fixes #7321.

6 years agoFix error message when binding files (#7196)
Zeal Jagannatha [Tue, 14 Nov 2017 07:11:41 +0000 (23:11 -0800)] 
Fix error message when binding files (#7196)

If you use machinectl to bind a file into a container, it responds with a confusing error message about a temporary directory not being a directory.

I just swapped it to error with the source that was passed, rather than the tmpdir.

It would also be nice to be able to bind files, but that's a separate issue (#7195).

Before the change:

root@epona /var/lib/sandbox $ cat bar/foo
Hello world!
root@epona /var/lib/sandbox $ machinectl bind testing /var/lib/sandbox/bar/foo /foo
Failed to bind mount: Failed to overmount /tmp/propagate.W5TNsj/mount: Not a directory

After the change:

root@epona /var/lib/sandbox $ machinectl bind testing /var/lib/sandbox/bar/foo /foo
Failed to bind mount: Failed to overmount /var/lib/sandbox/bar/foo: Not a directory

6 years agosystemctl: print a friendly message when systemctl is invoked, but PID 1 is not syste...
Lennart Poettering [Mon, 13 Nov 2017 21:03:32 +0000 (22:03 +0100)] 
systemctl: print a friendly message when systemctl is invoked, but PID 1 is not systemd (#7318)

We only show this message when we can't talk to systemd, so that client
side install can work.

Fixes: https://bugzilla.freedesktop.org/show_bug.cgi?id=69962
6 years agocore: only warn about BPF/cgroup missing once per runtime (#7319)
Lennart Poettering [Mon, 13 Nov 2017 21:02:51 +0000 (22:02 +0100)] 
core: only warn about BPF/cgroup missing once per runtime (#7319)

Let's reduce the amount of noise a bit, there's little point in
complaining loudly about every single unit like this, let's complain
only about the first one, and then downgrade the log level to LOG_DEBUG
for the other cases.

Fixes: #7188
6 years agobasic: remove redundant check (#7320)
Topi Miettinen [Mon, 13 Nov 2017 21:00:03 +0000 (21:00 +0000)] 
basic: remove redundant check (#7320)

The check is redundant as the whole block is only evaluated if
__IGNORE_pkey_mprotect is not defined. Change to #else.

6 years agoi18n: drop intltool use, use meson's merge_file directly
Zbigniew Jędrzejewski-Szmek [Mon, 13 Nov 2017 12:30:39 +0000 (13:30 +0100)] 
i18n: drop intltool use, use meson's merge_file directly

This didn't work during the initial conversion to meson, but should now.
A sufficiently new polkit is also required, for the .its rules files.

Note that https://github.com/mesonbuild/meson/blob/master/docs/markdown/i18n-module.md
says that 'install' argument was added in meson 0.43.0. If this is accurate,
warnigs might be generated with older mesons. Fedora has 0.43.0 across the
board, but other distros probably don't, but I guess that a warning is
prefereable to having to update do latest meson.

The advantages are:
- one less dependency (intltool)
- using the generic implementation instead of our open-coded calls
- we don't need to use the fake "_" prefixes in XML

Replaces #1609, fixes #7300.

6 years agoman: rework systemd-vconsole-setup man page a bit (#7312)
Lennart Poettering [Mon, 13 Nov 2017 18:14:19 +0000 (19:14 +0100)] 
man: rework systemd-vconsole-setup man page a bit (#7312)

It's not systemd that invokes the service internally as needed, it's
systemd-localed. Correct that.

Also, stop using the word "helper". To me a "helper" constitutes
something internal, not official API. I doubt systemd-vconsole-setup
really matches that description though, hence let's better avoid the
term.

Also, clean up some other wording, and be less imbiguous, by suggesting
a single command to apply vconsole.conf instead of two.

Follow-up for 597c25d2a7c61453acd723340350e8748a5106dd

6 years agoMerge pull request #7284 from poettering/cgroup-delegate-mask
Lennart Poettering [Mon, 13 Nov 2017 11:14:23 +0000 (12:14 +0100)] 
Merge pull request #7284 from poettering/cgroup-delegate-mask

add a concept of delegating cgroups per unit while enabling specific controllers

6 years agoinstall: drop redundant printing of unit name (#7296)
Lennart Poettering [Mon, 13 Nov 2017 10:12:01 +0000 (11:12 +0100)] 
install: drop redundant printing of unit name (#7296)

We already print it as part of log_syntax() internal logic, don't print
it again, and in particular, don't print it at the end of log line, such
a strange place.

Follow-up for: 142468d89508c63262dd59335ea6d4fe82267564

6 years agoman: remove productname which resulting trademark symbol (#7193)
Shuang Liu [Mon, 13 Nov 2017 10:10:51 +0000 (11:10 +0100)] 
man: remove productname which resulting trademark symbol (#7193)

6 years agobpf-firewall: properly handle kernels where BPF cgroup is disabled but TRIE maps...
Lennart Poettering [Mon, 13 Nov 2017 09:56:43 +0000 (10:56 +0100)] 
bpf-firewall: properly handle kernels where BPF cgroup is disabled but TRIE maps are enabled (#7298)

So far, we assumed that kernels where TRIE was on also supported
BPF/cgroup stuff. That's not a correct assumption to make, hence check
for both features separately.

Fixes: #7054
6 years agoMerge pull request #7310 from keszybz/missing-pkey_mprotect
Lennart Poettering [Mon, 13 Nov 2017 09:55:00 +0000 (10:55 +0100)] 
Merge pull request #7310 from keszybz/missing-pkey_mprotect

basic/missing: add numbers for pkey_mprotect

6 years agoman: document the new Delegate= syntax 7284/head
Lennart Poettering [Thu, 9 Nov 2017 14:31:37 +0000 (15:31 +0100)] 
man: document the new Delegate= syntax

6 years agocore: rework the Delegate= unit file setting to take a list of controller names
Lennart Poettering [Thu, 9 Nov 2017 14:29:34 +0000 (15:29 +0100)] 
core: rework the Delegate= unit file setting to take a list of controller names

Previously it was not possible to select which controllers to enable for
a unit where Delegate=yes was set, as all controllers were enabled. With
this change, this is made configurable, and thus delegation units can
pick specifically what they want to manage themselves, and what they
don't care about.

6 years agocore: downgrade a log message from error to warning
Lennart Poettering [Thu, 9 Nov 2017 10:13:36 +0000 (11:13 +0100)] 
core: downgrade a log message from error to warning

Messages that do not indicate a failing operation, but where we continue
operation should be at LOG_WARN, not at LOG_ERR.

6 years agostring-util: add delete_trailing_chars() and skip_leading_chars() helpers
Lennart Poettering [Thu, 9 Nov 2017 10:12:47 +0000 (11:12 +0100)] 
string-util: add delete_trailing_chars() and skip_leading_chars() helpers

And let's port over a couple of users to the new APIs.

6 years agoconf-parser: reindent some strangely indented function headers
Lennart Poettering [Thu, 9 Nov 2017 08:26:13 +0000 (09:26 +0100)] 
conf-parser: reindent some strangely indented function headers

6 years agoconf-parser: turn three bool function params into a flags fields
Lennart Poettering [Wed, 8 Nov 2017 23:26:11 +0000 (00:26 +0100)] 
conf-parser: turn three bool function params into a flags fields

This makes things more readable and fixes some issues with incorrect
flag propagation between the various flavours of config_parse().

6 years agoconf-parser: simplify things a bit by using strextend()
Lennart Poettering [Wed, 8 Nov 2017 20:38:51 +0000 (21:38 +0100)] 
conf-parser: simplify things a bit by using strextend()

6 years agofileio: make use of DEFINE_TRIVIAL_CLEANUP_FUNC where it makes sense
Lennart Poettering [Wed, 8 Nov 2017 20:33:19 +0000 (21:33 +0100)] 
fileio: make use of DEFINE_TRIVIAL_CLEANUP_FUNC where it makes sense

6 years agocgroup: make use of unit_get_subtree_mask() where appropriate
Lennart Poettering [Wed, 8 Nov 2017 18:16:03 +0000 (19:16 +0100)] 
cgroup: make use of unit_get_subtree_mask() where appropriate

subtree_mask is own_mask | members_mask, let's make use of that to
shorten a few things

6 years agocgroup: improve cg_mask_to_string a bit, and add tests for it
Lennart Poettering [Wed, 8 Nov 2017 18:01:18 +0000 (19:01 +0100)] 
cgroup: improve cg_mask_to_string a bit, and add tests for it

6 years agocgroup-util: add brief comments clarifying which controllers are v2-only and which...
Lennart Poettering [Wed, 8 Nov 2017 17:39:28 +0000 (18:39 +0100)] 
cgroup-util: add brief comments clarifying which controllers are v2-only and which v1-only

6 years agoupdate TODO
Lennart Poettering [Wed, 8 Nov 2017 17:36:59 +0000 (18:36 +0100)] 
update TODO

6 years agonamespace: set up OS hierarchy only after mounting the new root, not before
Lennart Poettering [Wed, 8 Nov 2017 17:35:16 +0000 (18:35 +0100)] 
namespace: set up OS hierarchy only after mounting the new root, not before

Otherwise it's a pointless excercise, as we'll set up an empty directory
tree that's never going to be used.

Hence, let's move this around a bit, so that we do the basesystem
initialization exactly when RootImage= or RootDirectory= are used, but
not otherwise.

6 years agoFix creating independent VTI tunnel (#7303)
Robin McCorkell [Mon, 13 Nov 2017 09:14:36 +0000 (09:14 +0000)] 
Fix creating independent VTI tunnel (#7303)

6 years agoshared/seccomp: skip pkey_mprotect protections if the syscall is unknown 7310/head
Zbigniew Jędrzejewski-Szmek [Mon, 13 Nov 2017 08:35:49 +0000 (09:35 +0100)] 
shared/seccomp: skip pkey_mprotect protections if the syscall is unknown

When compiling with an old kernel on architectures for which the
number is not defined in missing.h, a warning is generated in missing.h.
Let's just skip the protection in this case, to allow build to proceed.

6 years agobasic/missing: add numbers for pkey_mprotect
Zbigniew Jędrzejewski-Szmek [Mon, 13 Nov 2017 08:27:53 +0000 (09:27 +0100)] 
basic/missing: add numbers for pkey_mprotect

Follow-up for b835eeb4ec1dd122b6feff2b70881265c529fcdd.

6 years agoshared/seccomp: disallow pkey_mprotect the same as mprotect for W^X mappings (#7295)
Zbigniew Jędrzejewski-Szmek [Sun, 12 Nov 2017 16:28:48 +0000 (17:28 +0100)] 
shared/seccomp: disallow pkey_mprotect the same as mprotect for W^X mappings (#7295)

MemoryDenyWriteExecution policy could be be bypassed by using pkey_mprotect
instead of mprotect to create an executable writable mapping.

The impact is mitigated by the fact that the man page says "Note that this
feature is fully available on x86-64, and partially on x86", so hopefully
people do not rely on it as a sole security measure.

Found by Karin Hossen and Thomas Imbert from Sogeti ESEC R&D.

https://bugs.launchpad.net/bugs/1725348

6 years agoseccomp: include ARM set_tls in @default (#7297)
Lennart Poettering [Sun, 12 Nov 2017 15:34:43 +0000 (16:34 +0100)] 
seccomp: include ARM set_tls in @default (#7297)

Fixes: #7135
6 years agonetworkd: improve interface rename log message a bit (#7299)
Lennart Poettering [Sun, 12 Nov 2017 15:26:58 +0000 (16:26 +0100)] 
networkd: improve interface rename log message a bit (#7299)

Let's clarify that it's not networkd that renames interfaces, but
something else (for example, udev's link builtin based on .link files)

This doesn't change any logic, it just rewords the message a bit, to
clarify that we only log this for informational purposes, not because we
execute the rename operation ourselves.

Fixes: #7143
6 years agoMerge pull request #7301 from poettering/loginctl-ellipsize
Zbigniew Jędrzejewski-Szmek [Sun, 12 Nov 2017 15:25:54 +0000 (16:25 +0100)] 
Merge pull request #7301 from poettering/loginctl-ellipsize

Fix loginctl seat sysfs tree ellipsation logic.

Simple reproducer:
loginctl --full seat-status seat0|cat
→ after this PR, all lines are shown in full. Before, lines were ellipsized to terminal width.

6 years agoMerge pull request #7186 from poettering/track-deps
Zbigniew Jędrzejewski-Szmek [Sun, 12 Nov 2017 15:14:41 +0000 (16:14 +0100)] 
Merge pull request #7186 from poettering/track-deps

rework unit dependency data structure to track why deps get created

6 years agotest-execute: change path to python3 (#7306)
Yu Watanabe [Sun, 12 Nov 2017 15:09:00 +0000 (00:09 +0900)] 
test-execute: change path to python3 (#7306)

Change python3 path from /bin/python3 to /usr/bin/python3 to make
the test work on Ubuntu Xenial.

Follow-up for #7178.

6 years agocore/mount: fstype may be NULL 7186/head
Yu Watanabe [Sun, 12 Nov 2017 13:25:58 +0000 (14:25 +0100)] 
core/mount: fstype may be NULL

6 years agoupdate TODO
Lennart Poettering [Tue, 24 Oct 2017 10:18:17 +0000 (12:18 +0200)] 
update TODO

6 years agocore: sd-bus can handle NULL strings nicely, let's use it
Lennart Poettering [Thu, 26 Oct 2017 15:26:27 +0000 (17:26 +0200)] 
core: sd-bus can handle NULL strings nicely, let's use it

No need to set an empty string here, sd-bus serializes NULL as empty
string anway.

6 years agoMerge pull request #7178 from yuwata/rfe-7169-v2
Zbigniew Jędrzejewski-Szmek [Sun, 12 Nov 2017 11:45:23 +0000 (12:45 +0100)] 
Merge pull request #7178 from yuwata/rfe-7169-v2

core: add support to specify errno in SystemCallFilter=

6 years agotest-execute: update test for SystemCallErrorNumber= 7178/head
Yu Watanabe [Sat, 11 Nov 2017 12:41:05 +0000 (21:41 +0900)] 
test-execute: update test for SystemCallErrorNumber=

6 years agocore: allow to specify errno number in SystemCallErrorNumber=
Yu Watanabe [Sat, 11 Nov 2017 12:40:20 +0000 (21:40 +0900)] 
core: allow to specify errno number in SystemCallErrorNumber=

6 years agotest: add tests for syscall:errno style in SystemCallFilter=
Yu Watanabe [Sat, 11 Nov 2017 12:39:02 +0000 (21:39 +0900)] 
test: add tests for syscall:errno style in SystemCallFilter=

6 years agocore: add support to specify errno in SystemCallFilter=
Yu Watanabe [Sat, 11 Nov 2017 12:35:49 +0000 (21:35 +0900)] 
core: add support to specify errno in SystemCallFilter=

This makes each system call in SystemCallFilter= blacklist optionally
takes errno name or number after a colon. The errno takes precedence
over the one given by SystemCallErrorNumber=.

C.f. #7173.
Closes #7169.

6 years agotest: add test for parse_errno() and parse_syscall_and_errno()
Yu Watanabe [Sat, 11 Nov 2017 12:53:56 +0000 (21:53 +0900)] 
test: add test for parse_errno() and parse_syscall_and_errno()

6 years agoparse-util: add parse_errno() and parse_syscall_and_errno()
Yu Watanabe [Sat, 11 Nov 2017 12:29:17 +0000 (21:29 +0900)] 
parse-util: add parse_errno() and parse_syscall_and_errno()

6 years agobasic/errno-list: remove errno_max() and define ERRNO_MAX as 4095
Yu Watanabe [Sat, 11 Nov 2017 12:26:10 +0000 (21:26 +0900)] 
basic/errno-list: remove errno_max() and define ERRNO_MAX as 4095

In Linux kernel code, MAX_ERRNO is defined as 4095.
Here, we use that value for ERRNO_MAX.

6 years agologinctl: rework sysfs tree dump, to honour --full and friends 7301/head
Lennart Poettering [Fri, 10 Nov 2017 20:44:29 +0000 (21:44 +0100)] 
loginctl: rework sysfs tree dump, to honour --full and friends

Let's hook up the sysfs tree output with the output flags logic,
already used when dumping log lines or process trees. This way we get
very similar output handling for line breaking/ellipsation in all three
outputs of structured data.

Fixes: #7095
6 years agostring-util: when ellipsizing to a length if (size_t) -1, become a NOP
Lennart Poettering [Fri, 10 Nov 2017 20:41:53 +0000 (21:41 +0100)] 
string-util: when ellipsizing to a length if (size_t) -1, become a NOP

Let's say that (size_t) -1 (i.e. SIZE_T_MAX) is equivalent to
"unbounded" ellipsation, i.e. ellipsation as NOP. In which case the
relevant functions become little more than strdup()/strndup().

This is useful to simplify caller code in case we want to turn off
ellipsation in certain code paths with minimal caller-side handling for
this.

6 years agomerge two lines in our get_output_flags() functions
Lennart Poettering [Fri, 10 Nov 2017 20:40:47 +0000 (21:40 +0100)] 
merge two lines in our get_output_flags() functions

loginctl, machinectl, systemctl all have very similar implementations of
a get_output_flags() functions. Simplify it by merging two lines that
set the same flag.

6 years agotree-wide: use _cleanup_(sd_bus_flush_close_unrefp) at various appropriate places
Lennart Poettering [Fri, 10 Nov 2017 20:15:44 +0000 (21:15 +0100)] 
tree-wide: use  _cleanup_(sd_bus_flush_close_unrefp) at various appropriate places

Let's shorten the code a bit.

6 years agopager: cache not only number of columns but also of lines before we open pager
Lennart Poettering [Fri, 10 Nov 2017 20:10:17 +0000 (21:10 +0100)] 
pager: cache not only number of columns but also of lines before we open pager

Not that we need it, but let's do this as matter of completeness.