platform/upstream/systemd.git
8 years agoudev: fix build with DEBUG=1
Lubomir Rintel [Tue, 3 May 2016 20:29:03 +0000 (22:29 +0200)]
udev: fix build with DEBUG=1

Alternatively, this could perhaps be removed since it was broken for a
long time and noone seemed to care.

But it was helpful for me today.

8 years agotests: add test for #3166 (#3180)
Evgeny Vereshchagin [Tue, 3 May 2016 09:43:22 +0000 (12:43 +0300)]
tests: add test for #3166 (#3180)

8 years agoman: rename TriggerLimitIntervalBurst to TriggerLimitBurst (#3181)
Evgeny Vereshchagin [Tue, 3 May 2016 09:33:38 +0000 (12:33 +0300)]
man: rename TriggerLimitIntervalBurst to TriggerLimitBurst (#3181)

[/etc/systemd/system/test.socket:2] Unknown lvalue 'TriggerLimitIntervalBurst' in section 'Socket'

Follow-up for 8b26cdbd2a94

8 years agolocale: Language fallbacks for fr_(BE|CA|CH|LU) to fr_FR (#3178)
Sylvain Plantefève [Mon, 2 May 2016 23:43:37 +0000 (01:43 +0200)]
locale: Language fallbacks for fr_(BE|CA|CH|LU) to fr_FR (#3178)

8 years agoMerge pull request #3162 from keszybz/alias-refusal
Lennart Poettering [Mon, 2 May 2016 18:40:54 +0000 (20:40 +0200)]
Merge pull request #3162 from keszybz/alias-refusal

Refuse Alias, DefaultInstance, templated units in install (as appropriate)

8 years agoMerge pull request #3153 from poettering/async-clone
Zbigniew Jędrzejewski-Szmek [Mon, 2 May 2016 17:56:07 +0000 (13:56 -0400)]
Merge pull request #3153 from poettering/async-clone

machined: make "clone" asynchronous, and support copy-based fall-back

8 years agoman: slightly extend the machinectl clone documentation
Lennart Poettering [Mon, 2 May 2016 09:14:46 +0000 (11:14 +0200)]
man: slightly extend the machinectl clone documentation

8 years agominor CODING_STYLE clarification
Lennart Poettering [Mon, 2 May 2016 09:14:13 +0000 (11:14 +0200)]
minor CODING_STYLE clarification

8 years agoupdate TODO
Lennart Poettering [Fri, 29 Apr 2016 18:35:14 +0000 (20:35 +0200)]
update TODO

8 years agomachinectl: since clone/remove/copy verbs are possibly slow, turn off bus call timeout
Lennart Poettering [Fri, 29 Apr 2016 18:57:39 +0000 (20:57 +0200)]
machinectl: since clone/remove/copy verbs are possibly slow, turn off bus call timeout

By default we timeout all bus calls, but if we know that these bus calls might
be slow, let's explicitly turn the timeouts off.

8 years agomachined: rework copy-from/copy-to operation to use generic Operation object
Lennart Poettering [Fri, 29 Apr 2016 18:32:56 +0000 (20:32 +0200)]
machined: rework copy-from/copy-to operation to use generic Operation object

With this all potentially slow operations are done out-of-process,
asynchronously, using the same "Operation" object.

8 years agomachined: also make image removal operation asynchronous
Lennart Poettering [Fri, 29 Apr 2016 18:17:55 +0000 (20:17 +0200)]
machined: also make image removal operation asynchronous

If we remove a directory image (i.e. not a btrfs snapshot) then things might
get quite expensive, hence run this asynchronous in a forked off process, too.

8 years agomachined: support non-btrfs file systems with "machinectl clone"
Lennart Poettering [Fri, 29 Apr 2016 18:06:20 +0000 (20:06 +0200)]
machined: support non-btrfs file systems with "machinectl clone"

Fall back to a normal copy operation when the backing file system isn't btrfs,
and hence doesn't support cheap snapshotting. Of course, this will be slow, but
given that the execution is asynchronous now, this should be OK.

Fixes: #1308

8 years agotree-wide: fix invocations of chattr_path()
Lennart Poettering [Fri, 29 Apr 2016 18:05:44 +0000 (20:05 +0200)]
tree-wide: fix invocations of chattr_path()

chattr_path() takes two bitmasks, and no booleans. Fix the various invocations
to do this properly.

8 years agocopy: adjust directory times after writing to the directory
Lennart Poettering [Fri, 29 Apr 2016 17:44:59 +0000 (19:44 +0200)]
copy: adjust directory times after writing to the directory

When recursively copying a directory tree, fix up the file times after having
created all contents in it, so that our changes don't end up altering any of
the directory times.

8 years agocopy: return the right error when we can't open a file
Lennart Poettering [Fri, 29 Apr 2016 17:42:07 +0000 (19:42 +0200)]
copy: return the right error when we can't open a file

8 years agoimage: enable btrfs quotas on the clone destination, not the source
Lennart Poettering [Fri, 29 Apr 2016 17:26:54 +0000 (19:26 +0200)]
image: enable btrfs quotas on the clone destination, not the source

8 years agoutil: rework sigkill_wait() to not require pid_t pointer
Lennart Poettering [Fri, 29 Apr 2016 17:23:23 +0000 (19:23 +0200)]
util: rework sigkill_wait() to not require pid_t pointer

Let's make sigkill_wait() take a normal pid_t, and add sigkill_waitp() that
takes a pointer (which is useful for usage in _cleanup_), following the usual
logic we have for this.

8 years agomachined: run clone operation asynchronously in the background
Lennart Poettering [Fri, 29 Apr 2016 17:14:52 +0000 (19:14 +0200)]
machined: run clone operation asynchronously in the background

Cloning an image can be slow, if the image is not on a btrfs subvolume, hence
let's make sure we do this asynchronously in a child process, so that machined
isn't blocked as long as we process the client request.

This adds a new, generic "Operation" object to machined, that is used to track
these kind of background processes.

This is inspired by the MachineOperation object that already exists to make
copy operations asynchronous. A later patch will rework the MachineOperation
logic to use the generic Operation instead.

8 years agotests: add test for https://github.com/systemd/systemd/issues/2467 (#3168)
Evgeny Vereshchagin [Mon, 2 May 2016 08:57:19 +0000 (11:57 +0300)]
tests: add test for https://github.com/systemd/systemd/issues/2467 (#3168)

8 years agoshared/install: refuse template files for non-templateable units
Zbigniew Jędrzejewski-Szmek [Sat, 30 Apr 2016 21:52:19 +0000 (17:52 -0400)]
shared/install: refuse template files for non-templateable units

$ systemctl --root=/ enable templated@bar.mount
Unit type mount cannot be templated.
Failed to enable: Invalid argument.

8 years agoshared/install: warn about DefaultInstance in non-template units
Zbigniew Jędrzejewski-Szmek [Sat, 30 Apr 2016 21:08:38 +0000 (17:08 -0400)]
shared/install: warn about DefaultInstance in non-template units

[/etc/systemd/system/mnt-test.mount:6] DefaultInstance only makes sense for template units, ignoring.

8 years agoMove no_instances information to shared/
Zbigniew Jędrzejewski-Szmek [Sat, 30 Apr 2016 22:34:13 +0000 (18:34 -0400)]
Move no_instances information to shared/

This way it can be used in install.c in subsequent commit.

8 years agoshared/install: ignore Alias in [Install] of units which don't allow aliases
Zbigniew Jędrzejewski-Szmek [Sat, 30 Apr 2016 20:54:37 +0000 (16:54 -0400)]
shared/install: ignore Alias in [Install] of units which don't allow aliases

A downside is that a warning about missing [Install] is printed:
$ systemctl --root=/ enable mnt-test.mount
[/etc/systemd/system/mnt-test.mount:5] Aliases are not allowed for mount units, ignoring.
The unit files have no installation config (WantedBy, RequiredBy, Also, Alias
settings in the [Install] section, and DefaultInstance for template units).
This means they are not meant to be enabled using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit's
   .wants/ or .requires/ directory.
2) A unit's purpose may be to act as a helper for some other unit which has
   a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
   D-Bus, udev, scripted systemctl call, ...).
4) In case of template units, the unit is meant to be enabled with some
   instance name specified.

That's a bit misleading, but I don't see an easy way to fix this. But
the situation is similar for many other parsing errors, so maybe that's
OK.

8 years agoMove no_alias information to shared/
Zbigniew Jędrzejewski-Szmek [Sat, 30 Apr 2016 20:21:41 +0000 (16:21 -0400)]
Move no_alias information to shared/

This way it can be used in install.c in subsequent commit.

8 years agoMerge pull request #3165 from evverx/tests-cleanups
Lennart Poettering [Sun, 1 May 2016 19:06:41 +0000 (21:06 +0200)]
Merge pull request #3165 from evverx/tests-cleanups

tests,build-sys: some cleanups

8 years agocatalog: rename RateLimitInterval= to RateLimitIntervalSec=
Evgeny Vereshchagin [Sun, 1 May 2016 17:15:21 +0000 (17:15 +0000)]
catalog: rename RateLimitInterval= to RateLimitIntervalSec=

Follow-up for f0367da7d1a61

Closes #3158

8 years agotests: use symlink to Makefile
Evgeny Vereshchagin [Sun, 1 May 2016 16:31:36 +0000 (16:31 +0000)]
tests: use symlink to Makefile

8 years agobuild-sys: add TEST-0[89]-* to dist
Evgeny Vereshchagin [Sun, 1 May 2016 16:30:53 +0000 (16:30 +0000)]
build-sys: add TEST-0[89]-* to dist

Follow-up for 91f9f8f1bae and 4f4d6ee4be1c

8 years agobuild-sys: allow references to adm group to be omitted (#3150)
Franck Bui [Sun, 1 May 2016 04:02:17 +0000 (06:02 +0200)]
build-sys: allow references to adm group to be omitted (#3150)

8 years agoMerge pull request #3152 from poettering/aliasfix
Zbigniew Jędrzejewski-Szmek [Sat, 30 Apr 2016 22:00:46 +0000 (18:00 -0400)]
Merge pull request #3152 from poettering/aliasfix

Refuse aliases to non-aliasable units in more places

Fixes #2730.

8 years agoarchitecture: Add nios2 (#3159)
Zbigniew Jędrzejewski-Szmek [Sat, 30 Apr 2016 21:07:34 +0000 (17:07 -0400)]
architecture: Add nios2 (#3159)

Add nios2 architecture support. The nios2 is a softcore by Altera.

8 years agoMerge pull request #3151 from keszybz/pr3149-2
Zbigniew Jędrzejewski-Szmek [Fri, 29 Apr 2016 18:27:23 +0000 (14:27 -0400)]
Merge pull request #3151 from keszybz/pr3149-2

 Assorted fixes #3149 + one commit tacked on top

8 years agoMerge pull request #3148 from poettering/trigger
Zbigniew Jędrzejewski-Szmek [Fri, 29 Apr 2016 18:27:04 +0000 (14:27 -0400)]
Merge pull request #3148 from poettering/trigger

core: introduce activation rate limit and parse nice levels and close sockets properly

8 years agoman: document that some unit types do not support unit aliases via symlinks
Lennart Poettering [Fri, 29 Apr 2016 15:48:07 +0000 (17:48 +0200)]
man: document that some unit types do not support unit aliases via symlinks

8 years agocore: when encountering a symlink alias for non-aliasable units warn nicely
Lennart Poettering [Fri, 29 Apr 2016 15:37:33 +0000 (17:37 +0200)]
core: when encountering a symlink alias for non-aliasable units warn nicely

If the user defines a symlink alias for a unit whose type does not support
aliasing, detect this early and print a nice warning.

Fixe: #2730

8 years agohashmap: optimize set_put_strdup() a bit
Lennart Poettering [Fri, 29 Apr 2016 15:33:29 +0000 (17:33 +0200)]
hashmap: optimize set_put_strdup() a bit

Hashing should be quicker than allocating, hence let's first check if the
string already exists and only then allocate a new copy for it.

8 years agocore: refuse merging on units when the unit type does not support alias
Lennart Poettering [Fri, 29 Apr 2016 15:31:02 +0000 (17:31 +0200)]
core: refuse merging on units when the unit type does not support alias

The concept of merging units exists so that we can create Unit objects for a
number of names early, and then load them only later, possibly merging units
which then turn out to be symlinked to other names. This of course only makes
sense for unit types where multiple names per unit are supported. For all
others, let's refuse the merge operation early.

8 years agoupdate TODO
Lennart Poettering [Thu, 28 Apr 2016 19:02:11 +0000 (21:02 +0200)]
update TODO

8 years agocore: merge service_connection_unref() into service_close_socket_fd()
Lennart Poettering [Fri, 29 Apr 2016 09:36:00 +0000 (11:36 +0200)]
core: merge service_connection_unref() into service_close_socket_fd()

We always call one after the other anyway, and this way service_set_socket_fd()
and service_close_socket_fd() nicely match each other as one undoes the effect
of the other.

8 years agocore: rerun GC logic for a unit that loses a reference
Lennart Poettering [Fri, 29 Apr 2016 09:18:53 +0000 (11:18 +0200)]
core: rerun GC logic for a unit that loses a reference

Let's make sure when we drop a reference to a unit, that we run the GC queue on
it again.

This (together with the previous commit) should deal with the GC issues pointed
out in:

https://github.com/systemd/systemd/pull/2993#issuecomment-215331189

8 years agocore: rework socket/service GC logic
Lennart Poettering [Fri, 29 Apr 2016 09:14:03 +0000 (11:14 +0200)]
core: rework socket/service GC logic

There's no need to set the no_gc bit for service units that socket units
prepare, as we always keep a proper reference (as maintained by unit_ref_set())
on them, and such references are honoured by the GC logic anyway. Moreover,
explicitly setting the no_gc bit is problematic if the socket gets GC'ed for a
reason, as the service might then leak with the bit set.

8 years agohwdb: add missing newline so the hwdb buils correctly again
Lennart Poettering [Fri, 29 Apr 2016 08:46:56 +0000 (10:46 +0200)]
hwdb: add missing newline so the hwdb buils correctly again

8 years agosocket: really always close auxiliary fds when closing socket fds
Lennart Poettering [Thu, 28 Apr 2016 19:47:20 +0000 (21:47 +0200)]
socket: really always close auxiliary fds when closing socket fds

8 years agocore: make parsing of RLIMIT_NICE aware of actual nice levels
Lennart Poettering [Thu, 28 Apr 2016 19:00:28 +0000 (21:00 +0200)]
core: make parsing of RLIMIT_NICE aware of actual nice levels

8 years agocore: make sure to close connection fd when we fail to activate a per-connection...
Lennart Poettering [Thu, 28 Apr 2016 15:09:50 +0000 (17:09 +0200)]
core: make sure to close connection fd when we fail to activate a per-connection service

Fixes: #2993 #2691

8 years agocore: minor error path fix
Lennart Poettering [Thu, 28 Apr 2016 14:51:30 +0000 (16:51 +0200)]
core: minor error path fix

In service_set_socket_fd(), let's make sure that if we can't add the requested
dependencies we take no possession of the passed connection fd.

This way, we follow the strict rule: we take possession of the passed fd on
success, but on failure we don't, and the fd remains in possession of the
caller.

8 years agocore: rename StartLimitInterval= to StartLimitIntervalSec=
Lennart Poettering [Tue, 26 Apr 2016 18:46:20 +0000 (20:46 +0200)]
core: rename StartLimitInterval= to StartLimitIntervalSec=

We generally follow the rule that for time settings we suffix the setting name
with "Sec" to indicate the default unit if none is specified. The only
exception was the rate limiting interval settings. Fix this, and keep the old
names for compatibility.

Do the same for journald's RateLimitInterval= setting

8 years agocore: move start ratelimiting check after condition checks
Lennart Poettering [Tue, 26 Apr 2016 18:34:33 +0000 (20:34 +0200)]
core: move start ratelimiting check after condition checks

With #2564 unit start rate limiting was moved from after the condition checks
are to before they are made, in an attempt to fix #2467. This however resulted
in #2684. However, with a previous commit a concept of per socket unit trigger
rate limiting has been added, to fix #2467 more comprehensively, hence the
start limit can be moved after the condition checks again, thus fixing #2684.

Fixes: #2684

8 years agocore: introduce activation rate limiting for socket units
Lennart Poettering [Tue, 26 Apr 2016 18:26:15 +0000 (20:26 +0200)]
core: introduce activation rate limiting for socket units

This adds two new settings TriggerLimitIntervalSec= and TriggerLimitBurst= that
define a rate limit for activation of socket units. When the limit is hit, the
socket is is put into a failure mode. This is an alternative fix for #2467,
since the original fix resulted in issue #2684.

In a later commit the StartLimitInterval=/StartLimitBurst= rate limiter will be
changed to be applied after any start conditions checks are made. This way,
there are two separate rate limiters enforced: one at triggering time, before
any jobs are queued with this patch, as well as the start limit that is moved
again to be run immediately before the unit is activated. Condition checks are
done in between the two, and thus no longer affect the start limit.

8 years agobuild-sys: improve compat with older kernel headers
Lennart Poettering [Wed, 27 Apr 2016 07:44:49 +0000 (09:44 +0200)]
build-sys: improve compat with older kernel headers

In 4.2 kernel headers, some netlink defines are missing that we need. missing.h
already can add them in, but currently makes this dependent on a definition
that these kernels already have. Change the check hence to check for the newest
definition in the table, so that the whole bunch of definitions as added in on
all kernels lacking this.

8 years agopath-util: also support ".old" and ".new" suffixes and recommend them
Zbigniew Jędrzejewski-Szmek [Fri, 29 Apr 2016 14:17:43 +0000 (10:17 -0400)]
path-util: also support ".old" and ".new" suffixes and recommend them

~ suffix works fine, but looks to much like it the file is supposed to be
automatically cleaned up. For new versions of configuration files installers
might want to using something that looks more permanent like foobar.new.
So let's add treat ".old" and ".new" as special.

Update test to match.

8 years agocore: Filter by unit name behind the D-Bus, instead on the client side (#3142)
kayrus [Fri, 29 Apr 2016 13:59:51 +0000 (15:59 +0200)]
core: Filter by unit name behind the D-Bus, instead on the client side (#3142)

This commit improves systemd performance on the systems which have
thousands of units.

8 years agoMerge pull request #3126 from poettering/small-fixes
Zbigniew Jędrzejewski-Szmek [Fri, 29 Apr 2016 13:16:45 +0000 (09:16 -0400)]
Merge pull request #3126 from poettering/small-fixes

fsync directory when creating or rotating journal files and other small fixes,
most importantly for the DHCP DUID code.

8 years agotest-copy: never call alloca() in a loop
Lennart Poettering [Fri, 29 Apr 2016 12:25:52 +0000 (14:25 +0200)]
test-copy: never call alloca() in a loop

That's a total no-no, hence rework this to use malloc()-based memory instead of
alloca()-based memory.

Also see CODING_STYLE about this.

8 years agocopy: also copy AF_UNIX sockets
Lennart Poettering [Fri, 29 Apr 2016 12:21:22 +0000 (14:21 +0200)]
copy: also copy AF_UNIX sockets

We previously would fail with EOPNOTSUPP when encountering an AF_UNIX socket in
the directory tree to copy. Fix that, and copy them too (even if they are dead
in the result).

Fixes: #2914

8 years agoman: document that RemainAfterExit= doesn't make much sense for repetitive timers
Lennart Poettering [Fri, 29 Apr 2016 11:36:38 +0000 (13:36 +0200)]
man: document that RemainAfterExit= doesn't make much sense for repetitive timers

Fixes #3122

8 years agopath-util: document that we shouldn't add further entries to hidden_or_backup_file()
Lennart Poettering [Fri, 29 Apr 2016 11:26:12 +0000 (13:26 +0200)]
path-util: document that we shouldn't add further entries to hidden_or_backup_file()

And let's add ".bak" as a generic suffix for backups, that people can use
without having to register their stuff in our list.

8 years agorules: add NVMe rules (#3136)
Ming Lin [Fri, 29 Apr 2016 11:02:57 +0000 (04:02 -0700)]
rules: add NVMe rules (#3136)

Add NVMe rules using the "wwid" attribute.

root@target:~# cat /sys/block/nvme0n1/wwid
eui.3825004235000591

root@target:~# ls /dev/disk/by-id/ -l |grep nvme
lrwxrwxrwx 1 root root 13 Apr 27 16:08 nvme-eui.3825004235000591 -> ../../nvme0n1
lrwxrwxrwx 1 root root 15 Apr 27 16:08 nvme-eui.3825004235000591-part1 -> ../../nvme0n1p1
lrwxrwxrwx 1 root root 15 Apr 27 16:08 nvme-eui.3825004235000591-part2 -> ../../nvme0n1p2

8 years agoMerge pull request #3069 from Werkov/fix-dependencies-for-bind-mounts
Lennart Poettering [Fri, 29 Apr 2016 10:50:29 +0000 (12:50 +0200)]
Merge pull request #3069 from Werkov/fix-dependencies-for-bind-mounts

Always create dependencies for bind mounts

8 years agojournal-file: when rotating a journal file, fsync directory too
Lennart Poettering [Fri, 29 Apr 2016 10:21:52 +0000 (12:21 +0200)]
journal-file: when rotating a journal file, fsync directory too

As suggested by:

https://github.com/systemd/systemd/pull/3126#discussion_r61125474

8 years agonetworkd: clean up DUID code a bit
Lennart Poettering [Tue, 26 Apr 2016 14:19:28 +0000 (16:19 +0200)]
networkd: clean up DUID code a bit

Let's move DUID configuration into the [DHCP] section, since it only makes
sense in a DHCP context, and should be close to the configuration of
ClientIdentifier= and suchlike.

This really shouldn't be a section of its own, we don't have any for any of our
other per-protocol specific identifiers...

Follow-up for #2890 #2943

8 years agojournal: when creating a new journal file, fsync() the directory it is created in too
Lennart Poettering [Tue, 26 Apr 2016 13:47:55 +0000 (15:47 +0200)]
journal: when creating a new journal file, fsync() the directory it is created in too

Fixes: #2831

8 years agoupdate TODO a bit
Lennart Poettering [Tue, 26 Apr 2016 13:47:03 +0000 (15:47 +0200)]
update TODO a bit

8 years agoman: minor wording fixes
Lennart Poettering [Tue, 26 Apr 2016 13:08:06 +0000 (15:08 +0200)]
man: minor wording fixes

As suggested in:

https://github.com/systemd/systemd/pull/3124#discussion_r61068789

8 years agovimrc: fix indentation logic for our docbook xml files
Lennart Poettering [Tue, 26 Apr 2016 13:06:28 +0000 (15:06 +0200)]
vimrc: fix indentation logic for our docbook xml files

Make sure TAB results in 2ch indenting as we commonly use for our docbook XML
files.

8 years agoparse-util: fix conversion from size_t on s390 (#3147)
Lubomir Rintel [Fri, 29 Apr 2016 09:45:07 +0000 (11:45 +0200)]
parse-util: fix conversion from size_t on s390 (#3147)

On s390 size_t is an unsigned long, nor an unsigned int. They both are
of the same size and can be cast to each other safely, but the compiler
still seems unhappy about incompatible pointers.

Fixes: 7c2da2ca8

8 years agoMerge pull request #3137 from keszybz/dirent-simplification
Lennart Poettering [Fri, 29 Apr 2016 08:40:15 +0000 (10:40 +0200)]
Merge pull request #3137 from keszybz/dirent-simplification

Various small cleanups in shared code

8 years agonspawn: convert uuid to string (#3146)
Evgeny Vereshchagin [Fri, 29 Apr 2016 08:38:35 +0000 (11:38 +0300)]
nspawn: convert uuid to string (#3146)

Fixes:
cp /etc/machine-id /var/tmp/systemd-test.HccKPa/nspawn-root/etc
systemd-nspawn -D /var/tmp/systemd-test.HccKPa/nspawn-root --link-journal host -b
...
Host and machine ids are equal (P�S!V): refusing to link journals

8 years agonetworkd: reconfigure IPv6 and static address after link up event (#3105)
Susant Sahani [Thu, 28 Apr 2016 23:03:29 +0000 (04:33 +0530)]
networkd: reconfigure IPv6 and static address after link up event (#3105)

Now we are not setting static address, start dhcp6 client and
discovering IPv6 routers after link gained carrier.

This fixes #2912.

8 years agobasic/mount-util: recognize pvfs2 as network fs (#3140)
Zbigniew Jędrzejewski-Szmek [Thu, 28 Apr 2016 17:49:16 +0000 (13:49 -0400)]
basic/mount-util: recognize pvfs2 as network fs (#3140)

Added to kernel 4.6.

8 years agonspawn: initialize the veth_name (#3141)
Evgeny Vereshchagin [Thu, 28 Apr 2016 17:48:17 +0000 (20:48 +0300)]
nspawn: initialize the veth_name (#3141)

Fixes:
$ systemd-nspawn -h
...
Failed to remove veth interface ����: Operation not permitted

This is a follow-up for d2773e59de3dd970d861

8 years agocgtop: initialize `ours' to NULL properly (#3139)
Naohiro Aota [Thu, 28 Apr 2016 15:41:50 +0000 (00:41 +0900)]
cgtop: initialize `ours' to NULL properly (#3139)

Running cgtop on a system, which lacks expecting stat file, results in a
segfault. For example, a system with blkio tree but without cfq io scheduler,
lacks "blkio.io_service_bytes".

When the targeting cgroup's file does not exist, process() returns 0 and
also does not modify `*ret' value (which is `*ours'). As a result,
callers of refresh_one() can have bogus pointer, which result in SEGV.

This patch just properly initialize the variable to NULL.

8 years agotest: chmod +x sysv-generator-test
Zbigniew Jędrzejewski-Szmek [Thu, 28 Apr 2016 12:24:53 +0000 (08:24 -0400)]
test: chmod +x sysv-generator-test

Just for convenience.

8 years agotest-path-util: add a trivial test for hidden_or_backup_file
Zbigniew Jędrzejewski-Szmek [Thu, 28 Apr 2016 12:24:25 +0000 (08:24 -0400)]
test-path-util: add a trivial test for hidden_or_backup_file

8 years agotree-wide: rename hidden_file to hidden_or_backup_file and optimize
Zbigniew Jędrzejewski-Szmek [Wed, 27 Apr 2016 13:24:59 +0000 (09:24 -0400)]
tree-wide: rename hidden_file to hidden_or_backup_file and optimize

In standard linux parlance, "hidden" usually means that the file name starts
with ".", and nothing else. Rename the function to convey what the function does
better to casual readers.

Stop exposing hidden_file_allow_backup which is rather ugly and rewrite
hidden_file to extract the suffix first. Note that hidden_file_allow_backup
excluded files with "~" at the end, which is quite confusing. Let's get
rid of it before it gets used in the wrong place.

8 years agoAdd croatian translation, hr.po and systemd.hr.catalog files
muzena [Wed, 27 Apr 2016 12:32:21 +0000 (14:32 +0200)]
Add croatian translation, hr.po and systemd.hr.catalog files

8 years agobasic/dirent-util: do not call hidden_file_allow_backup from dirent_is_file_with_suffix
Zbigniew Jędrzejewski-Szmek [Wed, 27 Apr 2016 12:59:12 +0000 (08:59 -0400)]
basic/dirent-util: do not call hidden_file_allow_backup from dirent_is_file_with_suffix

If the file name is supposed to end in a suffix, there's not need to check the
name against a list of "special" file names, which is slow. Instead, just check
that the name doens't start with a period.

8 years agonetworkd: drop unnecessary stmt
Zbigniew Jędrzejewski-Szmek [Mon, 25 Apr 2016 01:20:26 +0000 (21:20 -0400)]
networkd: drop unnecessary stmt

8 years agomachinectl: simplify option string assignment
Zbigniew Jędrzejewski-Szmek [Sun, 24 Apr 2016 15:31:19 +0000 (11:31 -0400)]
machinectl: simplify option string assignment

It's better to avoid having the option string duplicated, lest we forget
to modify them in sync in the future.

8 years agoStop syslog.socket when entering emergency mode (#3130)
Martin Pitt [Wed, 27 Apr 2016 08:34:24 +0000 (10:34 +0200)]
Stop syslog.socket when entering emergency mode (#3130)

When enabling ForwardToSyslog=yes, the syslog.socket is active when entering
emergency mode. Any log message then triggers the start of rsyslog.service (or
other implementation) along with its dependencies such as local-fs.target and
sysinit.target. As these might fail themselves (e. g. faulty /etc/fstab), this
breaks the emergency mode.

This causes syslog.socket to fail with "Failed to queue service startup job:
Transition is destructive".

Add Conflicts=syslog.socket to emergency.service to make sure the socket is
stopped when emergency.service is started.

Fixes #266

8 years agoCorrectly parse OBJECT_PID in journald messages (#3129)
Nalin Dahyabhai [Wed, 27 Apr 2016 08:32:05 +0000 (04:32 -0400)]
Correctly parse OBJECT_PID in journald messages (#3129)

The parse_pid() function doesn't succeed if we don't zero-terminate after the
last digit in the buffer.

8 years agopath-util: Add hidden suffixes for ucf (#3131)
Martin Pitt [Wed, 27 Apr 2016 07:58:42 +0000 (09:58 +0200)]
path-util: Add hidden suffixes for ucf (#3131)

ucf is a standard Debian helper for managing configuration file upgrades which
need more interaction or elaborate merging than conffiles managed by dpkg.
Ignore its temporary and backup files similarly to the *.dpkg-* ones to avoid
creating units for them in generators.

https://bugs.debian.org/775903

8 years agojournal: set STATE_ARCHIVED as part of offlining (#2740)
Vito Caputo [Wed, 27 Apr 2016 06:29:43 +0000 (23:29 -0700)]
journal: set STATE_ARCHIVED as part of offlining (#2740)

The only code path which makes a journal durable is via
journal_file_set_offline().

When we perform a rotate the journal's header->state is being set to
STATE_ARCHIVED prior to journal_file_set_offline() being called.

In journal_file_set_offline(), we short-circuit the entire offline when
f->header->state != STATE_ONLINE.

This all results in none of the journal_file_set_offline() fsync() calls
being reached when rotate archives a journal, so archived journals are
never explicitly made durable.

What we do now is instead of setting the f->header->state to
STATE_ARCHIVED directly in journal_file_rotate() prior to
journal_file_close(), we set an archive flag in f->archive for the
journal_file_set_offline() machinery to honor by committing
STATE_ARCHIVED instead of STATE_OFFLINE when set.

Prior to this, rotated journals were never getting fsync() explicitly
performed on them, since journal_file_set_offline() short-circuited.
Obviously this is undesirable, and depends entirely on the underlying
filesystem as to how much durability was achieved when simply closing
the file.

Note that this problem existed prior to the recent asynchronous fsync
changes, but those changes do facilitate our performing this durable
offline on rotate without blocking, regardless of the underlying
filesystem sync-on-close semantics.

8 years agocore: set start job timeout from the kernel commandline (#3112)
tblume [Tue, 26 Apr 2016 15:10:36 +0000 (17:10 +0200)]
core: set start job timeout from the kernel commandline (#3112)

Add the boot parameter: systemd.default_timeout_start_sec to allow modification
of the default start job timeout at boot time.

8 years agoMerge pull request #3124 from poettering/small-journal-fixes
Zbigniew Jędrzejewski-Szmek [Tue, 26 Apr 2016 13:52:55 +0000 (09:52 -0400)]
Merge pull request #3124 from poettering/small-journal-fixes

8 years agoRevert "smaller journal fixes (#3124)"
Zbigniew Jędrzejewski-Szmek [Tue, 26 Apr 2016 13:52:30 +0000 (09:52 -0400)]
Revert "smaller journal fixes (#3124)"

This reverts commit 6e3930c40f3379b7123e505a71ba4cd6db6c372f.

Merge got squashed by mistake.

8 years agoMerge pull request #3093 from poettering/nspawn-userns-magic
Lennart Poettering [Tue, 26 Apr 2016 12:57:04 +0000 (14:57 +0200)]
Merge pull request #3093 from poettering/nspawn-userns-magic

nspawn automatic user namespaces

8 years agosmaller journal fixes (#3124)
Lennart Poettering [Tue, 26 Apr 2016 12:38:45 +0000 (14:38 +0200)]
smaller journal fixes (#3124)

* sd-journal: detect earlier if we try to read an object from an invalid offset

Specifically, detect early if we try to read from offset 0, i.e. are using
uninitialized offset data.

* journal: when dumping journal contents, react nicer to lines we can't read

If journal files are not cleanly closed it might happen that intermediaery
journal entries cannot be read. Handle this nicely, skip over the unreadable
entries, and log a debug message about it; after all we generally follow the
logic that we try to make the best of corrupted files.

* journal-file: always generate the same error when encountering corrupted files

Let's make sure EBADMSG is the one error we throw when we encounter corrupted
data, so that we can neatly test for it.

* journal-file: when iterating through a partly corruped journal file, treat error like EOF

When we linearly iterate through a corrupted journal file, and we encounter a
read error, don't consider this fatal, but merely as EOF condition (and log
about it).

* journal-file: make seeking in corrupted files work

Previously, when we used a bisection table for seeking through a corrupted
file, and the end of the bisection table was corrupted we'd most likely fail
the entire seek operation. Improve the situation: if we encounter invalid
entries in a bisection table, linearly go backwards until we find a working
entry again.

* man: elaborate on the automatic systemd-journald.socket service dependencies

Fixes: #1603

8 years agotests: document requirements of networkd integration tests (#3125)
Martin Pitt [Tue, 26 Apr 2016 10:16:43 +0000 (12:16 +0200)]
tests: document requirements of networkd integration tests (#3125)

Document the necessary dependencies and nspawn/lxd options to run
test/networkd-test.py.

8 years agoman: elaborate on the automatic systemd-journald.socket service dependencies
Lennart Poettering [Tue, 26 Apr 2016 09:57:54 +0000 (11:57 +0200)]
man: elaborate on the automatic systemd-journald.socket service dependencies

Fixes: #1603

8 years agojournal-file: make seeking in corrupted files work
Lennart Poettering [Tue, 26 Apr 2016 09:39:48 +0000 (11:39 +0200)]
journal-file: make seeking in corrupted files work

Previously, when we used a bisection table for seeking through a corrupted
file, and the end of the bisection table was corrupted we'd most likely fail
the entire seek operation. Improve the situation: if we encounter invalid
entries in a bisection table, linearly go backwards until we find a working
entry again.

8 years agojournal-file: when iterating through a partly corruped journal file, treat error...
Lennart Poettering [Tue, 26 Apr 2016 09:38:39 +0000 (11:38 +0200)]
journal-file: when iterating through a partly corruped journal file, treat error like EOF

When we linearly iterate through a corrupted journal file, and we encounter a
read error, don't consider this fatal, but merely as EOF condition (and log
about it).

8 years agojournal-file: always generate the same error when encountering corrupted files
Lennart Poettering [Tue, 26 Apr 2016 09:37:22 +0000 (11:37 +0200)]
journal-file: always generate the same error when encountering corrupted files

Let's make sure EBADMSG is the one error we throw when we encounter corrupted
data, so that we can neatly test for it.

8 years agojournal: when dumping journal contents, react nicer to lines we can't read
Lennart Poettering [Mon, 25 Apr 2016 19:43:12 +0000 (21:43 +0200)]
journal: when dumping journal contents, react nicer to lines we can't read

If journal files are not cleanly closed it might happen that intermediaery
journal entries cannot be read. Handle this nicely, skip over the unreadable
entries, and log a debug message about it; after all we generally follow the
logic that we try to make the best of corrupted files.

8 years agosd-journal: detect earlier if we try to read an object from an invalid offset
Lennart Poettering [Mon, 25 Apr 2016 19:42:15 +0000 (21:42 +0200)]
sd-journal: detect earlier if we try to read an object from an invalid offset

Specifically, detect early if we try to read from offset 0, i.e. are using
uninitialized offset data.

8 years agosystemd --user: call pam_loginuid when creating user@.service (#3120)
Zbigniew Jędrzejewski-Szmek [Tue, 26 Apr 2016 09:19:10 +0000 (05:19 -0400)]
systemd --user: call pam_loginuid when creating user@.service (#3120)

This way the user service will have a loginuid, and it will be inherited by
child services. This shouldn't change anything as far as systemd itself is
concerned, but is nice for various services spawned from by systemd --user
that expect a loginuid.

pam_loginuid(8) says that it should be enabled for "..., crond and atd".
user@.service should behave similarly to those two as far as audit is
concerned.

https://bugzilla.redhat.com/show_bug.cgi?id=1328947#c28

8 years agoMerge pull request #3109 from poettering/journal-by-fd
Zbigniew Jędrzejewski-Szmek [Mon, 25 Apr 2016 19:57:36 +0000 (15:57 -0400)]
Merge pull request #3109 from poettering/journal-by-fd

rework "journalctl -M"

8 years agoMerge pull request #3114 from poettering/journalctl-b
Zbigniew Jędrzejewski-Szmek [Mon, 25 Apr 2016 19:56:17 +0000 (15:56 -0400)]
Merge pull request #3114 from poettering/journalctl-b

Fix endless loops in journalctl --list-boots (closes #617).

8 years agoHp Folio 1040g2 micmute and toggle touchpad fn keys fix (#3118)
EMOziko [Mon, 25 Apr 2016 19:42:35 +0000 (23:42 +0400)]
Hp Folio 1040g2 micmute and toggle touchpad fn keys fix (#3118)

Added HP Folio 1040g2 Fn+F8 MICMUTE FIx