platform/upstream/systemd.git
9 years agologin: make user_new() and user_free() follow coding-style
David Herrmann [Tue, 29 Sep 2015 09:10:01 +0000 (11:10 +0200)]
login: make user_new() and user_free() follow coding-style

Few changes to user_new() and user_free():
 - Use _cleanup_(user_freep) in constructor
 - return 'int' from user_new()
 - make user_free() deal with partially initialized objects
 - keep reverse-order in user_free() compared to user_new()
 - make user_free() return NULL
 - make user_free() accept NULL as no-op

9 years agologin: keep user->slice constant
David Herrmann [Tue, 29 Sep 2015 09:03:04 +0000 (11:03 +0200)]
login: keep user->slice constant

Currently, we allocate user->slice when starting a slice, but we never
release it. This is incompatible if we want to re-use a user object once
it was stopped. Hence, make sure user->slice is allocated statically on
the user object and use "u->started || u->stopping" as an indication
whether the slice is actually available on pid1 or not.

9 years agologin: simply XDG_RUNTIME_DIR management
David Herrmann [Mon, 28 Sep 2015 10:53:42 +0000 (12:53 +0200)]
login: simply XDG_RUNTIME_DIR management

Lets not pretend we support changing XDG_RUNTIME_DIR via logind state
files. There is no reason to ever write the string into /run, as we
allocate it statically based on the UID, anyway. Lets stop that and just
allocate the runtime_path in "struct User" at all times.

We keep writing it into the /run state to make sure pam_systemd of
previous installs can still read it. However, pam_systemd is now fixed to
allocate it statically as well, so we can safely remove that some time in
the future.

Last but not least: If software depends on systemd, they're more than free
to assume /run/user/$uid is their runtime dir. Lets not require sane
applications to query the environment to get their runtime dir. As long as
applications know their login-UID, they should be safe to deduce the
runtime dir.

9 years agoMerge pull request #1886 from poettering/tasks-max
David Herrmann [Mon, 16 Nov 2015 14:09:55 +0000 (15:09 +0100)]
Merge pull request #1886 from poettering/tasks-max

Enable TasksMax by default for all units

9 years agoTODO: sort
David Herrmann [Mon, 16 Nov 2015 14:05:00 +0000 (15:05 +0100)]
TODO: sort

9 years agoMerge pull request #1907 from evverx/fix-pam-install-on-debian
Lennart Poettering [Mon, 16 Nov 2015 11:33:09 +0000 (12:33 +0100)]
Merge pull request #1907 from evverx/fix-pam-install-on-debian

tests: fix pam_modules installation on Debian (and Debian-like systems)

9 years agovirt: sort #includes alphabetically
Martin Pitt [Mon, 16 Nov 2015 11:00:38 +0000 (12:00 +0100)]
virt: sort #includes alphabetically

nitpick from PR #1910

9 years agoMerge pull request #1908 from phomes/network-memleak
David Herrmann [Mon, 16 Nov 2015 11:00:20 +0000 (12:00 +0100)]
Merge pull request #1908 from phomes/network-memleak

network: dhcp6 - fix mem leak

9 years agoMerge pull request #1906 from poettering/pid-check
David Herrmann [Mon, 16 Nov 2015 10:59:21 +0000 (11:59 +0100)]
Merge pull request #1906 from poettering/pid-check

machined,logind: be more careful when accepting PIDs and UIDs from clients

9 years agonspawn: set TasksMax= for containers to 8192 by default
Lennart Poettering [Fri, 13 Nov 2015 18:38:40 +0000 (19:38 +0100)]
nspawn: set TasksMax= for containers to 8192 by default

9 years agologind: change default to UserTasksMax= to 4096
Lennart Poettering [Fri, 13 Nov 2015 18:32:37 +0000 (19:32 +0100)]
logind: change default to UserTasksMax= to 4096

9 years agocore: enable TasksMax= for all services by default, and set it to 512
Lennart Poettering [Fri, 13 Nov 2015 18:28:32 +0000 (19:28 +0100)]
core: enable TasksMax= for all services by default, and set it to 512

Also, enable TasksAccounting= for all services by default, too.

See:

http://lists.freedesktop.org/archives/systemd-devel/2015-November/035006.html

9 years agoMerge pull request #1910 from martinpitt/master
Lennart Poettering [Mon, 16 Nov 2015 10:52:17 +0000 (11:52 +0100)]
Merge pull request #1910 from martinpitt/master

virt: add missing #includes

9 years agovirt: add missing #includes
Martin Pitt [Mon, 16 Nov 2015 07:04:24 +0000 (08:04 +0100)]
virt: add missing #includes

src/basic/virt.c: In function 'detect_vm_device_tree':
src/basic/virt.c:117:17: error: unknown type name '_cleanup_closedir_'
                 _cleanup_closedir_ DIR *dir = NULL;

