platform/upstream/systemd.git
8 years agocore: lets move the setup of working directory before group enforce
Djalal Harouni [Fri, 21 Oct 2016 20:22:56 +0000 (22:22 +0200)]
core: lets move the setup of working directory before group enforce

This is minor but lets try to split and move bit by bit cgroups and
portable environment setup before applying the security context.

8 years agotest: add more tests for SupplementaryGroups=
Djalal Harouni [Mon, 17 Oct 2016 08:06:18 +0000 (10:06 +0200)]
test: add more tests for SupplementaryGroups=

8 years agotest: Add simple test for supplementary groups
Djalal Harouni [Fri, 14 Oct 2016 08:32:27 +0000 (10:32 +0200)]
test: Add simple test for supplementary groups

8 years agocore: first lookup and cache creds then apply them after namespace setup
Djalal Harouni [Sun, 23 Oct 2016 21:24:14 +0000 (23:24 +0200)]
core: first lookup and cache creds then apply them after namespace setup

This fixes: https://github.com/systemd/systemd/issues/4357

Let's lookup and cache creds then apply them. We also switch from
getgroups() to getgrouplist().

8 years agoMerge pull request #4428 from lnykryn/ctrl_v2
Zbigniew Jędrzejewski-Szmek [Sun, 23 Oct 2016 03:16:11 +0000 (23:16 -0400)]
Merge pull request #4428 from lnykryn/ctrl_v2

rename failure-action to emergency-action and use it for ctrl+alt+del burst

8 years agoMerge pull request #4455 from endocode/dongsu/l10n-catalog-korean
Daniel Mack [Sat, 22 Oct 2016 18:01:02 +0000 (20:01 +0200)]
Merge pull request #4455 from endocode/dongsu/l10n-catalog-korean

catalog: add more Korean translations

8 years agocatalog: add more Korean translations
Dongsu Park [Sat, 22 Oct 2016 15:29:38 +0000 (17:29 +0200)]
catalog: add more Korean translations

Add more Korean translations of journal and DNSSEC log messages.

8 years agocatalog: fix typo and make a clear sentence
Dongsu Park [Sat, 22 Oct 2016 15:29:33 +0000 (17:29 +0200)]
catalog: fix typo and make a clear sentence

Fix typo: s/ournald.conf/journald.conf/
Change also "시스템의 다음 위치에" to "시스템을 별도 위치에" to make
a clear sentence.

8 years agojournal: remove unused variable
Thomas Hindoe Paaboel Andersen [Sat, 22 Oct 2016 12:01:20 +0000 (14:01 +0200)]
journal: remove unused variable

8 years agoMerge pull request #4452 from jwilk/spelling
Michael Biebl [Sat, 22 Oct 2016 13:31:58 +0000 (15:31 +0200)]
Merge pull request #4452 from jwilk/spelling

NEWS: fix typos

8 years agoNEWS: fix typos
Jakub Wilk [Sat, 22 Oct 2016 11:18:17 +0000 (13:18 +0200)]
NEWS: fix typos

