Commit Graph

27264 Commits

Author SHA1 Message Date
Lennart Poettering 411e869f49 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
2016-10-20 19:36:28 +02:00
Lennart Poettering 2fa4f10835 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
2016-10-20 17:45:27 +02:00
Evgeny Vereshchagin a5d5c0d2df 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)
```
2016-10-20 17:44:30 +02:00
Martin Pitt d9a0df256d Merge pull request #4418 from keszybz/autogen-params
Allow ./autogen.sh to take parameters for configure
2016-10-20 17:43:42 +02:00
Zbigniew Jędrzejewski-Szmek 8fdea26c94 Merge pull request #4414 from poettering/consolesakcomment
three minor fixes: document /dev/console/SAK handling + another cgroups wording fix + document User= default
2016-10-20 09:35:40 -04:00
Lennart Poettering 47da760efd man: document default for User=
Replaces: #4375
2016-10-20 13:21:25 +02:00
Lennart Poettering 8ae2c6300f 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
2016-10-20 13:12:53 +02:00
Lennart Poettering e9c880dd2c man: one more cgroup wording fix 2016-10-20 13:12:53 +02:00
Lennart Poettering 332c0d48a9 Merge pull request #4417 from keszybz/man-and-rlimit
Two unrelated patches: man page tweaks and rlimit log levels
2016-10-20 13:10:37 +02:00
Marcel Holtmann 697f494216 hwdb: Update database of Bluetooth company identifiers 2016-10-20 10:24:18 +02:00
Zbigniew Jędrzejewski-Szmek fe9d97c673 build-sys: show configure and make commands
And also hide make clean output which is very verbose and not particularly
interesting.
2016-10-20 01:42:56 -04:00
Zbigniew Jędrzejewski-Szmek a5e739a570 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.
2016-10-20 01:42:55 -04:00
Zbigniew Jędrzejewski-Szmek 3ce40911bd 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
2016-10-19 22:17:16 -04:00
Lennart Poettering 5368222db6 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
2016-10-19 19:48:35 -04:00
Lennart Poettering 45c0de1f3c Merge pull request #4360 from fbuihuu/journald-fix-flush-when-restarting
Journald fix flush when restarting (#4190)
2016-10-20 00:10:08 +02:00
Lucas Werkmeister 4cf13011fe man: document dependencies implied by Sockets= (#4412)
Fixes #4410. Also includes two minor improvements to the previous
sentence.
2016-10-19 23:21:26 +02:00
Lennart Poettering 0afc6d4920 Merge pull request #4378 from evverx/nspawn-smoke-test
tests: add smoke test for systemd-nspawn
2016-10-19 21:35:39 +02:00
Lennart Poettering e6fa8681dc Merge pull request #4390 from keszybz/install-specifiers
Various install-related tweaks
2016-10-19 21:33:32 +02:00
Evgeny Vereshchagin 88a00ac517 bootctl: don't try to remove esp_path (#4407)
This is a follow-up for 9ee051b9c7
2016-10-19 21:15:20 +02:00
Yu Watanabe 9ee051b9c7 boot: fix `bootctl install` segfault (#4404) 2016-10-19 14:50:47 +03:00
Franck Bui 57f443a6d9 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.
2016-10-19 09:53:07 +02:00
Franck Bui 3a19f2150d 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.
2016-10-19 09:53:07 +02:00
Franck Bui a0edc477bd journal: introduce cache_space_invalidate()
Introduce a dedicated helper in order to reset the storage space cache.
2016-10-19 09:53:07 +02:00
Franck Bui 23aba34349 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.
2016-10-19 09:53:07 +02:00
Franck Bui 18e758bf25 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.
2016-10-19 09:53:07 +02:00
Franck Bui cba5629e87 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.
2016-10-19 09:53:07 +02:00
Franck Bui 266a470005 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.
2016-10-19 09:53:07 +02:00
Franck Bui e0ed6db9cd 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.
2016-10-19 09:53:07 +02:00
Zbigniew Jędrzejewski-Szmek 59108fbecb 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.
2016-10-18 21:30:51 -04:00
Zbigniew Jędrzejewski-Szmek a6612e658c 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.
2016-10-18 21:30:51 -04:00
Zbigniew Jędrzejewski-Szmek db093eed04 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.
2016-10-18 21:30:51 -04:00
Zbigniew Jędrzejewski-Szmek 19539807b5 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.
2016-10-18 21:30:47 -04:00
Lennart Poettering 70fd2125c3 Merge pull request #4382 from keszybz/unit-type-underline
systemctl: use underlines to seperate unit types in listing
2016-10-18 17:03:40 +02:00
Susant Sahani 59f62519f1 networkd: use proper cast to access VTI6 (#4399)
Fixes #4371.
2016-10-17 23:19:08 -04:00
Luca Bruno 52c239d770 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.
2016-10-17 20:05:49 -04:00
Zbigniew Jędrzejewski-Szmek a2fc3d87fb README: list dependencies for testing
Fixes #4365.
2016-10-17 16:54:27 +00:00
Evgeny Vereshchagin c7934185fe 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 :-)
2016-10-17 16:50:09 +00:00
Zbigniew Jędrzejewski-Szmek caf15ff01e man: add a note that NULL "s" arg for sd_bus_message_append 2016-10-17 12:22:44 -04:00
Zbigniew Jędrzejewski-Szmek 5c98198f67 terminal-util: helper macro for highlighting functions 2016-10-17 11:48:12 -04:00
Zbigniew Jędrzejewski-Szmek 6ae3e62a54 systemctl: ditto for list-unit-files 2016-10-17 11:47:45 -04:00
Zbigniew Jędrzejewski-Szmek 16484a8a15 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.
2016-10-17 11:37:41 -04:00
Lennart Poettering c7458f9399 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
2016-10-17 09:50:26 -04:00
llua 6c9414a700 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
2016-10-17 14:35:26 +02:00
Lennart Poettering cdc31c592a Merge pull request #4392 from keszybz/running-timers
Fix for display of elapsed timers
2016-10-17 12:58:55 +02:00
Lennart Poettering f213900b5a Merge pull request #4387 from keszybz/loginctl-tty
loginctl: print TTY field in the session listing
2016-10-17 11:36:25 +02:00
Zbigniew Jędrzejewski-Szmek 010454b459 shared/install: do not break loop when we enounter a dangling symlink
We should ignore that unit, but otherwise continue.
2016-10-17 02:26:55 -04:00
Zbigniew Jędrzejewski-Szmek 9b914a9d6b man: mention that systemctl --root=/ operates on the fs directly 2016-10-17 02:26:42 -04:00
Zbigniew Jędrzejewski-Szmek 6e2c9ce1b6 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.
2016-10-17 02:06:20 -04:00
Zbigniew Jędrzejewski-Szmek ba25d39e44 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.
2016-10-17 07:15:03 +02:00
Martin Pitt a775369354 Merge pull request #4391 from keszybz/treewide-macros
Use mfree more and add another function to simplify a common set&free pattern
2016-10-17 07:12:20 +02:00