src/basic/virt.c:128:17: error: implicit declaration of function 'FOREACH_DIRENT' [-Werror=implicit-function-declaration]
                 FOREACH_DIRENT(dent, dir, return -errno)

9 years agotests: intsall /etc/login.defs
Evgeny Vereshchagin [Mon, 16 Nov 2015 03:10:54 +0000 (03:10 +0000)]
tests: intsall /etc/login.defs

Fixes:
systemd-testsuite login[31]: cannot open login definitions /etc/login.defs [No such file or directory]
systemd-testsuite systemd[1]: Received SIGCHLD from PID 31 (login).
systemd-testsuite systemd[1]: Child 31 (login) died (code=exited, status=1/FAILURE)
systemd-testsuite systemd[1]: console-getty.service: Child 31 belongs to console-getty.service
systemd-testsuite systemd[1]: console-getty.service: Main process exited, code=exited, status=1/FAILURE
systemd-testsuite systemd[1]: console-getty.service: Changed running -> dead

on Debian/Ubuntu

Useful on other distros

9 years agonetwork: dhcp6 - fix mem leak
Thomas Hindoe Paaboel Andersen [Sun, 15 Nov 2015 22:08:22 +0000 (23:08 +0100)]
network: dhcp6 - fix mem leak

from 7a695d8e
CID#1338679

9 years agotests: fix pam_modules installation on Debian (and Debian-like systems)
Evgeny Vereshchagin [Sun, 15 Nov 2015 20:38:56 +0000 (20:38 +0000)]
tests: fix pam_modules installation on Debian (and Debian-like systems)

libpam_modules installs modules into /lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)/security
on Debian

Fixes:
systemd-testsuite login[36]: PAM unable to dlopen(pam_group.so): /lib/security/pam_group.so: cannot open shared object file: No such file or directory
systemd-testsuite login[36]: PAM adding faulty module: pam_group.so
systemd-testsuite login[36]: PAM unable to dlopen(pam_limits.so): /lib/security/pam_limits.so: cannot open shared object file: No such file or directory
systemd-testsuite login[36]: PAM adding faulty module: pam_limits.so
...
etc

9 years agomachined,logind: be more careful when accepting PIDs and UIDs from clients
Lennart Poettering [Sun, 15 Nov 2015 21:00:47 +0000 (22:00 +0100)]
machined,logind: be more careful when accepting PIDs and UIDs from clients

Always validate first before we start processing the data.

9 years agoMerge pull request #1903 from phomes/gitignore
Lennart Poettering [Sun, 15 Nov 2015 19:42:26 +0000 (20:42 +0100)]
Merge pull request #1903 from phomes/gitignore

gitignore: add test-install-root

9 years agogitignore: add test-install-root
Thomas Hindoe Paaboel Andersen [Sun, 15 Nov 2015 19:35:30 +0000 (20:35 +0100)]
gitignore: add test-install-root

9 years agoMerge pull request #1901 from evverx/various-fixes
Lennart Poettering [Sun, 15 Nov 2015 18:46:00 +0000 (19:46 +0100)]
Merge pull request #1901 from evverx/various-fixes

Various fixes

9 years agoMerge pull request #1899 from phomes/NEWS-typo
Lennart Poettering [Sun, 15 Nov 2015 18:44:55 +0000 (19:44 +0100)]
Merge pull request #1899 from phomes/NEWS-typo

NEWS: typo fixes

9 years agotests: install execs from user units too
Evgeny Vereshchagin [Sun, 15 Nov 2015 17:26:05 +0000 (17:26 +0000)]
tests: install execs from user units too

Fixes:
systemd[39]: systemd-exit.service: Executing: /bin/kill -s 58 29
systemd[39]: systemd-exit.service: Failed at step EXEC spawning /bin/kill: No such file or directory
systemd[29]: Received SIGCHLD from PID 39 ((kill)).
systemd[29]: Child 39 ((kill)) died (code=exited, status=203/EXEC)

9 years agofirstboot: log on take_etc_passwd_lock error too
Evgeny Vereshchagin [Sun, 15 Nov 2015 16:16:38 +0000 (16:16 +0000)]
firstboot: log on take_etc_passwd_lock error too

9 years agoMerge pull request #1898 from marcosfrm/journalctl-shell-completion-2
Lennart Poettering [Sun, 15 Nov 2015 18:28:13 +0000 (19:28 +0100)]
Merge pull request #1898 from marcosfrm/journalctl-shell-completion-2

shell-completion: journalctl: add --sync

9 years agoNEWS: typo fixes
Thomas Hindoe Paaboel Andersen [Sun, 15 Nov 2015 16:30:33 +0000 (17:30 +0100)]
NEWS: typo fixes