8 years agojournald: systemd.journald.max_level_* kernel command line options (#4427)
Umut Tezduyar Lindskog [Fri, 21 Oct 2016 23:40:55 +0000 (01:40 +0200)]
journald: systemd.journald.max_level_* kernel command line options (#4427)

The log forward levels can be configured through kernel command line.

8 years agoNEWS: option is ProtectKernelTunables not ProtectedKernelTunables (#4451)
Djalal Harouni [Fri, 21 Oct 2016 22:43:36 +0000 (00:43 +0200)]
NEWS: option is ProtectKernelTunables not ProtectedKernelTunables (#4451)

8 years agoMerge pull request #4447 from poettering/oneshotassertfix
Daniel Mack [Fri, 21 Oct 2016 14:22:15 +0000 (16:22 +0200)]
Merge pull request #4447 from poettering/oneshotassertfix

core: if the start command vanishes during runtime don't hit an assert

8 years agocore: use emergency_action for ctr+alt+del burst
Lukas Nykryn [Tue, 18 Oct 2016 10:16:32 +0000 (12:16 +0200)]
core: use emergency_action for ctr+alt+del burst

Fixes #4306

8 years agofailure-action: generalize failure action to emergency action
Lukas Nykryn [Thu, 20 Oct 2016 13:27:37 +0000 (15:27 +0200)]
failure-action: generalize failure action to emergency action

8 years agoNEWS: update NEWS about ProtectKernelModules= option (#4445)
Djalal Harouni [Fri, 21 Oct 2016 11:25:23 +0000 (13:25 +0200)]
NEWS: update NEWS about ProtectKernelModules= option (#4445)

8 years agoMerge pull request #4419 from keszybz/install-specifiers
Lennart Poettering [Fri, 21 Oct 2016 11:24:09 +0000 (13:24 +0200)]
Merge pull request #4419 from keszybz/install-specifiers

Fix expansion of %i, %u, %N, %n install specifiers

8 years agohwdb: add MOUSE_WHEEL_CLICK_COUNT for non-integer click angles (#4440)
Peter Hutterer [Fri, 21 Oct 2016 10:31:32 +0000 (20:31 +1000)]
hwdb: add MOUSE_WHEEL_CLICK_COUNT for non-integer click angles (#4440)

MOUSE_WHEEL_CLICK_ANGLE has been an integer, and at least libinput (probably
the only user) parses it as strict integer. For backwards compatibility, we
cannot change it to a decimal number now.

Add a new property to list the number of clicks for a full 360 degree
rotation, to be specified in addition to the old click angle property. Clients
can prefer the new one where available and calculate the decimal value to
whatever precision they want.

8 years agosysusers: fix memleak (#4443)
Evgeny Vereshchagin [Fri, 21 Oct 2016 10:30:45 +0000 (13:30 +0300)]
sysusers: fix memleak (#4443)

Fixes:
Oct 20 09:10:49 systemd-sysusers[144]: Direct leak of 20 byte(s) in 1 object(s) allocated from:
Oct 20 09:10:49 systemd-sysusers[144]:     #0 0x7f3565a13e60 in malloc (/lib64/libasan.so.3+0xc6e60)
Oct 20 09:10:49 systemd-sysusers[144]:     #1 0x7f3565526bd0 in malloc_multiply src/basic/alloc-util.h:70
Oct 20 09:10:49 systemd-sysusers[144]:     #2 0x7f356552cb55 in tempfn_xxxxxx src/basic/fileio.c:1116
Oct 20 09:10:49 systemd-sysusers[144]:     #3 0x7f356552c4f0 in fopen_temporary src/basic/fileio.c:1042
Oct 20 09:10:49 systemd-sysusers[144]:     #4 0x7f356555e00e in fopen_temporary_label src/basic/fileio-label.c:63
Oct 20 09:10:49 systemd-sysusers[144]:     #5 0x56197c4a1766 in make_backup src/sysusers/sysusers.c:209
Oct 20 09:10:49 systemd-sysusers[144]:     #6 0x56197c4a6335 in write_files src/sysusers/sysusers.c:710
Oct 20 09:10:49 systemd-sysusers[144]:     #7 0x56197c4ae571 in main src/sysusers/sysusers.c:1817
Oct 20 09:10:49 systemd-sysusers[144]:     #8 0x7f3564dee730 in __libc_start_main (/lib64/libc.so.6+0x20730)

8 years agocore: if the start command vanishes during runtime don't hit an assert
Lennart Poettering [Fri, 21 Oct 2016 10:27:46 +0000 (12:27 +0200)]
core: if the start command vanishes during runtime don't hit an assert

This can happen when the configuration is changed and reloaded while we are
executing a service. Let's not hit an assert in this case.

Fixes: #4444

8 years agoRevert "add networkd dbus lease info" (#4435)
Zbigniew Jędrzejewski-Szmek [Fri, 21 Oct 2016 06:17:16 +0000 (02:17 -0400)]
Revert "add networkd dbus lease info" (#4435)

8 years agonspawn, NEWS: add missing "s" in --private-users-chown (#4438)
Zbigniew Jędrzejewski-Szmek [Fri, 21 Oct 2016 03:03:26 +0000 (23:03 -0400)]
nspawn, NEWS: add missing "s" in --private-users-chown (#4438)

8 years agosysusers: fix memleak (#4430)
Evgeny Vereshchagin [Thu, 20 Oct 2016 18:23:32 +0000 (21:23 +0300)]
sysusers: fix memleak (#4430)

Fixes:
```
==28075== 64 bytes in 1 blocks are definitely lost in loss record 2 of 3
==28075==    at 0x4C2BAEE: malloc (vg_replace_malloc.c:298)
==28075==    by 0x4C2DCA1: realloc (vg_replace_malloc.c:785)
==28075==    by 0x4ED40A2: greedy_realloc (alloc-util.c:57)
==28075==    by 0x4E90F87: extract_first_word (extract-word.c:78)
==28075==    by 0x4E91813: extract_many_words (extract-word.c:270)
==28075==    by 0x10FE93: parse_line (sysusers.c:1325)
==28075==    by 0x11198B: read_config_file (sysusers.c:1640)
==28075==    by 0x111EB8: main (sysusers.c:1773)
==28075==
```

8 years agoupdate-utmp: let's use STR_IN_SET() where it is pretty
Lennart Poettering [Thu, 20 Oct 2016 17:20:22 +0000 (19:20 +0200)]
update-utmp: let's use STR_IN_SET() where it is pretty

8 years agologind: don't hit assert when we try to free NULL manager object
Lennart Poettering [Thu, 20 Oct 2016 17:19:46 +0000 (19:19 +0200)]
logind: don't hit assert when we try to free NULL manager object

Fixes: #4431

8 years agoupdate TODO
Lennart Poettering [Thu, 20 Oct 2016 17:19:34 +0000 (19:19 +0200)]
update TODO

8 years agosysctl: run sysctl service if /proc/sys/net is writable (#4425)
Lennart Poettering [Thu, 20 Oct 2016 17:36:28 +0000 (19:36 +0200)]
sysctl: run sysctl service if /proc/sys/net is writable (#4425)

This simply changes this line:

    ConditionPathIsReadWrite=/proc/sys/

to this:

     ConditionPathIsReadWrite=/proc/sys/net/

The background for this is that the latter is namespaced through network
namespacing usually and hence frequently set as writable in containers, even
though the former is kept read-only. If /proc/sys is read-only but
/proc/sys/net is writable we should run the sysctl service, as useful settings
may be made in this case.

Fixes: #4370

8 years agounits: extend stop timeout for user@.service to 120s (#4426)
Lennart Poettering [Thu, 20 Oct 2016 15:45:27 +0000 (17:45 +0200)]
units: extend stop timeout for user@.service to 120s (#4426)

By default all user and all system services get stop timeouts for 90s. This is
problematic as the user manager of course is run as system service. Thus, if
the default time-out is hit for any user service, then it will also be hit for
user@.service as a whole, thus making the whole concept useless for user
services.

This patch extends the stop timeout to 120s for user@.service hence, so that
that the user service manager has ample time to process user services timing
out.

(The other option would have been to shorten the default user service timeout,
but I think a user service should get the same timeout by default as a system
service)

Fixes: #4206

8 years agotests: fix memleak in test-calendarspec (#4424)
Evgeny Vereshchagin [Thu, 20 Oct 2016 15:44:30 +0000 (18:44 +0300)]
tests: fix memleak in test-calendarspec (#4424)

Fixes:
```
==10750==
==10750== HEAP SUMMARY:
==10750==     in use at exit: 96 bytes in 3 blocks
==10750==   total heap usage: 1,711 allocs, 1,708 frees, 854,545 bytes
allocated
==10750==
==10750== 96 (64 direct, 32 indirect) bytes in 1 blocks are definitely
lost in loss record 3 of 3
==10750==    at 0x4C2DA60: calloc (vg_replace_malloc.c:711)
==10750==    by 0x4EB3BDA: calendar_spec_from_string
(calendarspec.c:771)
==10750==    by 0x109675: test_hourly_bug_4031 (test-calendarspec.c:118)
==10750==    by 0x10A00E: main (test-calendarspec.c:202)
==10750==
==10750== LEAK SUMMARY:
==10750==    definitely lost: 64 bytes in 1 blocks
==10750==    indirectly lost: 32 bytes in 2 blocks
==10750==      possibly lost: 0 bytes in 0 blocks
==10750==    still reachable: 0 bytes in 0 blocks
==10750==         suppressed: 0 bytes in 0 blocks
==10750==
==10750== For counts of detected and suppressed errors, rerun with: -v
==10750== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
```

8 years agoMerge pull request #4418 from keszybz/autogen-params
Martin Pitt [Thu, 20 Oct 2016 15:43:42 +0000 (17:43 +0200)]
Merge pull request #4418 from keszybz/autogen-params

Allow ./autogen.sh to take parameters for configure

8 years agoMerge pull request #4414 from poettering/consolesakcomment
Zbigniew Jędrzejewski-Szmek [Thu, 20 Oct 2016 13:35:40 +0000 (09:35 -0400)]
Merge pull request #4414 from poettering/consolesakcomment

three minor fixes: document /dev/console/SAK handling + another cgroups wording fix + document User= default

8 years agoshared/install: fix %u expansion when running under sudo
Zbigniew Jędrzejewski-Szmek [Thu, 20 Oct 2016 04:27:46 +0000 (00:27 -0400)]
shared/install: fix %u expansion when running under sudo

Test case:
[Install]
DefaultInstance=bond1
WantedBy= foobar-U-%U.device
WantedBy= foobar-u-%u.device

$ sudo systemctl --root=/ enable testing4@.service
(before)
Created symlink /etc/systemd/system/foobar-U-0.device.wants/testing4@bond1.service → /etc/systemd/system/testing4@.service.
Created symlink /etc/systemd/system/foobar-u-zbyszek.device.wants/testing4@bond1.service → /etc/systemd/system/testing4@.service.

(after)
Created symlink /etc/systemd/system/foobar-U-0.device.wants/testing4@bond1.service → /etc/systemd/system/testing4@.service.
Created symlink /etc/systemd/system/foobar-u-root.device.wants/testing4@bond1.service → /etc/systemd/system/testing4@.service.

It doesn't make much sense to use a different user for %U and %u.

8 years agoshared/install: fix DefaultInstance expansion in %n, %N
Zbigniew Jędrzejewski-Szmek [Thu, 20 Oct 2016 04:27:46 +0000 (00:27 -0400)]
shared/install: fix DefaultInstance expansion in %n, %N

We should substitute DefaultInstance if the instance is not specified.

Test case:
[Install]
DefaultInstance=bond1
WantedBy= foobar-n-%n.device
WantedBy= foobar-N-%N.device

$ systemctl --root=/ enable testing4@.service
Created symlink /etc/systemd/system/foobar-n-testing4@bond1.service.device.wants/testing4@bond1.service → /etc/systemd/system/testing4@.service.
Created symlink /etc/systemd/system/foobar-N-testing4@bond1.device.wants/testing4@bond1.service → /etc/systemd/system/testing4@.service.

(before, the symlink would be created with empty %n, %N parts).

8 years agoshared/install: fix DefaultInstance expansion in %i
Zbigniew Jędrzejewski-Szmek [Thu, 20 Oct 2016 04:27:46 +0000 (00:27 -0400)]
shared/install: fix DefaultInstance expansion in %i

We should substitute DefaultInstance if the instance is not specified.

Test case:
[Install]
DefaultInstance=bond1
WantedBy= foobar-i-%i.device

$ systemctl --root=/ enable testing4@.service
Created symlink /etc/systemd/system/foobar-i-bond1.device.wants/testing4@bond1.service
 → /etc/systemd/system/testing4@.service.
(before, the symlink would be created as
/etc/systemd/system/foobar-i-.device.wants/testing4@bond1.service)

Fixes #4411.

8 years agoman: document default for User=
Lennart Poettering [Wed, 19 Oct 2016 21:40:31 +0000 (23:40 +0200)]
man: document default for User=

Replaces: #4375

8 years agojournald,core: add short comments we we keep reopening /dev/console all the time
Lennart Poettering [Wed, 19 Oct 2016 21:30:50 +0000 (23:30 +0200)]
journald,core: add short comments we we keep reopening /dev/console all the time

Just to make sure the next one reading this isn't surprised that the fd isn't
kept open. SAK and stuff...

Fix suggested:

https://github.com/systemd/systemd/pull/4366#issuecomment-253659162

8 years agoman: one more cgroup wording fix
Lennart Poettering [Tue, 18 Oct 2016 14:18:08 +0000 (16:18 +0200)]
man: one more cgroup wording fix

8 years agoMerge pull request #4417 from keszybz/man-and-rlimit
Lennart Poettering [Thu, 20 Oct 2016 11:10:37 +0000 (13:10 +0200)]
Merge pull request #4417 from keszybz/man-and-rlimit

Two unrelated patches: man page tweaks and rlimit log levels

8 years agohwdb: Update database of Bluetooth company identifiers
Marcel Holtmann [Thu, 20 Oct 2016 08:24:18 +0000 (10:24 +0200)]
hwdb: Update database of Bluetooth company identifiers

8 years agobuild-sys: show configure and make commands
Zbigniew Jędrzejewski-Szmek [Thu, 20 Oct 2016 02:57:02 +0000 (22:57 -0400)]
build-sys: show configure and make commands

And also hide make clean output which is very verbose and not particularly
interesting.

8 years agobuild-sys: allow autogen.sh to take configure params
Zbigniew Jędrzejewski-Szmek [Thu, 20 Oct 2016 02:49:22 +0000 (22:49 -0400)]
build-sys: allow autogen.sh to take configure params

It is sometimes nice to run autogen with some configure parameters.
For example:

  ./autogen.sh c --disable-manpages

So pass any extra args after the [cgals] verb to the configure command.

Also, check that the verb is correct (empty or one of the known letters)
before doing any non-trivial work.

8 years agopid1: downgrade some rlimit warnings
Zbigniew Jędrzejewski-Szmek [Tue, 18 Oct 2016 17:38:41 +0000 (13:38 -0400)]
pid1: downgrade some rlimit warnings

Since we ignore the result anyway, downgrade errors to warning.

log_oom() will still emit an error, but that's mostly theoretical, so it
is not worth complicating the code to avoid the small inconsistency

8 years agocore: let's upgrade the log level for service processes dying of signal (#4415)
Lennart Poettering [Wed, 19 Oct 2016 23:48:35 +0000 (01:48 +0200)]
core: let's upgrade the log level for service processes dying of signal (#4415)

As suggested in
https://github.com/systemd/systemd/pull/4367#issuecomment-253670328

8 years agoMerge pull request #4360 from fbuihuu/journald-fix-flush-when-restarting
Lennart Poettering [Wed, 19 Oct 2016 22:10:08 +0000 (00:10 +0200)]
Merge pull request #4360 from fbuihuu/journald-fix-flush-when-restarting

Journald fix flush when restarting (#4190)

8 years agoman: document dependencies implied by Sockets= (#4412)
Lucas Werkmeister [Wed, 19 Oct 2016 21:21:26 +0000 (23:21 +0200)]
man: document dependencies implied by Sockets= (#4412)

Fixes #4410. Also includes two minor improvements to the previous
sentence.

8 years agoMerge pull request #4378 from evverx/nspawn-smoke-test
Lennart Poettering [Wed, 19 Oct 2016 19:35:39 +0000 (21:35 +0200)]
Merge pull request #4378 from evverx/nspawn-smoke-test

tests: add smoke test for systemd-nspawn

8 years agoMerge pull request #4390 from keszybz/install-specifiers
Lennart Poettering [Wed, 19 Oct 2016 19:33:32 +0000 (21:33 +0200)]
Merge pull request #4390 from keszybz/install-specifiers

Various install-related tweaks

8 years agobootctl: don't try to remove esp_path (#4407)
Evgeny Vereshchagin [Wed, 19 Oct 2016 19:15:20 +0000 (22:15 +0300)]
bootctl: don't try to remove esp_path (#4407)

This is a follow-up for 9ee051b9c7623

8 years agoboot: fix `bootctl install` segfault (#4404)
Yu Watanabe [Wed, 19 Oct 2016 11:50:47 +0000 (20:50 +0900)]
boot: fix `bootctl install` segfault (#4404)

8 years agojournal: rename determine_space_for() into cache_space_refresh()
Franck Bui [Wed, 12 Oct 2016 08:09:45 +0000 (10:09 +0200)]
journal: rename determine_space_for() into cache_space_refresh()

Now that determine_space_for() only deals with storage space (cached) values,
rename it so it reflects the fact that only the cached storage space values are
updated.

8 years agojournal: introduce patch_min_use() helper
Franck Bui [Wed, 12 Oct 2016 07:58:10 +0000 (09:58 +0200)]
journal: introduce patch_min_use() helper

Updating min_use is rather an unusual operation that is limited when we first
open the journal files, therefore extracts it from determine_space_for() and
create a function of its own and call this new function when needed.

determine_space_for() is now dealing with storage space (cached) values only.

There should be no functional changes.

8 years agojournal: introduce cache_space_invalidate()
Franck Bui [Wed, 12 Oct 2016 07:05:55 +0000 (09:05 +0200)]
journal: introduce cache_space_invalidate()

Introduce a dedicated helper in order to reset the storage space cache.

8 years agojournal: cache used vfs stats as well
Franck Bui [Wed, 12 Oct 2016 06:58:04 +0000 (08:58 +0200)]
journal: cache used vfs stats as well

The set of storage space values we cache are calculated according to a couple
of filesystem statistics (free blocks, block size).

This patch caches the vfs stats we're interested in so these values are
available later and coherent with the rest of the space cached values.

8 years agojournal: don't emit space usage message when opening the journal (#4190)
Franck Bui [Tue, 11 Oct 2016 14:51:37 +0000 (16:51 +0200)]
journal: don't emit space usage message when opening the journal (#4190)

This patch makes system_journal_open() stop emitting the space usage
message. The caller is now free to emit this message when appropriate.

When restarting the journal, we can now emit the message *after*
flushing the journal (if required) so that all flushed log entries are
written in the persistent journal *before* the status message.

This is required since the status message is always younger than the
flushed entries.

Fixes #4190.

8 years agojournal: introduce server_space_usage_message()
Franck Bui [Tue, 11 Oct 2016 14:46:16 +0000 (16:46 +0200)]
journal: introduce server_space_usage_message()

This commit simply extracts from determine_space_for() the code which emits the
storage usage message and put it into a function of its own so it can be reused
by others paths later.

No functional changes.

8 years agojournal: introduce JournalStorage and JournalStorageSpace structures
Franck Bui [Tue, 4 Oct 2016 15:13:21 +0000 (17:13 +0200)]
journal: introduce JournalStorage and JournalStorageSpace structures

This structure keeps track of specificities for a given journal type
(persistent or volatile) such as metrics, name, etc...

The cached space values are now moved in this structure so that each
journal has its own set of cached values.

Previously only one set existed and we didn't know if the cached
values were for the runtime journal or the persistent one.

When doing:

   determine_space_for(s, runtime_metrics, ...);
   determine_space_for(s, system_metrics, ...);

the second call returned the cached values for the runtime metrics.

8 years agojournal: introduce determine_path_usage()
Franck Bui [Mon, 3 Oct 2016 16:12:41 +0000 (18:12 +0200)]
journal: introduce determine_path_usage()

This commit simply extracts from determine_space_for() the code which
determines the FS usage where the passed path lives (statvfs(3)) and put it
into a function of its own so it can be reused by others paths later.

No functional changes.

8 years agoshared/install: report invalid unit files slightly better
Zbigniew Jędrzejewski-Szmek [Mon, 17 Oct 2016 02:57:38 +0000 (22:57 -0400)]
shared/install: report invalid unit files slightly better

When a unit file is invalid, we'd return an error without any details:
$ systemctl --root=/ enable testing@instance.service
Failed to enable: Invalid argument.

Fix things to at least print the offending file name:
$ systemctl enable testing@instance.service
Failed to enable unit: File testing@instance.service: Invalid argument

$ systemctl --root=/ enable testing@instance.service
Failed to enable unit, file testing@instance.service: Invalid argument.

A real fix would be to pass back a proper error message from conf-parser.
But this would require major surgery, since conf-parser functions now
simply print log errors, but we would need to return them over the bus.
So let's just print the file name, to indicate where the error is.

(Incomplete) fix for #4210.

8 years agoshared/install: resolve specifiers in Also=
Zbigniew Jędrzejewski-Szmek [Mon, 17 Oct 2016 01:40:41 +0000 (21:40 -0400)]
shared/install: resolve specifiers in Also=

Test case:
[Install]
WantedBy= default.target
Also=getty@%p.service

$ ./systemctl --root=/ enable testing@instance.service
Created symlink /etc/systemd/system/default.target.wants/testing@instance.service → /etc/systemd/system/testing@.service.
Created symlink /etc/systemd/system/getty.target.wants/getty@testing.service → /usr/lib/systemd/system/getty@.service.
$ ./systemctl --root=/ disable testing@instance.service
Removed /etc/systemd/system/getty.target.wants/getty@testing.service.
Removed /etc/systemd/system/default.target.wants/testing@instance.service.

Fixes part of #4210.

Resolving specifiers in DefaultInstance seems to work too:
[Install]
WantedBy= default.target
DefaultInstance=%u

$ systemctl --root=/ enable testing3@instance.service
Created symlink /etc/systemd/system/default.target.wants/testing3@instance.service → /etc/systemd/system/testing3@.service.
$ systemctl --root=/ enable testing3@.service
Created symlink /etc/systemd/system/default.target.wants/testing3@zbyszek.service → /etc/systemd/system/testing3@.service.

8 years agoshared/install: provide more info if install_info_traverse_fails
Zbigniew Jędrzejewski-Szmek [Mon, 17 Oct 2016 01:27:57 +0000 (21:27 -0400)]
shared/install: provide more info if install_info_traverse_fails

Test case:
[Install]
WantedBy= default.target
Also=foobar-unknown.service

Before:
$ systemctl --root=/ enable testing2@instance.service
Failed to enable: No such file or directory.

After
$ ./systemctl --root=/ enable testing2@instance.service
Failed to enable unit, file foobar-unknown.service: No such file or directory.

8 years agoshared/install: in install_context_mark_for_removal ignore not found units
Zbigniew Jędrzejewski-Szmek [Mon, 17 Oct 2016 00:56:31 +0000 (20:56 -0400)]
shared/install: in install_context_mark_for_removal ignore not found units

With the following test case:
[Install]
WantedBy= default.target
Also=foobar-unknown.service

disabling would fail with:
$ ./systemctl --root=/ disable testing.service
Cannot find unit foobar-unknown.service.       # this is level debug
Failed to disable: No such file or directory.  # this is the error

After the change we proceed:
$ ./systemctl --root=/ disable testing.service
Cannot find unit foobar-unknown.service.
Removed /etc/systemd/system/default.target.wants/testing.service.

This does not affect specifying a missing unit directly:
$ ./systemctl --root=/ disable nosuch.service
Failed to disable: No such file or directory.

8 years agoMerge pull request #4382 from keszybz/unit-type-underline
Lennart Poettering [Tue, 18 Oct 2016 15:03:40 +0000 (17:03 +0200)]
Merge pull request #4382 from keszybz/unit-type-underline

systemctl: use underlines to seperate unit types in listing

8 years agonetworkd: use proper cast to access VTI6 (#4399)
Susant Sahani [Tue, 18 Oct 2016 03:19:08 +0000 (08:49 +0530)]
networkd: use proper cast to access VTI6 (#4399)

Fixes #4371.

8 years agocore/exec: add a named-descriptor option ("fd") for streams (#4179)
Luca Bruno [Tue, 18 Oct 2016 00:05:49 +0000 (00:05 +0000)]
core/exec: add a named-descriptor option ("fd") for streams (#4179)

This commit adds a `fd` option to `StandardInput=`,
`StandardOutput=` and `StandardError=` properties in order to
connect standard streams to externally named descriptors provided
by some socket units.

This option looks for a file descriptor named as the corresponding
stream. Custom names can be specified, separated by a colon.
If multiple name-matches exist, the first matching fd will be used.

8 years agoREADME: list dependencies for testing
Zbigniew Jędrzejewski-Szmek [Sun, 16 Oct 2016 00:51:19 +0000 (20:51 -0400)]
README: list dependencies for testing

Fixes #4365.

8 years agotests: add smoke test for systemd-nspawn
Evgeny Vereshchagin [Fri, 14 Oct 2016 18:42:46 +0000 (18:42 +0000)]
tests: add smoke test for systemd-nspawn

Basically, this test runs:
```
    systemd-nspawn --register=no -D "$_root" -b
    systemd-nspawn --register=no -D "$_root" --private-network -b
    systemd-nspawn --register=no -D "$_root" -U -b
    systemd-nspawn --register=no -D "$_root" --private-network -U -b
```
and exports the `UNIFIED_CGROUP_HIERARCHY=[yes|no]`, `SYSTEMD_NSPAWN_USE_CGNS=[yes|no]`

Inspired by
* systemd#3589 (comment)
* systemd#4372 (comment)
* systemd#4223 (comment)
* systemd#1555

and so on :-)

8 years agoman: add a note that NULL "s" arg for sd_bus_message_append
Zbigniew Jędrzejewski-Szmek [Mon, 17 Oct 2016 16:22:44 +0000 (12:22 -0400)]
man: add a note that NULL "s" arg for sd_bus_message_append

8 years agoterminal-util: helper macro for highlighting functions
Zbigniew Jędrzejewski-Szmek [Mon, 17 Oct 2016 15:48:12 +0000 (11:48 -0400)]
terminal-util: helper macro for highlighting functions

8 years agosystemctl: ditto for list-unit-files
Zbigniew Jędrzejewski-Szmek [Mon, 17 Oct 2016 15:37:55 +0000 (11:37 -0400)]
systemctl: ditto for list-unit-files

8 years agosystemctl: use underlines to seperate unit types in listing
Zbigniew Jędrzejewski-Szmek [Mon, 17 Oct 2016 15:37:41 +0000 (11:37 -0400)]
systemctl: use underlines to seperate unit types in listing

(printf("%.*s", -1, "…") is the same as not specifying the precision at all.)

v2: also underline highlighted (failing) units

Fixes #4137.

8 years agoman: avoid abbreviated "cgroups" terminology (#4396)
Lennart Poettering [Mon, 17 Oct 2016 13:50:26 +0000 (15:50 +0200)]
man: avoid abbreviated "cgroups" terminology (#4396)

Let's avoid the overly abbreviated "cgroups" terminology. Let's instead write:

"Linux Control Groups (cgroups)" is the long form wherever the term is
introduced in prose. Use "control groups" in the short form wherever the term
is used within brief explanations.

Follow-up to: #4381

8 years agozsh-completion: fix for #4318 (#4394)
llua [Mon, 17 Oct 2016 12:35:26 +0000 (08:35 -0400)]
zsh-completion: fix for #4318 (#4394)

Escape unit names for the eval call in _call_program

The value of the Id property is transformed back into a unit name
usable by systemctl.
system-systemd\x5cx2dcryptsetup.slice -> system-systemd\x2dcryptsetup.slice

Also filter units by property via parameter expansion, not a for loop

8 years agoMerge pull request #4392 from keszybz/running-timers
Lennart Poettering [Mon, 17 Oct 2016 10:58:55 +0000 (12:58 +0200)]
Merge pull request #4392 from keszybz/running-timers

Fix for display of elapsed timers

8 years agoMerge pull request #4387 from keszybz/loginctl-tty
Lennart Poettering [Mon, 17 Oct 2016 09:36:25 +0000 (11:36 +0200)]
Merge pull request #4387 from keszybz/loginctl-tty

loginctl: print TTY field in the session listing

8 years agoshared/install: do not break loop when we enounter a dangling symlink
Zbigniew Jędrzejewski-Szmek [Mon, 17 Oct 2016 01:20:08 +0000 (21:20 -0400)]
shared/install: do not break loop when we enounter a dangling symlink

We should ignore that unit, but otherwise continue.

8 years agoman: mention that systemctl --root=/ operates on the fs directly
Zbigniew Jędrzejewski-Szmek [Sun, 16 Oct 2016 23:44:40 +0000 (19:44 -0400)]
man: mention that systemctl --root=/ operates on the fs directly

8 years agocore/timer: reset next_elapse_*time when timer is not waiting
Zbigniew Jędrzejewski-Szmek [Mon, 17 Oct 2016 06:05:30 +0000 (02:05 -0400)]
core/timer: reset next_elapse_*time when timer is not waiting

When the unit that is triggered by a timer is started and running,
we transition to "running" state, and the timer will not elapse again
until the unit has finished running. In this state "systemctl list-timers"
would display the previously calculated next elapse time, which would
now of course be in the past, leading to nonsensical values.

Simply set the next elapse to infinity, which causes list-timers to
show n/a. We cannot specify when the next elapse will happen, possibly
never.

Fixes #4031.

8 years agopid1: do not use mtime==0 as sign of masking (#4388)
Zbigniew Jędrzejewski-Szmek [Mon, 17 Oct 2016 05:15:03 +0000 (01:15 -0400)]
pid1: do not use mtime==0 as sign of masking (#4388)

It is allowed for unit files to have an mtime==0, so instead of assuming that
any file that had mtime==0 was masked, use the load_state to filter masked
units.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1384150.

8 years agoMerge pull request #4391 from keszybz/treewide-macros
Martin Pitt [Mon, 17 Oct 2016 05:12:20 +0000 (07:12 +0200)]
Merge pull request #4391 from keszybz/treewide-macros

Use mfree more and add another function to simplify a common set&free pattern

8 years agoMerge pull request #4381 from keszybz/man-pages
Martin Pitt [Mon, 17 Oct 2016 04:56:22 +0000 (06:56 +0200)]
Merge pull request #4381 from keszybz/man-pages

8 years agotest-calendarspec: test that hourly timers are incremented properly
Zbigniew Jędrzejewski-Szmek [Mon, 17 Oct 2016 04:08:43 +0000 (00:08 -0400)]
test-calendarspec: test that hourly timers are incremented properly

Apparently this works just fine, so the issue in #4031 is elsewhere.

8 years agotree-wide: introduce free_and_replace helper
Zbigniew Jędrzejewski-Szmek [Sun, 16 Oct 2016 23:23:35 +0000 (19:23 -0400)]
tree-wide: introduce free_and_replace helper

It's a common pattern, so add a helper for it. A macro is necessary
because a function that takes a pointer to a pointer would be type specific,
similarly to cleanup functions. Seems better to use a macro.

8 years agotree-wide: use mfree more
Zbigniew Jędrzejewski-Szmek [Sun, 16 Oct 2016 22:28:30 +0000 (18:28 -0400)]
tree-wide: use mfree more

8 years agoshared/install: use _cleanup_free_
Zbigniew Jędrzejewski-Szmek [Sun, 16 Oct 2016 21:59:37 +0000 (17:59 -0400)]
shared/install: use _cleanup_free_

Also rewrap some comments so that they don't have a very long line and a very
short line.

8 years agoMerge pull request #4380 from bgamari/master
Peter Hutterer [Mon, 17 Oct 2016 03:17:03 +0000 (13:17 +1000)]
Merge pull request #4380 from bgamari/master

hwdb: Add sensitivity for Dell Latitude E7470 pointing stick

8 years agologinctl: report tty in session listings
Zbigniew Jędrzejewski-Szmek [Sun, 16 Oct 2016 19:13:03 +0000 (15:13 -0400)]
loginctl: report tty in session listings

Without the tty it's really hard to tell which session is which.

New output:
$ ./loginctl
   SESSION        UID USER             SEAT             TTY
        13       1002 zbyszek          seat0            tty3
        c1         42 gdm              seat0            /dev/tty1
        11       1002 zbyszek          seat0            tty4
         3       1002 zbyszek          seat0            /dev/tty2
        17       1002 zbyszek          seat0            tty5
        18       1002 zbyszek          seat0            tty6
6 sessions listed.

8 years agologinctl: drop casts in printf
Zbigniew Jędrzejewski-Szmek [Sun, 16 Oct 2016 18:19:06 +0000 (14:19 -0400)]
loginctl: drop casts in printf

8 years agoman: document sd_event_get_tid() return value (#4385)
Martin Ejdestig [Sun, 16 Oct 2016 14:25:34 +0000 (16:25 +0200)]
man: document sd_event_get_tid() return value (#4385)

8 years agoman: drop discouragment of runtime and vendor drop-ins
Zbigniew Jędrzejewski-Szmek [Sat, 15 Oct 2016 20:46:13 +0000 (16:46 -0400)]
man: drop discouragment of runtime and vendor drop-ins

In certain situations drop-ins in /usr/lib/ are useful, for example when one package
wants to modify the behaviour of another package, or the vendor wants to tweak some
upstream unit without patching.

Drop-ins in /run are useful for testing, and may also be created by systemd itself.

Follow-up for the discussion in #2103.

8 years agoman: add journal-upload.conf(5)
Zbigniew Jędrzejewski-Szmek [Sat, 15 Oct 2016 20:12:46 +0000 (16:12 -0400)]
man: add journal-upload.conf(5)

Fixes #3370.

8 years agoman: add notes about thread safety of sd_journal_* functions
Zbigniew Jędrzejewski-Szmek [Sat, 15 Oct 2016 19:24:55 +0000 (15:24 -0400)]
man: add notes about thread safety of sd_journal_* functions

Fixes #4056.

8 years agoman: add crosslink between systemd.resource-control(5) and systemd.exec(5)
Zbigniew Jędrzejewski-Szmek [Sat, 15 Oct 2016 18:17:05 +0000 (14:17 -0400)]
man: add crosslink between systemd.resource-control(5) and systemd.exec(5)

Fixes #4379.

8 years agovirt: add possibility to skip the check for chroot (#4374)
Lukáš Nykrýn [Sat, 15 Oct 2016 17:54:58 +0000 (19:54 +0200)]
virt: add possibility to skip the check for chroot (#4374)

https://bugzilla.redhat.com/show_bug.cgi?id=1379852

8 years agohwdb: Add sensitivity for Dell Latitude E7470 pointingstick
Ben Gamari [Sat, 15 Oct 2016 16:11:03 +0000 (12:11 -0400)]
hwdb: Add sensitivity for Dell Latitude E7470 pointingstick

8 years agocore: make settings for unified cgroup hierarchy supersede the ones for legacy hierar...
Tejun Heo [Sat, 15 Oct 2016 01:07:16 +0000 (21:07 -0400)]
core: make settings for unified cgroup hierarchy supersede the ones for legacy hierarchy (#4269)

There are overlapping control group resource settings for the unified and
legacy hierarchies.  To help transition, the settings are translated back and
forth.  When both versions of a given setting are present, the one matching the
cgroup hierarchy type in use is used.  Unfortunately, this is more confusing to
use and document than necessary because there is no clear static precedence.

Update the translation logic so that the settings for the unified hierarchy are
always preferred.  systemd.resource-control man page is updated to reflect the
change and reorganized so that the deprecated settings are at the end in its
own section.

8 years agonspawn: remove unused variable (#4369)
Thomas H. P. Andersen [Thu, 13 Oct 2016 21:30:28 +0000 (23:30 +0200)]
nspawn: remove unused variable (#4369)

8 years agoMerge pull request #4243 from endocode/djalal/sandbox-first-protection-kernelmodules-v1
Lennart Poettering [Thu, 13 Oct 2016 16:36:29 +0000 (18:36 +0200)]
Merge pull request #4243 from endocode/djalal/sandbox-first-protection-kernelmodules-v1

core:sandbox: Add ProtectKernelModules= and some fixes

8 years agoMerge pull request #653 from dvdhrm/bus-gold
Zbigniew Jędrzejewski-Szmek [Thu, 13 Oct 2016 16:25:56 +0000 (12:25 -0400)]
Merge pull request #653 from dvdhrm/bus-gold

8 years agoMerge pull request #4363 from stefan-it/replace-while-loops
Daniel Mack [Thu, 13 Oct 2016 13:56:23 +0000 (15:56 +0200)]
Merge pull request #4363 from stefan-it/replace-while-loops

basic,coredump: use for loop instead of while