platform/upstream/systemd.git
8 years agoMerge pull request #3742 from msoltyspl/vconfix2
Zbigniew Jędrzejewski-Szmek [Fri, 29 Jul 2016 03:59:06 +0000 (23:59 -0400)]
Merge pull request #3742 from msoltyspl/vconfix2

vconsole-setup: updates & fixes V2

8 years agobuild-sys: conditionally disable LTO if requested (#3823)
Davide Cavalca [Fri, 29 Jul 2016 03:42:45 +0000 (20:42 -0700)]
build-sys: conditionally disable LTO if requested (#3823)

This adds a --disable-lto option to ./configure, but does not change the
default behavior.

8 years agosystemctl: be sure to be quiet with 'systemctl is-enabled --quiet' (#3819)
Christian Rebischke [Thu, 28 Jul 2016 02:40:20 +0000 (04:40 +0200)]
systemctl: be sure to be quiet with 'systemctl is-enabled --quiet' (#3819)

Fixes #3813.

8 years agostring-util: rework memory_erase() to not use GCC optimize attribute (#3812)
Michael Biebl [Wed, 27 Jul 2016 03:32:37 +0000 (05:32 +0200)]
string-util: rework memory_erase() to not use GCC optimize attribute (#3812)

"#pragma GCC optimize" is merely a convenience to decorate multiple
functions with attribute optimize. And the manual has this to say about
this attribute:

  This attribute should be used for debugging purposes only. It
  is not suitable in production code.

Some versions of GCC also seem to have a problem with this pragma in
combination with LTO, resulting in ICEs.

So use a different approach (indirect the memset call via a volatile
function pointer) as implemented in openssl's crypto/mem_clr.c.

Closes: #3811

8 years agovconsole: update man page
Michal Soltys [Tue, 26 Jul 2016 22:57:01 +0000 (00:57 +0200)]
vconsole: update man page

- about namespace
- about udev rules

8 years agovconsole: correct kernel command line namespace
Michal Soltys [Tue, 26 Jul 2016 22:57:01 +0000 (00:57 +0200)]
vconsole: correct kernel command line namespace

8 years agovconsole: add copyright line
Michal Soltys [Tue, 26 Jul 2016 22:57:01 +0000 (00:57 +0200)]
vconsole: add copyright line

8 years agovconsole: Don't do static installation under sysinit.target
Michal Soltys [Tue, 26 Jul 2016 22:57:01 +0000 (00:57 +0200)]
vconsole: Don't do static installation under sysinit.target

Udev rules cover all the necessary initializations.

As the service now is neither installed, nor installable - we can
remove explicit dependencies and RemainAfterExit=yes option.

8 years agovconsole: use KD_FONT_OP_GET/SET to handle copying
Michal Soltys [Tue, 26 Jul 2016 22:57:01 +0000 (00:57 +0200)]
vconsole: use KD_FONT_OP_GET/SET to handle copying

We now use KD_FONT_OP_GET & KD_FONT_OP_SET instead of
problematic KD_FONT_OP_COPY.

8 years agovconsole: updates of keyboard/font loading functions
Michal Soltys [Tue, 26 Jul 2016 22:57:01 +0000 (00:57 +0200)]
vconsole: updates of keyboard/font loading functions

Change return convention to -errno/==0 and use isempty() instead
of just pointer tests.

8 years agovconsole: Add generic is_*() functions
Michal Soltys [Tue, 26 Jul 2016 22:57:01 +0000 (00:57 +0200)]
vconsole: Add generic is_*() functions

is_allocated() and is_allocated_byfd():

Checks if the console is allocated by its index (first function) or
its open descriptor (second function).

is_settable():

Checks if the console is in xlate or unicode mode, so we can adjust
is safely without interfering with X.

8 years agovconsole: add two new toggle functions, remove old enable/disable ones
Michal Soltys [Tue, 26 Jul 2016 22:57:01 +0000 (00:57 +0200)]
vconsole: add two new toggle functions, remove old enable/disable ones

Add toggle_utf8() and toggle_utf8_sysfs() and use them in place of old
enable/disable functions. toggle_utf8() also adds iutf8 setting and is
set up to be called per-console (in subsequent patches).

Note, that old disable_utf8() didn't bother checking if it was ok
to change the kbdmode.

8 years agovconsole: copy font to 63 consoles instead of 15
Michal Soltys [Tue, 26 Jul 2016 22:57:01 +0000 (00:57 +0200)]
vconsole: copy font to 63 consoles instead of 15

We copy only to allocated consoles, so the cost of looping over
all possible ones is minuscule.

8 years agovconsole: don't do GIO_SCRNMAP / GIO_UNISCRNMAP
Michal Soltys [Tue, 26 Jul 2016 22:57:01 +0000 (00:57 +0200)]
vconsole: don't do GIO_SCRNMAP / GIO_UNISCRNMAP

GIO_SCRNMAP / GIO_UNISCRNMAP are related to what setfont does with -m
option - namely setting intermediate map from 8bit values into unicode
values. This map is global, so single setfont invocation sets it for
all applicable consoles.

Furthermore calling GIO_SCRNMAP before GIO_UNISCRNMAP causes issues as
the former corrupts values > 255 (UNI alone would be sufficient).

The bug can be easily tested with the following conf:

KEYMAP=pl
FONT=LatArCyrHeb-16
FONT_MAP=8859-2

8 years agonspawn: add SYSTEMD_NSPAWN_USE_CGNS env variable (#3809)
Christian Brauner [Tue, 26 Jul 2016 14:49:15 +0000 (16:49 +0200)]
nspawn: add SYSTEMD_NSPAWN_USE_CGNS env variable (#3809)

SYSTEMD_NSPAWN_USE_CGNS allows to disable the use of cgroup namespaces.

8 years agosystemctl: allow disable on the unit file path, but warn about it (#3806)
Michal Sekletar [Tue, 26 Jul 2016 12:25:52 +0000 (14:25 +0200)]
systemctl: allow disable on the unit file path, but warn about it (#3806)

systemd now returns an error when it is asked to perform disable on the
unit file path. In the past this was allowed, but systemd never really
considered an actual content of the [Install] section of the unit
file. Instead it performed disable on the unit name, i.e. purged all
symlinks pointing to the given unit file (undo of implicit link action
done by systemd when enable is called on the unit file path) and all
symlinks that have the same basename as the given unit file.

However, to notice that [Install] info of the file is not consulted one
must create additional symlinks manually. I argue that in most cases
users do not create such links. Let's be nice to our users and don't
break existing scripts that expect disable to work with the unit file
path.

Fixes #3706.

8 years agojournald: deprecate SplitMode=login (#3805)
Zbigniew Jędrzejewski-Szmek [Tue, 26 Jul 2016 06:19:33 +0000 (02:19 -0400)]
journald: deprecate SplitMode=login (#3805)

In this mode, messages from processes which are not part of the session
land in the main journal file, and only output of processes which are
properly part of the session land in the user's journal. This is
confusing, in particular because systemd-coredump runs outside of the
login session.

"Deprecate" SplitMode=login by removing it from documentation, to
discourage people from using it.

8 years agoMerge pull request #3728 from poettering/dynamic-users
Zbigniew Jędrzejewski-Szmek [Mon, 25 Jul 2016 20:40:26 +0000 (16:40 -0400)]
Merge pull request #3728 from poettering/dynamic-users

8 years agoMerge pull request #3757 from poettering/efi-search
Zbigniew Jędrzejewski-Szmek [Mon, 25 Jul 2016 20:17:48 +0000 (16:17 -0400)]
Merge pull request #3757 from poettering/efi-search

8 years agoMerge pull request #3589 from brauner/cgroup_namespace
Lennart Poettering [Mon, 25 Jul 2016 20:23:00 +0000 (22:23 +0200)]
Merge pull request #3589 from brauner/cgroup_namespace

Cgroup namespace

8 years agounits: add graphical-session.target user unit (#3678)
Martin Pitt [Mon, 25 Jul 2016 20:01:35 +0000 (22:01 +0200)]
units: add graphical-session.target user unit (#3678)

This unit acts as a dynamic "alias" target for any concrete graphical user
session like gnome-session.target; these should declare
"BindsTo=graphical-session.target" so that both targets stop and start at the
same time.

This allows services that run in a particular graphical user session (e. g.
gnome-settings-daemon.service) to declare "PartOf=graphical-session.target"
without having to know or get updated for all/new session types. This will
ensure that stopping the graphical session will stop all services which are
associated to it.

8 years agobuild-sys: metadata updates for v231 (#3803) v231
Lennart Poettering [Mon, 25 Jul 2016 19:49:47 +0000 (21:49 +0200)]
build-sys: metadata updates for v231 (#3803)

8 years agoCODING_STYLE fixes (#3804)
Lennart Poettering [Mon, 25 Jul 2016 19:34:42 +0000 (21:34 +0200)]
CODING_STYLE fixes (#3804)

As noted by @evverx:

https://github.com/systemd/systemd/pull/3802/files/0b81133facb7576e983ec8427ffc3a4a8cc62846#r72126018
https://github.com/systemd/systemd/pull/3802/files/0b81133facb7576e983ec8427ffc3a4a8cc62846#r72126432

8 years agoMerge pull request #3802 from poettering/id128-fixes
Zbigniew Jędrzejewski-Szmek [Mon, 25 Jul 2016 19:08:29 +0000 (15:08 -0400)]
Merge pull request #3802 from poettering/id128-fixes

Id128 fixes and more

8 years agoMerge pull request #3800 from keszybz/systemctl-more-cleanup
Lennart Poettering [Mon, 25 Jul 2016 19:01:01 +0000 (21:01 +0200)]
Merge pull request #3800 from keszybz/systemctl-more-cleanup

Systemctl more cleanup

8 years agoman: extend documentation on the SplitMode= setting (#3801)
Lennart Poettering [Mon, 25 Jul 2016 18:56:24 +0000 (20:56 +0200)]
man: extend documentation on the SplitMode= setting (#3801)

Adressing https://github.com/systemd/systemd/issues/3755#issuecomment-234214273

8 years agoCODING_STYLE: document src/shared ←→ src/basic split
Lennart Poettering [Mon, 25 Jul 2016 18:54:34 +0000 (20:54 +0200)]
CODING_STYLE: document src/shared ←→ src/basic split

Addresses: https://github.com/systemd/systemd/pull/3580#issuecomment-227931168

While we are at it, also document that we focus on glibc, not any other libcs.

8 years agosd-id128: be more liberal when reading files with 128bit IDs
Lennart Poettering [Mon, 25 Jul 2016 18:50:24 +0000 (20:50 +0200)]
sd-id128: be more liberal when reading files with 128bit IDs

Accept both files with and without trailing newlines. Apparently some rkt
releases generated them incorrectly, missing the trailing newlines, and we
shouldn't break that.

8 years agofileio: imply /tmp as directory if passed as NULL to open_tmpfile_unlinkable()
Lennart Poettering [Mon, 25 Jul 2016 18:35:04 +0000 (20:35 +0200)]
fileio: imply /tmp as directory if passed as NULL to open_tmpfile_unlinkable()

We can make this smarter one day, to honour $TMPDIR and friends, but for now,
let's just use /tmp.

8 years agoman: minor man page fix
Lennart Poettering [Mon, 25 Jul 2016 18:14:13 +0000 (20:14 +0200)]
man: minor man page fix

Addressing:

https://github.com/systemd/systemd/commit/b541146bf8c34aaaa9efcf58325f18da9253c4ec#commitcomment-17997074

8 years agoautomount: don't cancel mount/umount request on reload/reexec (#3670)
Michael Olbrich [Mon, 25 Jul 2016 18:04:02 +0000 (20:04 +0200)]
automount: don't cancel mount/umount request on reload/reexec (#3670)

All pending tokens are already serialized correctly and will be handled
when the mount unit is done.

Without this a 'daemon-reload' cancels all pending tokens. Any process
waiting for the mount will continue with EHOSTDOWN.
This can happen when the mount unit waits for it's dependencies, e.g.
network, devices, fsck, etc.

8 years agotransaction: don't cancel jobs for units with IgnoreOnIsolate=true (#3671)
Michael Olbrich [Mon, 25 Jul 2016 18:02:55 +0000 (20:02 +0200)]
transaction: don't cancel jobs for units with IgnoreOnIsolate=true (#3671)

This is important if a job was queued for a unit but not yet started.
Without this, the job will be canceled and is never executed even though
IgnoreOnIsolate it set to 'true'.

8 years agosystemctl: use _cleanup_ for UnitCondition
Zbigniew Jędrzejewski-Szmek [Mon, 25 Jul 2016 16:29:20 +0000 (12:29 -0400)]
systemctl: use _cleanup_ for UnitCondition

8 years agosystemctl: simplify machine_info_clear
Zbigniew Jędrzejewski-Szmek [Mon, 25 Jul 2016 16:21:50 +0000 (12:21 -0400)]
systemctl: simplify machine_info_clear

It is only used with info allocated on the stack, so the pointer cannot be
NULL.

8 years agocoredump: turn off coredump collection only when PID 1 crashes, not when journald...
Lennart Poettering [Mon, 25 Jul 2016 17:03:43 +0000 (19:03 +0200)]
coredump: turn off coredump collection only when PID 1 crashes, not when journald crashes (#3799)

As suggested:

https://github.com/systemd/systemd/pull/3783/files/5157879b757bffce3da0a68ca207753569e8627d#r71906971

8 years agosystemctl: avoid "leaking" some strings in UnitStatusInfo
Zbigniew Jędrzejewski-Szmek [Mon, 25 Jul 2016 16:15:57 +0000 (12:15 -0400)]
systemctl: avoid "leaking" some strings in UnitStatusInfo

% valgrind --leak-check=full systemctl status multipathd.service --no-pager -n0
...
==431== 16 bytes in 2 blocks are definitely lost in loss record 1 of 2
==431==    at 0x4C2BBAD: malloc (vg_replace_malloc.c:299)
==431==    by 0x534AF19: strdup (in /usr/lib64/libc-2.23.so)
==431==    by 0x4E81AEE: free_and_strdup (string-util.c:794)
==431==    by 0x4EF66C1: map_basic (bus-util.c:1030)
==431==    by 0x4EF6A8E: bus_message_map_all_properties (bus-util.c:1153)
==431==    by 0x120487: show_one (systemctl.c:4672)
==431==    by 0x1218F3: show (systemctl.c:4990)
==431==    by 0x4EC359E: dispatch_verb (verbs.c:92)
==431==    by 0x12A3AE: systemctl_main (systemctl.c:7742)
==431==    by 0x12B1A8: main (systemctl.c:8011)
==431==
==431== LEAK SUMMARY:
==431==    definitely lost: 16 bytes in 2 blocks

This happens because map_basic() strdups the strings. Other code in systemctl
assigns strings to UnitStatusInfo without copying them, relying on the fact
that the message is longer lived than UnitStatusInfo. Add a helper function
that is similar to map_basic, but only accepts strings and does not copy them.
The alternative of continuing to use map_basic() but adding proper cleanup
to free fields in UnitStatusInfo seems less attractive because it'd require
changing a lot of code and doing a lot of more allocations for little gain.

(I put "leaking" in quotes, because systemctl is short lived anyway.)

8 years agosystemctl: use cleanup function for UnitStatusInfo
Zbigniew Jędrzejewski-Szmek [Mon, 25 Jul 2016 15:53:14 +0000 (11:53 -0400)]
systemctl: use cleanup function for UnitStatusInfo

There is no functional change, but clarity of the code is increased
by splitting out the cleanup part and putting it next to the structure
definition.

8 years agoMerge pull request #3681 from walyong/systemctl_condition
Zbigniew Jędrzejewski-Szmek [Mon, 25 Jul 2016 15:27:14 +0000 (11:27 -0400)]
Merge pull request #3681 from walyong/systemctl_condition

8 years agoMerge pull request #3798 from keszybz/news-and-man-tweaks
Lennart Poettering [Mon, 25 Jul 2016 15:24:35 +0000 (17:24 +0200)]
Merge pull request #3798 from keszybz/news-and-man-tweaks

News and man tweaks

8 years agosystemctl: style tweaks for the new condition code
Zbigniew Jędrzejewski-Szmek [Mon, 25 Jul 2016 15:20:58 +0000 (11:20 -0400)]
systemctl: style tweaks for the new condition code

8 years agocore: change ExecStart=! syntax to ExecStart=+ (#3797)
Lennart Poettering [Mon, 25 Jul 2016 14:53:33 +0000 (16:53 +0200)]
core: change ExecStart=! syntax to ExecStart=+ (#3797)

As suggested by @mbiebl we already use the "!" special char in unit file
assignments for negation, hence we should not use it in a different context for
privileged execution. Let's use "+" instead.

8 years agoman: use "search for unit"
Zbigniew Jędrzejewski-Szmek [Mon, 25 Jul 2016 14:41:04 +0000 (10:41 -0400)]
man: use "search for unit"

To "search something", in the meaning of looking for it, is valid,
but "search _for_ something" is much more commonly used, especially when
the meaning could be confused with "looking _through_ something"
(for some other object).

(C.f. "the police search a person", "the police search for a person".)

Also reword the rest of the paragraph to avoid using "automatically"
three times.

8 years agoNEWS: reword the text about libshared
Zbigniew Jędrzejewski-Szmek [Mon, 25 Jul 2016 14:34:56 +0000 (10:34 -0400)]
NEWS: reword the text about libshared

"strict versioned dependency" suggests that version "231" of the library
is stable. But the ABI or API might be changed in any patch, so reword
the text to avoid using "version".

8 years agoman: make chroot less prominent in discussion of nspawn
Zbigniew Jędrzejewski-Szmek [Fri, 22 Jul 2016 20:31:55 +0000 (16:31 -0400)]
man: make chroot less prominent in discussion of nspawn

Not as many people use chroot as before, so make the flow a bit nicer by
talking less about chroot.

"change to the either" is awkward and unclear. Just remove that part,
because all changes are lost, period.

8 years agoshared/install: allow "enable" on linked unit files (#3790)
Zbigniew Jędrzejewski-Szmek [Mon, 25 Jul 2016 14:20:16 +0000 (10:20 -0400)]
shared/install: allow "enable" on linked unit files (#3790)

User expectations are broken when "systemctl enable /some/path/service.service"
behaves differently to "systemctl link ..." followed by "systemctl enable".
From user's POV, "enable" with the full path just combines the two steps into
one.

Fixes #3010.

8 years agogetty@.service.m4: add Conflicts=/Before= against rescue.service (#3792)
Michal Soltys [Mon, 25 Jul 2016 14:18:00 +0000 (16:18 +0200)]
getty@.service.m4: add Conflicts=/Before= against rescue.service (#3792)

If user isolates rescue target from multi-user or graphical target (or just
starts the service), IgnoreOnIsolate will cause issues with sulogin which is
directly started on current virtual console. This patch adds necessary
Conflicts= and Before= against rescue.service.

Note that this is not needed for emergency target, as implicit Requires= and
After= against sysinit.target is in effect for this service
(DefaultDependencies=yes).

8 years agoMerge pull request #3796 from poettering/mailmap
Martin Pitt [Mon, 25 Jul 2016 13:47:24 +0000 (15:47 +0200)]
Merge pull request #3796 from poettering/mailmap

documentation, NEWS and mailmap fixes

8 years agonamespace: don't fail on masked mounts (#3794)
Alban Crequy [Mon, 25 Jul 2016 13:39:46 +0000 (15:39 +0200)]
namespace: don't fail on masked mounts (#3794)

Before this patch, a service file with ReadWriteDirectories=/file...
could fail if the file exists but is not a mountpoint, despite being
listed in /proc/self/mountinfo. It could happen with masked mounts.

Fixes https://github.com/systemd/systemd/issues/3793

8 years agoNEWS: document the new shared library for internal code
Lennart Poettering [Mon, 25 Jul 2016 13:27:10 +0000 (15:27 +0200)]
NEWS: document the new shared library for internal code

8 years agoupdate hwdb (#3795)
Lennart Poettering [Mon, 25 Jul 2016 13:24:15 +0000 (15:24 +0200)]
update hwdb (#3795)

"make update-hwdb" in preparation for v231.

8 years agoman: update systemctl man page for unit file commands, in particular "systemctl enable"
Lennart Poettering [Mon, 25 Jul 2016 13:10:15 +0000 (15:10 +0200)]
man: update systemctl man page for unit file commands, in particular "systemctl enable"

Clarify that "systemctl enable" can operate either on unit names or on unit
file paths (also, adjust the --help text to clarify this). Say that "systemctl
enable" on unit file paths also links the unit into the search path.

Many other fixes.

This should improve the documentation to avoid further confusion around #3706.

8 years agoNEWS: update mailmap to bring NEWS and "make git-contrib" in line
Lennart Poettering [Mon, 25 Jul 2016 13:03:46 +0000 (15:03 +0200)]
NEWS: update mailmap to bring NEWS and "make git-contrib" in line

Let's make sure that "make git-contrib" prints a useful contributors list
directly useful for NEWS and fixes up contributors's IDs a bit.

8 years agoNEWS: more stuff for v231 (#3786)
Zbigniew Jędrzejewski-Szmek [Sat, 23 Jul 2016 08:11:30 +0000 (04:11 -0400)]
NEWS: more stuff for v231 (#3786)

8 years agoMerge pull request #3785 from keszybz/less-return-errno
Martin Pitt [Sat, 23 Jul 2016 08:10:53 +0000 (10:10 +0200)]
Merge pull request #3785 from keszybz/less-return-errno

Use "return log_error_errno(...)" in more places + related fixes

8 years agoNEWS: remove duplicate names and fix a few typos
Zbigniew Jędrzejewski-Szmek [Sat, 23 Jul 2016 01:40:46 +0000 (21:40 -0400)]
NEWS: remove duplicate names and fix a few typos

8 years agoMerge pull request #3784 from poettering/NEWS-v231
Zbigniew Jędrzejewski-Szmek [Sat, 23 Jul 2016 01:28:31 +0000 (21:28 -0400)]
Merge pull request #3784 from poettering/NEWS-v231

8 years agonspawn: don't skip cleanup on locking error
Zbigniew Jędrzejewski-Szmek [Sat, 23 Jul 2016 00:28:57 +0000 (20:28 -0400)]
nspawn: don't skip cleanup on locking error

8 years agoimport: don't log "fake" errno values
Zbigniew Jędrzejewski-Szmek [Sat, 23 Jul 2016 00:28:30 +0000 (20:28 -0400)]
import: don't log "fake" errno values

8 years agoUse "return log_error_errno" in more places"
Zbigniew Jędrzejewski-Szmek [Sat, 23 Jul 2016 00:27:45 +0000 (20:27 -0400)]
Use "return log_error_errno" in more places"

8 years agoMerge pull request #3777 from poettering/id128-rework
Zbigniew Jędrzejewski-Szmek [Sat, 23 Jul 2016 01:18:41 +0000 (21:18 -0400)]
Merge pull request #3777 from poettering/id128-rework

uuid/id128 code rework

8 years agoPopulate NEWS a bit, in preparation for v231
Lennart Poettering [Fri, 22 Jul 2016 18:18:34 +0000 (20:18 +0200)]
Populate NEWS a bit, in preparation for v231

(Note complete yet.)

8 years agoman: rework resolved.conf's Cache= documentation
Lennart Poettering [Fri, 22 Jul 2016 18:17:23 +0000 (20:17 +0200)]
man: rework resolved.conf's Cache= documentation

Let's not mention the supposed security benefit of turning off caching. It is
really questionnable, and I#d rather not create the impression that we actually
believed turning off caching would be a good idea.

Instead, mention that Cache=no is implicit if a DNS server on the local host is
used.

8 years agomailmap: add a few more names
Lennart Poettering [Fri, 22 Jul 2016 18:16:56 +0000 (20:16 +0200)]
mailmap: add a few more names

Let's do something about my OCD and map a numbre of commiters to proper names.

8 years agoMerge pull request #3783 from poettering/fix-3285
Lennart Poettering [Fri, 22 Jul 2016 16:37:42 +0000 (18:37 +0200)]
Merge pull request #3783 from poettering/fix-3285

coredump: make sure to handle crashes of PID 1 and journald special

8 years agocoredump: turn off coredump collection entirely after journald or PID 1 crashed
Lennart Poettering [Fri, 22 Jul 2016 16:01:50 +0000 (18:01 +0200)]
coredump: turn off coredump collection entirely after journald or PID 1 crashed

Safe is safe, let's turn off the whole logic if we can, after all it is
unlikely we'll be able to process further crashes in a reasonable way.

8 years agocoredump: make sure to handle crashes of PID 1 and journald special
Lennart Poettering [Fri, 22 Jul 2016 14:45:43 +0000 (16:45 +0200)]
coredump: make sure to handle crashes of PID 1 and journald special

Fixes: #3285

8 years agoMerge pull request #3753 from poettering/tasks-max-scale
Lennart Poettering [Fri, 22 Jul 2016 15:40:12 +0000 (17:40 +0200)]
Merge pull request #3753 from poettering/tasks-max-scale

Add support for relative TasksMax= specifications, and bump default for services

8 years agocoredump: truncate overly long coredump metadata fields (#3780)
Lennart Poettering [Fri, 22 Jul 2016 15:39:47 +0000 (17:39 +0200)]
coredump: truncate overly long coredump metadata fields (#3780)

Fixes: #3573
Replaces: #3588

8 years agosystemctl: never check inhibitors if -H or -M are used (#3781)
Lennart Poettering [Fri, 22 Jul 2016 15:39:21 +0000 (17:39 +0200)]
systemctl: never check inhibitors if -H or -M are used (#3781)

Don't check inhibitors when operating remotely. The interactivity inhibitors
imply can#t be provided anyway, and the current code checks for local sessions
directly, via various sd_session_xyz() APIs, hence bypass it entirely if we
operate on remote systems.

Fixes: #3476

8 years agoMerge pull request #3779 from kinvolk/alessandro/nspawn-inaccessible-devs
Lennart Poettering [Fri, 22 Jul 2016 15:37:54 +0000 (17:37 +0200)]
Merge pull request #3779 from kinvolk/alessandro/nspawn-inaccessible-devs

cgroup: whitelist inaccessible devices for "auto" and "closed" DevicePolicy

8 years agocgroup: whitelist inaccessible devices for "auto" and "closed" DevicePolicy.
Alessandro Puccetti [Fri, 22 Jul 2016 10:00:49 +0000 (12:00 +0200)]
cgroup: whitelist inaccessible devices for "auto" and "closed" DevicePolicy.

https://github.com/systemd/systemd/pull/3685 introduced
/run/systemd/inaccessible/{chr,blk} to map inacessible devices,
this patch allows systemd running inside a nspawn container to create
/run/systemd/inaccessible/{chr,blk}.

8 years agonspawn: set DevicesPolicy closed and clean up duplicated devices
Alessandro Puccetti [Fri, 22 Jul 2016 09:58:03 +0000 (11:58 +0200)]
nspawn: set DevicesPolicy closed and clean up duplicated devices

8 years agonamespace: ensure to return a valid inaccessible nodes (#3778)
Alessandro Puccetti [Fri, 22 Jul 2016 13:59:14 +0000 (15:59 +0200)]
namespace: ensure to return a valid inaccessible nodes (#3778)

Because /run/systemd/inaccessible/{chr,blk} are devices with
major=0 and minor=0 it might be possible that these devices cannot be created
so we use /run/systemd/inaccessible/sock instead to map them.

8 years agoupdate TODO
Lennart Poettering [Thu, 14 Jul 2016 10:26:07 +0000 (12:26 +0200)]
update TODO

8 years agonss: add new "nss-systemd" NSS module for mapping dynamic users
Lennart Poettering [Thu, 14 Jul 2016 17:19:49 +0000 (19:19 +0200)]
nss: add new "nss-systemd" NSS module for mapping dynamic users

With this NSS module all dynamic service users will be resolvable via NSS like
any real user.

8 years agocore: enforce user/group name validity also when creating transient units
Lennart Poettering [Thu, 14 Jul 2016 17:17:18 +0000 (19:17 +0200)]
core: enforce user/group name validity also when creating transient units

8 years agocore: add a concept of "dynamic" user ids, that are allocated as long as a service...
Lennart Poettering [Thu, 14 Jul 2016 10:37:28 +0000 (12:37 +0200)]
core: add a concept of "dynamic" user ids, that are allocated as long as a service is running

This adds a new boolean setting DynamicUser= to service files. If set, a new
user will be allocated dynamically when the unit is started, and released when
it is stopped. The user ID is allocated from the range 61184..65519. The user
will not be added to /etc/passwd (but an NSS module to be added later should
make it show up in getent passwd).

For now, care should be taken that the service writes no files to disk, since
this might result in files owned by UIDs that might get assigned dynamically to
a different service later on. Later patches will tighten sandboxing in order to
ensure that this cannot happen, except for a few selected directories.

A simple way to test this is:

        systemd-run -p DynamicUser=1 /bin/sleep 99999

8 years agocore: be stricter when parsing User=/Group= fields
Lennart Poettering [Thu, 14 Jul 2016 10:28:06 +0000 (12:28 +0200)]
core: be stricter when parsing User=/Group= fields

Let's verify the validity of the syntax of the user/group names set.

8 years agosysusers: move various user credential validity checks to src/basic/
Lennart Poettering [Thu, 14 Jul 2016 10:23:39 +0000 (12:23 +0200)]
sysusers: move various user credential validity checks to src/basic/

This way we can reuse them for validating User=/Group= settings in unit files
(to be added in a later commit).

Also, add some tests for them.

8 years agocore: check for overflow when handling scaled MemoryLimit= settings
Lennart Poettering [Fri, 22 Jul 2016 13:30:23 +0000 (15:30 +0200)]
core: check for overflow when handling scaled MemoryLimit= settings

Just in case...

8 years agomacros.systemd.in: add %systemd_ordering (#3776)
Harald Hoyer [Fri, 22 Jul 2016 13:33:13 +0000 (15:33 +0200)]
macros.systemd.in: add %systemd_ordering (#3776)

To remove the hard dependency on systemd, for packages, which function
without a running systemd the %systemd_ordering macro can be used to
ensure ordering in the rpm transaction. %systemd_ordering makes sure,
the systemd rpm is installed prior to the package, so the %pre/%post
scripts can execute the systemd parts.

Installing systemd afterwards though, does not result in the same outcome.

8 years agocore: change TasksMax= default for system services to 15%
Lennart Poettering [Tue, 19 Jul 2016 15:29:00 +0000 (17:29 +0200)]
core: change TasksMax= default for system services to 15%

As it turns out 512 is max number of tasks per service is hit by too many
applications, hence let's bump it a bit, and make it relative to the system's
maximum number of PIDs. With this change the new default is 15%. At the
kernel's default pids_max value of 32768 this translates to 4915. At machined's
default TasksMax= setting of 16384 this translates to 2457.

Why 15%? Because it sounds like a round number and is close enough to 4096
which I was going for, i.e. an eight-fold increase over the old 512

Summary:

            | on the host | in a container
old default |         512 |           512
new default |        4915 |          2457

8 years agologind: change TasksMax= value for user logins to 33%
Lennart Poettering [Tue, 19 Jul 2016 15:19:58 +0000 (17:19 +0200)]
logind: change TasksMax= value for user logins to 33%

Let's change from a fixed value of 12288 tasks per user to a relative value of
33%, which with the kernel's default of 32768 translates to 10813. This is a
slight decrease of the limit, for no other reason than "33%" sounding like a nice
round number that is close enough to 12288 (which would translate to 37.5%).
(Well, it also has the nice effect of still leaving a bit of room in the PID
space if there are 3 cooperating evil users that try to consume all PIDs...
Also, I like my bikesheds blue).

Since the new value is taken relative, and machined's TasksMax= setting
defaults to 16384, 33% inside of containers is usually equivalent to 5406,
which should still be ample space.

To summarize:

               | on the host | in the container
   old default |       12288 |            12288
   new default |       10813 |             5406

8 years agomain: simplify things a bit by moving container check into fixup_environment()
Lennart Poettering [Tue, 19 Jul 2016 15:00:36 +0000 (17:00 +0200)]
main: simplify things a bit by moving container check into fixup_environment()

8 years agocore: rename MemoryLimitByPhysicalMemory transient property to MemoryLimitScale
Lennart Poettering [Tue, 19 Jul 2016 14:10:15 +0000 (16:10 +0200)]
core: rename MemoryLimitByPhysicalMemory transient property to MemoryLimitScale

That way, we can neatly keep this in line with the new TasksMaxScale= option.

Note that we didn't release a version with MemoryLimitByPhysicalMemory= yet,
hence this change should be unproblematic without breaking API.

8 years agocore: support percentage specifications on TasksMax=
Lennart Poettering [Tue, 19 Jul 2016 13:58:49 +0000 (15:58 +0200)]
core: support percentage specifications on TasksMax=

This adds support for a TasksMax=40% syntax for specifying values relative to
the system's configured maximum number of processes. This is useful in order to
neatly subdivide the available room for tasks within containers.

8 years agomachine-id-setup: add new --print switch
Lennart Poettering [Fri, 22 Jul 2016 10:21:21 +0000 (12:21 +0200)]
machine-id-setup: add new --print switch

If specified we'll simply output the used machine ID.

8 years agocore: rework machine-id-setup.c to use the calls from id128-util.[ch]
Lennart Poettering [Fri, 22 Jul 2016 10:12:27 +0000 (12:12 +0200)]
core: rework machine-id-setup.c to use the calls from id128-util.[ch]

This allows us to delete quite a bit of code and make the whole thing a lot
shorter.

8 years agosd-id128: handle NULL return parameter in sd_id128_from_string() nicer
Lennart Poettering [Thu, 21 Jul 2016 18:23:51 +0000 (20:23 +0200)]
sd-id128: handle NULL return parameter in sd_id128_from_string() nicer

If the return parameter is NULL, simply validate the string, and return no
error.

8 years agomain: make sure set_machine_id() doesn't clobber arg_machine_id on failure
Lennart Poettering [Thu, 21 Jul 2016 18:22:42 +0000 (20:22 +0200)]
main: make sure set_machine_id() doesn't clobber arg_machine_id on failure

8 years agomachine-id-setup: port machine_id_commit() to new id128-util.c APIs
Lennart Poettering [Thu, 21 Jul 2016 17:12:50 +0000 (19:12 +0200)]
machine-id-setup: port machine_id_commit() to new id128-util.c APIs

8 years agonspawn: rework /etc/machine-id handling
Lennart Poettering [Thu, 21 Jul 2016 16:53:40 +0000 (18:53 +0200)]
nspawn: rework /etc/machine-id handling

With this change we'll no longer write to /etc/machine-id from nspawn, as that
breaks the --volatile= operation, as it ensures the image is never considered
in "first boot", since that's bound to the pre-existance of /etc/machine-id.

The new logic works like this:

- If /etc/machine-id already exists in the container, it is read by nspawn and
  exposed in "machinectl status" and friends.

- If the file doesn't exist yet, but --uuid= is passed on the nspawn cmdline,
  this UUID is passed in $container_uuid to PID 1, and PID 1 is then expected
  to persist this to /etc/machine-id for future boots (which systemd already
  does).

- If the file doesn#t exist yet, and no --uuid= is passed a random UUID is
  generated and passed via $container_uuid.

The result is that /etc/machine-id is never initialized by nspawn itself, thus
unbreaking the volatile mode. However still the machine ID configured in the
machine always matches nspawn's and thus machined's idea of it.

Fixes: #3611

8 years agosystemctl: fix format string for uint64_t field
Lennart Poettering [Thu, 21 Jul 2016 16:08:52 +0000 (18:08 +0200)]
systemctl: fix format string for uint64_t field

8 years agosystemctl: fix output alignment in "systemctl status"
Lennart Poettering [Thu, 21 Jul 2016 16:05:58 +0000 (18:05 +0200)]
systemctl: fix output alignment in "systemctl status"

If we show both a control and a main PID for a service fix this line in the
output of "systemctl status":

 Main PID: 19670 (sleep);         : 19671 (sleep)

to become this:

 Main PID: 19670 (sleep); Control PID: 19671 (sleep)

8 years agonspawn: rework machine/boot ID handling code to use new calls from id128-util.[ch]
Lennart Poettering [Thu, 21 Jul 2016 16:01:55 +0000 (18:01 +0200)]
nspawn: rework machine/boot ID handling code to use new calls from id128-util.[ch]

8 years agosd-id128: split UUID file read/write code into new id128-util.[ch]
Lennart Poettering [Thu, 21 Jul 2016 15:57:57 +0000 (17:57 +0200)]
sd-id128: split UUID file read/write code into new id128-util.[ch]

We currently have code to read and write files containing UUIDs at various
places. Unify this in id128-util.[ch], and move some other stuff there too.

The new files are located in src/libsystemd/sd-id128/ (instead of src/shared/),
because they are actually the backend of sd_id128_get_machine() and
sd_id128_get_boot().

In follow-up patches we can use this reduce the code in nspawn and
machine-id-setup by adopted the common implementation.

8 years agotree-wide: use sd_id128_is_null() instead of sd_id128_equal where appropriate
Lennart Poettering [Thu, 21 Jul 2016 14:06:31 +0000 (16:06 +0200)]
tree-wide: use sd_id128_is_null() instead of sd_id128_equal where appropriate

It's a bit easier to read because shorter. Also, most likely a tiny bit faster.

8 years agoMerge pull request #3762 from poettering/sigkill-log
Martin Pitt [Fri, 22 Jul 2016 07:18:30 +0000 (09:18 +0200)]
Merge pull request #3762 from poettering/sigkill-log

log about all processes we forcibly kill

8 years agoMerge pull request #3764 from poettering/assorted-stuff-2
Martin Pitt [Fri, 22 Jul 2016 07:10:04 +0000 (09:10 +0200)]
Merge pull request #3764 from poettering/assorted-stuff-2

Assorted fixes

8 years agonspawn: enable major=0/minor=0 devices inside the container (#3773)
Alessandro Puccetti [Thu, 21 Jul 2016 15:39:38 +0000 (17:39 +0200)]
nspawn: enable major=0/minor=0 devices inside the container (#3773)

https://github.com/systemd/systemd/pull/3685 introduced
/run/systemd/inaccessible/{chr,blk} to map inacessible devices,
this patch allows systemd running inside a nspawn container to create
/run/systemd/inaccessible/{chr,blk}.