9 years agoshell-completion: journalctl: add --sync
Marcos Mello [Thu, 12 Nov 2015 09:09:08 +0000 (07:09 -0200)]
shell-completion: journalctl: add --sync

From 94b6551

9 years agoMerge pull request #1896 from phomes/install-wrong-enum
Daniel Mack [Sun, 15 Nov 2015 15:51:51 +0000 (16:51 +0100)]
Merge pull request #1896 from phomes/install-wrong-enum

install: don't mix state and type enums

9 years agoinstall: don't mix state and type enums
Thomas Hindoe Paaboel Andersen [Sun, 15 Nov 2015 13:43:46 +0000 (14:43 +0100)]
install: don't mix state and type enums

from 0ec0deaa

9 years agohwdb: update
Kay Sievers [Sat, 14 Nov 2015 08:54:17 +0000 (09:54 +0100)]
hwdb: update

9 years agocore: now that .snapshot unit are gone, we don't need the per-type .no_gc bool anymore
Lennart Poettering [Fri, 13 Nov 2015 17:48:42 +0000 (18:48 +0100)]
core: now that .snapshot unit are gone, we don't need the per-type .no_gc bool anymore

9 years agocore: simplify scope unit GC checking code a bit
Lennart Poettering [Fri, 13 Nov 2015 17:46:12 +0000 (18:46 +0100)]
core: simplify scope unit GC checking code a bit

9 years agologind: add a new UserTasksMax= setting to logind.conf
Lennart Poettering [Fri, 13 Nov 2015 17:25:02 +0000 (18:25 +0100)]
logind: add a new UserTasksMax= setting to logind.conf

This new setting configures the TasksMax= field for the slice objects we
create for each user.

This alters logind to create the slice unit as transient unit explicitly
instead of relying on implicit generation of slice units by simply
starting them. This also enables us to set a friendly description for
slice units that way.

9 years agologind: don't assert if the slice is missing
Lennart Poettering [Fri, 13 Nov 2015 17:47:02 +0000 (18:47 +0100)]
logind: don't assert if the slice is missing

After all, we don't actually really need the slice to work, it's just
nice to have it.

9 years agocore: enable transient unit support for slice units
Lennart Poettering [Fri, 13 Nov 2015 17:46:50 +0000 (18:46 +0100)]
core: enable transient unit support for slice units

9 years agoman: document our definition of a year and a month
Lennart Poettering [Fri, 13 Nov 2015 17:19:34 +0000 (18:19 +0100)]
man: document our definition of a year and a month

Let's be accurate here, as this might be surprising to people.

9 years agoutil-lib: when parsing time values, accept "M" as short for "month"
Lennart Poettering [Fri, 13 Nov 2015 17:12:37 +0000 (18:12 +0100)]
util-lib: when parsing time values, accept "M" as short for "month"

nginx defines an uppercase "M" that way (in contrast to the lowercase
"m" for "minute"), and it sounds like an OK logic to follow, so that we
understand a true superset of time values nginx understands.

http://nginx.org/en/docs/syntax.html

9 years agobtrfs: properly handle the case when a subvol has no parent
Lennart Poettering [Fri, 13 Nov 2015 17:07:39 +0000 (18:07 +0100)]
btrfs: properly handle the case when a subvol has no parent

Don't be confused by subvols without parent. This is after all how the
root subvol is set up.

9 years agocore: add new DefaultTasksMax= setting for system.conf
Lennart Poettering [Fri, 13 Nov 2015 16:13:55 +0000 (17:13 +0100)]
core: add new DefaultTasksMax= setting for system.conf

This allows initializing the TasksMax= setting of all units by default
to some fixed value, instead of leaving it at infinity as before.

9 years agocore: make sure DefaultLimitCPU= and DefaultLimitRTTIME= understand time units, too
Lennart Poettering [Fri, 13 Nov 2015 14:24:21 +0000 (15:24 +0100)]
core: make sure DefaultLimitCPU= and DefaultLimitRTTIME= understand time units, too

We added this for the per-unit setting, hence let's enable this for the
global default settings too.

9 years agoMerge pull request #1883 from evverx/man-systemd-service-sd-watchdog-enabled
Lennart Poettering [Fri, 13 Nov 2015 17:37:24 +0000 (18:37 +0100)]
Merge pull request #1883 from evverx/man-systemd-service-sd-watchdog-enabled

man: add note about sd_watchdog_enabled

9 years agoman: add note about sd_watchdog_enabled
Evgeny Vereshchagin [Fri, 13 Nov 2015 16:48:34 +0000 (16:48 +0000)]
man: add note about sd_watchdog_enabled

9 years agoMerge pull request #1880 from fsateler/sysctl-doc
Lennart Poettering [Fri, 13 Nov 2015 15:40:37 +0000 (16:40 +0100)]
Merge pull request #1880 from fsateler/sysctl-doc

man: document systemd-sysctl arguments

9 years agoMerge pull request #1878 from hbrueckner/for-upstream
Kay Sievers [Fri, 13 Nov 2015 14:48:29 +0000 (15:48 +0100)]
Merge pull request #1878 from hbrueckner/for-upstream

udev/path_id: improve and enhance bus detection for Linux on z Systems

9 years agoman: document systemd-sysctl arguments
Felipe Sateler [Fri, 13 Nov 2015 12:52:06 +0000 (09:52 -0300)]
man: document systemd-sysctl arguments

9 years agoMerge pull request #1881 from michich/analyze-dot
Lennart Poettering [Fri, 13 Nov 2015 14:30:15 +0000 (15:30 +0100)]
Merge pull request #1881 from michich/analyze-dot

analyze: dot graph missing Requisite, superfluous ConflictedBy

9 years agoMerge pull request #1882 from teg/networkd-dhcp6-fix
Lennart Poettering [Fri, 13 Nov 2015 14:29:45 +0000 (15:29 +0100)]
Merge pull request #1882 from teg/networkd-dhcp6-fix

networkd: link - fix ipv6ll_gained() handling

9 years agonetworkd: check explicit state rather than link->network
Tom Gundersen [Fri, 13 Nov 2015 14:05:58 +0000 (15:05 +0100)]
networkd: check explicit state rather than link->network

When deserializing we can now have an attached network without the various clients yet
having been configured. Hence, don't misused the link->network as a check to determine
if a link is ready to be used, but check the state explicitly.

9 years agoanalyze: do not draw ConflictedBy dependencies in dot graph
Michal Schmidt [Fri, 13 Nov 2015 13:52:33 +0000 (14:52 +0100)]
analyze: do not draw ConflictedBy dependencies in dot graph

We already draw Conflicts. I see no reason for having every red line in
the graph duplicated in the opposite direction.

9 years agoNEWS: document two more changes in behaviour
Lennart Poettering [Fri, 13 Nov 2015 13:59:25 +0000 (14:59 +0100)]
NEWS: document two more changes in behaviour

9 years agonetworkd: dhcp6 - don't log about losing a lease we never had
Tom Gundersen [Fri, 13 Nov 2015 13:35:39 +0000 (14:35 +0100)]
networkd: dhcp6 - don't log about losing a lease we never had

9 years agoanalyze: show Requisite dependencies in the dot graph again
Michal Schmidt [Fri, 13 Nov 2015 13:30:07 +0000 (14:30 +0100)]
analyze: show Requisite dependencies in the dot graph again

We lost them a long time ago with commit 048ecf5b843.

9 years agoMerge pull request #1879 from poettering/networkd-forward
Tom Gundersen [Fri, 13 Nov 2015 13:18:32 +0000 (14:18 +0100)]
Merge pull request #1879 from poettering/networkd-forward

stop managing per-interface IP forwarding settings

9 years agoMerge pull request #1869 from poettering/kill-overridable
Michal Schmidt [Fri, 13 Nov 2015 13:04:34 +0000 (14:04 +0100)]
Merge pull request #1869 from poettering/kill-overridable

Remove support for RequiresOverridable= and RequisiteOverridable=

9 years agoNEWS: add more stuff, and reorder things a bit
Lennart Poettering [Fri, 13 Nov 2015 12:59:50 +0000 (13:59 +0100)]
NEWS: add more stuff, and reorder things a bit

9 years agocatalog: move danish catalog into the right place, and drop DOS line breaks
Lennart Poettering [Fri, 13 Nov 2015 12:52:00 +0000 (13:52 +0100)]
catalog: move danish catalog into the right place, and drop DOS line breaks

9 years agoMerge pull request #1875 from marineam/fsck-after-resume
Lennart Poettering [Fri, 13 Nov 2015 12:12:50 +0000 (13:12 +0100)]
Merge pull request #1875 from marineam/fsck-after-resume

generator: order initrd fsck-root after local-fs-pre

9 years agonetworkd: stop managing per-interface IP forwarding settings
Lennart Poettering [Fri, 13 Nov 2015 11:49:15 +0000 (12:49 +0100)]
networkd: stop managing per-interface IP forwarding settings

As it turns out the kernel does not support per-interface IPv6 packet
forwarding controls (unlike as it does for IPv4), but only supports a
global option (#1597). Also, the current per-interface management of the
setting isn't really useful, as you want it to propagate to at least one
more interface than the one you configure it on. This created much grief
(#1411, #1808).

Hence, let's roll this logic back and simplify this again, so that we
can expose the same behaviour on IPv4 and IPv6 and things start to work
automatically again for most folks: if a network with this setting set
is set up we propagate the setting into the global setting, but this is
strictly one-way: we never reset it again, and we do nothing for network
interfaces where this setting is not enabled.

Fixes: #1808, #1597.

9 years agonetworkd: rearrange checks when to write something into sysctl a bit
Lennart Poettering [Fri, 13 Nov 2015 11:32:38 +0000 (12:32 +0100)]
networkd: rearrange checks when to write something into sysctl a bit

Move check whether ipv6 is available into link_ipv6_privacy_extensions()
to keep it as internal and early as possible.

Always check if there's a network attached to a link before we apply
sysctls. We do this for most of the sysctl functions already, with this
change we do it for all.

9 years agonetworkd: fix a couple of format string types
Lennart Poettering [Fri, 13 Nov 2015 11:30:57 +0000 (12:30 +0100)]
networkd: fix a couple of format string types

We really should use %i for ints, and %u for unsigneds, and be careful
what we pick depending on the type we want to print.

9 years agoutil-lib: optionally, when writing a string to a file, verify string on failure
Lennart Poettering [Thu, 12 Nov 2015 23:54:56 +0000 (00:54 +0100)]
util-lib: optionally, when writing a string to a file, verify string on failure

With this change, the idiom:

    r = write_string_file(p, buf, 0);
    if (r < 0) {
           if (verify_one_line_file(p, buf) > 0)
                   r = 0;
    }

gets reduced to:

    r = write_string_file(p, buf, WRITE_STRING_FILE_VERIFY_ON_FAILURE);

i.e. when writing the string fails and the new flag
WRITE_STRING_FILE_VERIFY_ON_FAILURE is specified we'll not return a
failure immediately, but check the contents of the file. If it matches
what we wanted to write we suppress the error and exit cleanly.

9 years agoudev/path_id: improve and enhance bus detection for Linux on z Systems
Liu Yuan Yuan [Fri, 13 Nov 2015 10:50:42 +0000 (11:50 +0100)]
udev/path_id: improve and enhance bus detection for Linux on z Systems

Improve and enhance the path_id udev builtin to correctly handle bus'
available on Linux on z Systems (s390).

Previously, the CCW bus and, in particular, any FCP devices on it, have
been treated separately.  This commit integrates the CCW bus into the
device chain loop.  FCP devices and their associated SCSI disks are now
handled through the common SCSI handling functions in path_id.

This implies also a change in the naming of the symbolic links created
by udev.  So any backports of this commit to existing Linux distribution
must be done with care.  If a backport is required, a udev rule must be
created to also create the "old-style" symbolic links.

Apart from the CCW bus, this commit adds bus support for the:

- ccwgroup bus which manages network devices, and
- ap bus which manages cryptographic adapters
- iucv bus which manages IUCV devices on z/VM

9 years agogenerator: order initrd fsck-root after local-fs-pre
Michael Marineau [Fri, 13 Nov 2015 02:10:57 +0000 (18:10 -0800)]
generator: order initrd fsck-root after local-fs-pre

The initrd version of systemd-fsck-root.service must wait for
local-fs-pre.target just like systemd-fsck@.service to prevent
modifications to the filesystem prior to resuming from hibernation.
As-is my laptop routinely fails to resume due to fsck errors. The rest
of the time it is probably silently corrupting the filesystem.

Unlike normal boot, in the initrd systemd-fsck-root.service has no
special significance so it needs to be kept in sync with
systemd-fsck@.service. The name systemd-fsck-root.service is only used
to preserve state across switch-root.

9 years agoMerge pull request #1871 from poettering/nspawn-veth-extra
Tom Gundersen [Fri, 13 Nov 2015 01:11:50 +0000 (02:11 +0100)]
Merge pull request #1871 from poettering/nspawn-veth-extra

nspawn: add ability to define additional, arbitrary veth links between host and container

9 years agoupdate TODO
Lennart Poettering [Thu, 12 Nov 2015 20:57:23 +0000 (21:57 +0100)]
update TODO

9 years agonspawn: add new --network-veth-extra= switch for defining additional veth links
Lennart Poettering [Thu, 12 Nov 2015 20:54:28 +0000 (21:54 +0100)]
nspawn: add new --network-veth-extra= switch for defining additional veth links

The new switch operates like --network-veth, but may be specified
multiple times (to define multiple link pairs) and allows flexible
definition of the interface names.

This is an independent reimplementation of #1678, but defines different
semantics, keeping the behaviour completely independent of
--network-veth. It also comes will full hook-up for .nspawn files, and
the matching documentation.

9 years agoMerge pull request #1870 from evverx/clarify_set_priority
Lennart Poettering [Thu, 12 Nov 2015 21:01:41 +0000 (22:01 +0100)]
Merge pull request #1870 from evverx/clarify_set_priority

core: use SD_EVENT_PRIORITY_NORMAL-n instead on -n

9 years agocore: use SD_EVENT_PRIORITY_NORMAL-n instead on -n
Evgeny Vereshchagin [Thu, 12 Nov 2015 19:54:34 +0000 (19:54 +0000)]
core: use SD_EVENT_PRIORITY_NORMAL-n instead on -n

9 years agoMerge pull request #1868 from teg/ndisc-fix
Lennart Poettering [Thu, 12 Nov 2015 19:27:51 +0000 (20:27 +0100)]
Merge pull request #1868 from teg/ndisc-fix

sd-ndisc: add missing parens

9 years agoupdate TODO
Lennart Poettering [Thu, 12 Nov 2015 19:25:39 +0000 (20:25 +0100)]
update TODO

9 years agocore: make sure to reset the bus error struct before reusing it
Lennart Poettering [Thu, 12 Nov 2015 19:14:33 +0000 (20:14 +0100)]
core: make sure to reset the bus error struct before reusing it

Otherwise the call might fail, because the error structure is already
initialized.

9 years agocore: unify code that warns about jobs we fail to enqueue
Lennart Poettering [Thu, 12 Nov 2015 19:13:42 +0000 (20:13 +0100)]
core: unify code that warns about jobs we fail to enqueue

This allows us to shorten our code a bit.

9 years agocore: drop "override" flag when building transactions
Lennart Poettering [Thu, 12 Nov 2015 18:52:31 +0000 (19:52 +0100)]
core: drop "override" flag when building transactions

Now that we don't have RequiresOverridable= and RequisiteOverridable=
dependencies anymore, we can get rid of tracking the "override" boolean
for jobs in the job engine, as it serves no purpose anymore.

While we are at it, fix some error messages we print when invoking
functions that take the override parameter.

9 years agocore: remove support for RequiresOverridable= and RequisiteOverridable=
Lennart Poettering [Thu, 12 Nov 2015 18:21:47 +0000 (19:21 +0100)]
core: remove support for RequiresOverridable= and RequisiteOverridable=

As discussed at systemd.conf 2015 and on also raised on the ML:

http://lists.freedesktop.org/archives/systemd-devel/2015-November/034880.html

This removes the two XyzOverridable= unit dependencies, that were
basically never used, and do not enhance user experience in any way.
Most folks looking for the functionality this provides probably opt for
the "ignore-dependencies" job mode, and that's probably a good idea.

Hence, let's simplify systemd's dependency engine and remove these two
dependency types (and their inverses).

The unit file parser and the dbus property parser will now redirect
the settings/properties to result in an equivalent non-overridable
dependency. In the case of the unit file parser we generate a warning,
to inform the user.

The dbus properties for this unit type stay available on the unit
objects, but they are now hidden from usual introspection and will
always return the empty list when queried.

This should provide enough compatibility for the few unit files that
actually ever made use of this.

9 years agoMerge pull request #1515 from poettering/install-symlink
Daniel Mack [Thu, 12 Nov 2015 17:18:45 +0000 (18:18 +0100)]
Merge pull request #1515 from poettering/install-symlink

install: follow unit file symlinks in /usr, but not /etc when looking for [Install] data and more

9 years agocore: simplify handling of %u, %U, %s and %h unit file specifiers
Lennart Poettering [Sat, 31 Oct 2015 21:12:51 +0000 (22:12 +0100)]
core: simplify handling of %u, %U, %s and %h unit file specifiers

Previously, the %u, %U, %s and %h specifiers would resolve to the user
name, numeric user ID, shell and home directory of the user configured
in the User= setting of a unit file, or the user of the manager instance
if no User= setting was configured. That at least was the theory. In
real-life this was not ever actually useful:

- For the systemd --user instance it made no sense to ever set User=,
  since the instance runs in user context after all, and hence the
  privileges to change user IDs don't even exist. The four specifiers
  were actually not useful at all in this case.

- For the systemd --system instance we did not allow any resolving that
  would require NSS. Hence, %s and %h were not supported, unless
  User=root was set, in which case they would be hardcoded to /bin/sh
  and /root, to avoid NSS. Then, %u would actually resolve to whatever
  was set with User=, but %U would only resolve to the numeric UID of
  that setting if the User= was specified in numeric form, or happened
  to be root (in which case 0 was hardcoded as mapping). Two of the
  specifiers are entirely useless in this case, one is realistically
  also useless, and one is pretty pointless.

- Resolving of these settings would only happen if User= was actually
  set *before* the specifiers where resolved. This behaviour was
  undocumented and is really ugly, as specifiers should actually be
  considered something that applies to the whole file equally,
  independently of order...

With this change, %u, %U, %s and %h are drastically simplified: they now
always refer to the user that is running the service instance, and the
user configured in the unit file is irrelevant. For the system instance
of systemd this means they always resolve to "root", "0", "/bin/sh" and
"/root", thus avoiding NSS. For the user instance, to the data for the
specific user.

The new behaviour is identical to the old behaviour in all --user cases
and for all units that have no User= set (or set to "0" or "root").

9 years agoman: improve the unit file enable state table a bit
Lennart Poettering [Sat, 31 Oct 2015 18:41:25 +0000 (19:41 +0100)]
man: improve the unit file enable state table a bit

9 years agoinstall: follow unit file symlinks in /usr, but not /etc when looking for [Install...
Lennart Poettering [Thu, 8 Oct 2015 20:31:56 +0000 (22:31 +0200)]
install: follow unit file symlinks in /usr, but not /etc when looking for [Install] data

Some distributions use alias unit files via symlinks in /usr to cover
for legacy service names. With this change we'll allow "systemctl
enable" on such aliases.

Previously, our rule was that symlinks are user configuration that
"systemctl enable" + "systemctl disable" creates and removes, while unit
files is where the instructions to do so are store. As a result of the
rule we'd never read install information through symlinks, since that
would mix enablement state with installation instructions.

Now, the new rule is that only symlinks inside of /etc are
configuration. Unit files, and symlinks in /usr are now valid for
installation instructions.

This patch is quite a rework of the whole install logic, and makes the
following addional changes:

- Adds a complete test "test-instal-root" that tests the install logic
  pretty comprehensively.

- Never uses canonicalize_file_name(), because that's incompatible with
  operation relative to a specific root directory.

- unit_file_get_state() is reworked to return a proper error, and
  returns the state in a call-by-ref parameter. This cleans up confusion
  between the enum type and errno-like errors.

- The new logic puts a limit on how long to follow unit file symlinks:
  it will do so only for 64 steps at max.

- The InstallContext object's fields are renamed to will_process and
  has_processed (will_install and has_installed) since they are also
  used for deinstallation and all kinds of other operations.

- The root directory is always verified before use.

- install.c is reordered to place the exported functions together.

- Stricter rules are followed when traversing symlinks: the unit suffix
  must say identical, and it's not allowed to link between regular units
  and templated units.

- Various modernizations

- The "invalid" unit file state has been renamed to "bad", in order to
  avoid confusion between UNIT_FILE_INVALID and
  _UNIT_FILE_STATE_INVALID. Given that the state should normally not be
  seen and is not documented this should not be a problematic change.
  The new name is now documented however.

Fixes #1375, #1718, #1706

9 years agoinstall: never log from install functions
Lennart Poettering [Thu, 8 Oct 2015 16:33:11 +0000 (18:33 +0200)]
install: never log from install functions

Instead, let the caller do that. Fix this by moving masked unit messages
into the caller, by returning a clear error code (ESHUTDOWN) by which
this may be detected.

9 years agoinstall: various simplifications
Lennart Poettering [Thu, 8 Oct 2015 14:17:31 +0000 (16:17 +0200)]
install: various simplifications

9 years agosd-ndisc: add missing parens
Tom Gundersen [Thu, 12 Nov 2015 15:37:18 +0000 (16:37 +0100)]
sd-ndisc: add missing parens

Reported by Thomas Andersen.

9 years agoMerge pull request #1865 from msekletar/build-man-list
Lennart Poettering [Thu, 12 Nov 2015 13:28:53 +0000 (14:28 +0100)]
Merge pull request #1865 from msekletar/build-man-list

build-sys: fix dependencies

9 years agobuild-sys: fix dependencies
Michal Sekletar [Thu, 12 Nov 2015 12:31:32 +0000 (13:31 +0100)]
build-sys: fix dependencies

update-man-list needs man/custom-entities.ent. Bug is nicely reproducible when
running make update-man-list.

9 years agoMerge pull request #1863 from poettering/network-man
Daniel Mack [Thu, 12 Nov 2015 12:57:38 +0000 (13:57 +0100)]
Merge pull request #1863 from poettering/network-man

man patch fix, and port journalctl --sync to use CLOCK_MONOTONIC timestamp files

9 years agoMerge pull request #1864 from poettering/remove-smack-fs-root-label
Daniel Mack [Thu, 12 Nov 2015 12:54:54 +0000 (13:54 +0100)]
Merge pull request #1864 from poettering/remove-smack-fs-root-label

core: remove SmackFileSystemRootLabel= again

9 years agoNEWS: begin putting together a NEWS section for the next release
Lennart Poettering [Thu, 12 Nov 2015 12:40:21 +0000 (13:40 +0100)]
NEWS: begin putting together a NEWS section for the next release

9 years agocore: remove SmackFileSystemRootLabel= again
Lennart Poettering [Thu, 12 Nov 2015 11:50:59 +0000 (12:50 +0100)]
core: remove SmackFileSystemRootLabel= again

Apparently, util-linux' mount command implicitly drops the smack-related
options anyway before passing them to the kernel, if the kernel doesn't
know SMACK, hence there's no point in duplicating this in systemd.

Fixes #1696

9 years agojournald: fix accuracy of watchdog timer event
Lennart Poettering [Thu, 12 Nov 2015 11:33:10 +0000 (12:33 +0100)]
journald: fix accuracy of watchdog timer event

Adding 3/4th of the watchdog frequency as accuracy on top of 1/2 of the
watchdog frequency means we might end up at 5/4th of the frequency which
means we might miss the message from time to time.

Maybe fixes #1804

9 years agojournald: rework --sync/--rotate logic to use CLOCK_MONOTONIC timestamp files
Lennart Poettering [Thu, 12 Nov 2015 10:17:01 +0000 (11:17 +0100)]
journald: rework --sync/--rotate logic to use CLOCK_MONOTONIC timestamp files

Previously, we'd rely on the mtime timestamps of the touch files to see
if our sync/rotation requests were already suppressed. This means we
rely on CLOCK_REALTIME timestamps. With this patch we instead store the
CLOCK_MONOTONIC timestamp *in* the touch files, and avoid relying on
mtime.

This should make things more reliable when the clock or underlying mtime
granularity is not very good.

This also adds warning messages if writing any of the flag files fails.

9 years agoman: add more (and simpler examples) to network.link(5)
Lennart Poettering [Thu, 12 Nov 2015 10:16:17 +0000 (11:16 +0100)]
man: add more (and simpler examples) to network.link(5)

9 years agoMerge pull request #1857 from evverx/fix-unstoppable
Daniel Mack [Thu, 12 Nov 2015 09:15:51 +0000 (10:15 +0100)]
Merge pull request #1857 from evverx/fix-unstoppable

tests: fix unstoppable service

9 years agoMerge pull request #1862 from torstehu/fix-typo2
Daniel Mack [Thu, 12 Nov 2015 09:15:19 +0000 (10:15 +0100)]
Merge pull request #1862 from torstehu/fix-typo2

core: fix typo

9 years agocore: fix typo
Torstein Husebø [Thu, 12 Nov 2015 07:23:21 +0000 (08:23 +0100)]
core: fix typo

9 years agotests: fix unstoppable service
Evgeny Vereshchagin [Thu, 12 Nov 2015 03:22:11 +0000 (03:22 +0000)]
tests: fix unstoppable service

[/etc/systemd/system/unstoppable.service:4] Unbalanced quoting,
ignoring: "/bin/echo 'I'm unstoppable!'"

9 years agoMerge pull request #1854 from poettering/unit-deps
Tom Gundersen [Wed, 11 Nov 2015 22:14:12 +0000 (23:14 +0100)]
Merge pull request #1854 from poettering/unit-deps

Dependency engine improvements

9 years agoutil-lib: use MODE_INVALID as invalid value for mode_t everywhere
Lennart Poettering [Wed, 11 Nov 2015 21:54:56 +0000 (22:54 +0100)]
util-lib: use MODE_INVALID as invalid value for mode_t everywhere

9 years agocore: fix dependency parsing
Lennart Poettering [Wed, 11 Nov 2015 21:53:05 +0000 (22:53 +0100)]
core: fix dependency parsing

3d793d29059a7ddf5282efa6b32b953c183d7a4d broke parsing of unit file
names that include backslashes, as extract_first_word() strips those.
Fix this, by introducing a new EXTRACT_RETAIN_ESCAPE flag which disables
looking at any flags, thus being compatible with the classic
FOREACH_WORD() behaviour.

9 years agoMerge pull request #1806 from mbachry/ipv6-test-fix
Lennart Poettering [Wed, 11 Nov 2015 20:00:42 +0000 (21:00 +0100)]
Merge pull request #1806 from mbachry/ipv6-test-fix

test: fix failing test-socket-util when running with ipv6.disable=1 kernel param

9 years agoman: document automatic dependencies
Lennart Poettering [Wed, 11 Nov 2015 19:47:07 +0000 (20:47 +0100)]
man: document automatic dependencies

For all units ensure there's an "Automatic Dependencies" section in the
man page, and explain which dependencies are automatically added in all
cases, and which ones are added on top if DefaultDependencies=yes is
set.

This is also done for systemd.exec(5), systemd.resource-control(5) and
systemd.unit(5) as these pages describe common behaviour of various unit
types.

9 years agocore: simplify mount unit dependency generation a bit
Lennart Poettering [Wed, 11 Nov 2015 19:46:09 +0000 (20:46 +0100)]
core: simplify mount unit dependency generation a bit

Let's make the code a bit more explicit. Should not change execution
logic in any way.