Commit graph

27544 commits

Author SHA1 Message Date
Lennart Poettering aa70f38b5c namespace: clarify that /proc/apm is obsolete, but leave it blocked 2016-11-17 18:10:30 +01:00
Lennart Poettering c6232fb0e9 namespace: reindent namespace tables
Let's align all our BindMount tables, let's use the same column widths in all
of them, and let's make them not any wider than necessary.

This only changes whitespace, not contents of any of the tables.
2016-11-17 18:09:16 +01:00
Lennart Poettering 5327c910d2 namespace: simplify, optimize and extend handling of mounts for namespace
This changes a couple of things in the namespace handling:

It merges the BindMount and TargetMount structures. They are mostly the same,
hence let's just use the same structue, and rely on C's implicit zero
initialization of partially initialized structures for the unneeded fields.

This reworks memory management of each entry a bit. It now contains one "const"
and one "malloc" path. We use the former whenever we can, but use the latter
when we have to, which is the case when we have to chase symlinks or prefix a
root directory. This means in the common case we don't actually need to
allocate any dynamic memory. To make this easy to use we add an accessor
function bind_mount_path() which retrieves the right path string from a
BindMount structure.

While we are at it, also permit "+" as prefix for dirs configured with
ReadOnlyPaths= and friends: if specified the root directory of the unit is
implicited prefixed.

This also drops set_bind_mount() and uses C99 structure initialization instead,
which I think is more readable and clarifies what is being done.

This drops append_protect_kernel_tunables() and
append_protect_kernel_modules() as append_static_mounts() is now simple enough
to be called directly.

Prefixing with the root dir is now done in an explicit step in
prefix_where_needed(). It will prepend the root directory on each entry that
doesn't have it prefixed yet. The latter is determined depending on an extra
bit in the BindMount structure.
2016-11-17 18:08:32 +01:00
Martin Pitt 375fd1559b Merge pull request #4681 from keszybz/shortening
Shortening
2016-11-17 08:20:01 +01:00
Zbigniew Jędrzejewski-Szmek 4a58145f0f Merge pull request #4678 from poettering/gc-device
Automatically GC device jobs when there's no need to keep them in the job queue anymore.
Implement systemctl list-jobs --before/--after.
Allow systemd-run -p After/Before/Wants/Requires= ...
2016-11-16 21:16:13 -05:00
Zbigniew Jędrzejewski-Szmek 76d8ca2229 core/dbus-job, systemctl: shorten some code 2016-11-16 21:01:11 -05:00
Zbigniew Jędrzejewski-Szmek bc357ce5d7 systemctl: shorter list-jobs --before/--after output a bit
(before)$ systemctl list-jobs  --before --after
 JOB UNIT                                          TYPE  STATE
8769 foobar.device                                 start running
        A job waits for this job: 8669 (run-rb6da596d0cfa4e36b7c594cd973e795a.service/start)
8669 run-rb6da596d0cfa4e36b7c594cd973e795a.service start waiting
        This job waits for a job: 8769 (foobar.device/start)

2 jobs listed.

(after)$ systemctl list-jobs  --before --after
 JOB UNIT                                          TYPE  STATE
8769 foobar.device                                 start running
        waiting for job 8669 (run-rb6da596d0cfa4e36b7c594cd973e795a.service/start)
8669 run-rb6da596d0cfa4e36b7c594cd973e795a.service start waiting
        blocking job 8769 (foobar.device/start)

2 jobs listed.
2016-11-16 20:51:47 -05:00
Francesco Brozzu c4027307a2 hwdb: fix airplane mode trigger when switching from laptop to desktop on HP Pavilion x360 13 (#4680) 2016-11-16 22:57:20 +01:00
Lennart Poettering 7d992a6ede update TODO 2016-11-16 17:01:46 +01:00
Lennart Poettering 82948f6c8e systemctl: show waiting jobs when "systemctl list-jobs --after/--before" is called
Let's expose the new bus functions we added in the previous commit in
systemctl.
2016-11-16 17:01:46 +01:00
Lennart Poettering 15ea79f85c core: add bus calls for determining jobs waiting for other jobs
This should make it easier to debug job deadlocks.
2016-11-16 17:01:46 +01:00
Lennart Poettering 289188ca7d system-run: add support for configuring unit dependencies with --property=
Support on the server side has already been in place for quite some time, let's
also add support on the client side for this.
2016-11-16 15:03:26 +01:00
Lennart Poettering d4015567ad systemctl: add env var to force connection to system manager via the bus
Sometimes it is useful for debugging purposes to force systemctl to connect to
PID 1 via the bus instead of direct connection, even if the direct connection
is possible.
2016-11-16 15:03:26 +01:00
Lennart Poettering c5a97ed132 core: GC redundant device jobs from the run queue
In contrast to all other unit types device units when queued just track
external state, they cannot effect state changes on their own. Hence unless a
client or other job waits for them there's no reason to keep them in the job
queue. This adds a concept of GC'ing jobs of this type as soon as no client or
other job waits for them anymore.

To ensure this works correctly we need to track which clients actually
reference a job (i.e. which ones enqueued it). Unfortunately that's pretty
nasty to do for direct connections, as sd_bus_track doesn't work for
them. For now, work around this, by simply remembering in a boolean that a job
was requested by a direct connection, and reset it when we notice the direct
connection is gone. This means the GC logic works fine, except that jobs are
not immediately removed when direct connections disconnect.

In the longer term, a rework of the bus logic should fix this properly. For now
this should be good enough, as GC works for fine all cases except this one, and
thus is a clear improvement over the previous behaviour.

Fixes: #1921
2016-11-16 15:03:26 +01:00
Lennart Poettering 1a465207ab core: rename "clients" field of Job structure to "bus_track"
Let's make semantics of this field more similar to the same functionality in
the Unit object, in particular as we add new functionality to it later on.
2016-11-16 15:03:26 +01:00
Lennart Poettering a2d72e265a core: drop n_in_gc_queue field of Manager structure
We count the units in the GC queue with this, but actually never make use of
it, hence drop it.
2016-11-16 15:03:26 +01:00
Lennart Poettering 0a23a62729 core: a few small coding style/modernization updates for job.c 2016-11-16 15:03:26 +01:00
Lennart Poettering 984794baf4 shared: split out code for adding multiple names to sd_bus_track object
Let's introduce a new call bus_track_add_name_many() that adds a string list to
a tracking object.
2016-11-16 15:03:26 +01:00
Djalal Harouni afc402b76a Merge pull request #4658 from endocode/djalal/sandbox-various-fixes-v1
core: improve the logic that implies no new privileges and documentation fixes
2016-11-15 20:45:27 +01:00
Evgeny Vereshchagin 22f1f8f24c tests: add UNIFIED_CGROUP_HIERARCHY=[default|hybrid] (#4675)
This will simplify testing a bit.
Mainly for https://github.com/systemd/systemd/pull/4670
2016-11-15 17:38:04 +01:00
Djalal Harouni 73186d534b bus-util: print RestrictNamespaces= as a string
Allow all callers that want to print RestrictNamespaces= returned from D-Bus
as a string instead of a u64 value.
2016-11-15 15:52:42 +01:00
Djalal Harouni 97e60383c0 test: add tests for RestrictNamespaces= 2016-11-15 15:50:19 +01:00
Djalal Harouni d6299d613f core:gperf: pass the exec_context struct directly to parse restrict namespaces
The RestrictNamespaces= takes yes, no or a list of namespaces types,
therefor config_parse_restrict_namespaces() is a bit complex and it
operates on the ExecContext, fix this by passing the offset of
ExecContext directly otherwise restricting namespaces won't work.
2016-11-15 15:04:43 +01:00
Djalal Harouni 8526555680 doc: move ProtectKernelModules= documentation near ProtectKernelTunalbes= 2016-11-15 15:04:41 +01:00
Djalal Harouni 6a8c2d5915 core: property is RestrictNamespaces with s 2016-11-15 15:04:38 +01:00
Djalal Harouni a7db8614f3 doc: note when no new privileges is implied 2016-11-15 15:04:35 +01:00
Djalal Harouni c92e8afebd core: improve the logic that implies no new privileges
The no_new_privileged_set variable is not used any more since commit
9b232d3241 that fixed another thing. So remove it. Also no
need to check if we are under user manager, remove that part too.
2016-11-15 15:04:31 +01:00
David Herrmann 46b6025a88 Merge pull request #4665 from teg/networkd-split-1
networkd: split sources into subdirectories
2016-11-14 12:08:38 +01:00
Zbigniew Jędrzejewski-Szmek 2a49b6120f nspawn: restart the whole systemd-nspawn@.service unit on container reboot (#4613)
Since 133 is now used in a few places, add a #define for it.
Also make the status message a bit informative.

Another issue introduced in b006762. The logic was borked, we were supposed
to return 0 to break the loop, and 133 to restart the container, not the other
way around.

But this doesn't seem to work, reboot fails with:
Nov 08 00:41:32 laptop systemd-nspawn[26564]: Failed to register machine: Machine 'fedora-rawhide' already exists
So actually the version before this patch worked better, since 133 > 0 and we'd
at least loop internally.
2016-11-14 11:49:49 +01:00
Maks Naumov 45d34fa7fb link: fix offload features initialization (#4639) 2016-11-14 11:33:43 +01:00
Tom Gundersen 23f53b99b1 networkd: clean up main header file a bit
Rename networkd.h to networkd-manager.h, to more accurately describe what it
contains.
2016-11-14 01:05:06 +01:00
Tom Gundersen 441e9ae4d9 networkd: netdev - move to separate subdirectory
This could (and should) be made into a separate daemon, at least move
the sourcefiles out for now.
2016-11-13 05:16:49 +01:00
Tom Gundersen c5fcf6e470 networkd-wait-online: move to separate subdirectory
Also clean up the header files a bit.
2016-11-13 01:29:30 +01:00
Tom Gundersen 7d342c0332 networkd: network - apply() does not need to take the manager object 2016-11-13 01:02:46 +01:00
Michael Biebl 1f8c78a1ba Merge pull request #4659 from keszybz/ctrl-alt-del-twice
build-sys: do not install ctrl-alt-del.target symlink twice
2016-11-12 19:47:32 +01:00
Zbigniew Jędrzejewski-Szmek 4318abe8d2 build-sys: do not install ctrl-alt-del.target symlink twice
It was a harmless but pointless duplication. Fixes #4655.

Note: in general we try to install as little as possible in
/etc/systemd/{system,user}. We only install .wants links there for units which
are "user configurable", i.e. which have an [Install] section. Most our units
and aliases are not user configurable, do not have an [Install] section, and
must be symlinked statically during installation. A few units do have an
[Install] section, and are enabled through symlinks in /etc/ during
installation using GENERAL_ALIASES. It *would* be possible to not create those
symlinks, and instead require 'systemctl preset' to be invoked after
installation, but GENERAL_ALIASES works well enough.
2016-11-12 10:14:10 -05:00
Lucas Werkmeister b793ddfa6c man: add Itanium root GUID to table (#4656)
This GUID was added in #2263, but the manpage was not updated.
2016-11-11 22:25:32 -05:00
Felipe Sateler c6dd36b65c systemctl: resolve symlinks when finding unit paths (#4545)
Otherwise we think the alias is the real unit, and may edit/cat the
wrong unit.

Before this patch:
 $ systemctl edit autovt@ # creates dropin in /etc/systemd/system/autovt@.service.d
 $ systemctl cat autovt@ | grep @.service
 # /lib/systemd/system/autovt@.service
 # that serial gettys are covered by serial-getty@.service, not this
 # /etc/systemd/system/autovt@.service.d/override.conf
 $ systemctl cat getty@ | grep @.service
 # /lib/systemd/system/getty@.service
 # that serial gettys are covered by serial-getty@.service, not this

After this patch
 $ systemctl edit autovt@ # creates dropin in /etc/systemd/system/getty@.service.d
 $ systemctl cat autovt@ | grep @.service
 # /usr/lib/systemd/system/getty@.service
 # that serial gettys are covered by serial-getty@.service, not this
 # /etc/systemd/system/getty@.service.d/override.conf
 systemctl cat getty@ | grep @.service
 # /usr/lib/systemd/system/getty@.service
 # that serial gettys are covered by serial-getty@.service, not this
 # /etc/systemd/system/getty@.service.d/override.conf
2016-11-11 21:28:06 -05:00
Djalal Harouni f40771a580 Merge pull request #4652 from mbiebl/configure-bzip2
various small cleanups in our configure help output
2016-11-12 00:49:20 +01:00
Zbigniew Jędrzejewski-Szmek b878b618ad units: disable /sys/fs/fuse/connections in private user namespaces (#4592)
The mount fails, even though CAP_SYS_ADMIN is granted.

Only file systems with FU_USERNS_MOUNT in .fs_flags may be mounted in userns,
and the patch to add that fusectl was rejected [1]. It would be nice if we
could check if the kernel has FU_USERNS_MOUNT for a given fs type, since this
could change over time, but this information doesn't seem to be exported.
So let's just skip this mount in userns to avoid an error during boot.

[1] https://patchwork.kernel.org/patch/2828269/
2016-11-11 19:00:33 +01:00
Zbigniew Jędrzejewski-Szmek c58bd76a6a tree-wide: make invocations of extract_first_word more uniform (#4627)
extract_first_words deals fine with the string being NULL, so drop the upfront
check for that.
2016-11-11 18:58:41 +01:00
akochetkov 5f36e3d303 timesyncd: clear ADJ_MAXERROR to keep STA_UNSYNC cleared after jump adjust (#4626)
NTP use jump adjust if system has incorrect time read from RTC during boot.
It is desireble to update RTC time as soon as NTP set correct system time.
Sometimes kernel failed to update RTC due to STA_UNSYNC get set before RTC
update finised. In that case RTC time wouldn't be updated within long time.
The commit makes RTC updates stable.

When NTP do jump time adjust using ADJ_SETOFFSET it clears STA_UNSYNC flag.
If don't clear ADJ_MAXERROR, STA_UNSYNC will be set again by kernel within
1 second (by second_overflow() function). STA_UNSYNC flag prevent RTC updates
in kernel. Sometimes the kernel is able to update RTC withing 1 second,
but sometimes it falied.
2016-11-11 18:50:46 +01:00
Michael Biebl 06b4eb93ec build-sys: use lowercase consistently in AS_HELP_STRING
We were using a mix of upper and lowercase. Since autoconf's own help
output uses lowercase, use that as well.
2016-11-11 17:05:08 +01:00
Zbigniew Jędrzejewski-Szmek abd67ce748 basic/virt: fix userns check on CONFIG_USER_NS=n kernel (#4651)
ENOENT should be treated as "false", but because of the broken errno check it
was treated as an error. So ConditionVirtualization=user-namespaces probably
returned the correct answer, but only by accident.

Fixes #4608.
2016-11-11 18:54:54 +03:00
Michael Biebl 223dfa1ca9 build-sys: replace obsolete AC_HELP_STRING with AS_HELP_STRING
The AC_HELP_STRING autoconf macro is obsolete. Use AS_HELP_STRING instead.
2016-11-11 16:41:26 +01:00
Michael Biebl 784751dfc6 build-sys: fix help text of bzip2 configure check
The bzip2 support is enabled by default unless requested otherwise via
--disable-bzip2. Make the help text reflect that.

Fixes: #4636
2016-11-11 16:39:03 +01:00
Christian Hesse 110773f6c9 fstab-generator: add x-systemd.mount-timeout (#4603)
This adds a new systemd fstab option x-systemd.mount-timeout. The option
adds a timeout value that specifies how long systemd waits for the mount
command to finish. It allows to mount huge btrfs volumes without issues.

This is equivalent to adding option TimeoutSec= to [Mount] section in a
mount unit file.

fixes #4055
2016-11-11 09:08:57 -05:00
Zbigniew Jędrzejewski-Szmek 9f7672b3bc test-nss: allow the module and names/addresses to be specified (#4258)
Useful for testing a single module. If nothing is specified, behaviour is the
same as before.

$ ./test-nss myhostname 192.168.0.14 localhost
======== myhostname ========
_nss_myhostname_gethostbyname4_r("localhost") → status=NSS_STATUS_SUCCESS
                   pat=buffer+0x38 errno=0/--- h_errno=0/Resolver Error 0 (no error) ttl=0
        "localhost" AF_INET 127.0.0.1 %lo
        "localhost" AF_INET6 ::1 %lo

_nss_myhostname_gethostbyname3_r("localhost", AF_INET) → status=NSS_STATUS_SUCCESS
                   errno=0/--- h_errno=0/Resolver Error 0 (no error) ttl=0
        "localhost"
        AF_INET 127.0.0.1
        canonical: "localhost"

_nss_myhostname_gethostbyname3_r("localhost", AF_INET6) → status=NSS_STATUS_SUCCESS
                   errno=0/--- h_errno=0/Resolver Error 0 (no error) ttl=0
        "localhost"
        AF_INET6 ::1
        canonical: "localhost"

_nss_myhostname_gethostbyname3_r("localhost", *) → status=NSS_STATUS_SUCCESS
                   errno=0/--- h_errno=0/Resolver Error 0 (no error) ttl=0
        "localhost"
        AF_INET 127.0.0.1
        canonical: "localhost"

_nss_myhostname_gethostbyname3_r("localhost", AF_UNIX) → status=NSS_STATUS_UNAVAIL
                   errno=97/EAFNOSUPPORT h_errno=4/No address associated with name ttl=2147483647

_nss_myhostname_gethostbyname2_r("localhost", AF_INET) → status=NSS_STATUS_SUCCESS
                   errno=0/--- h_errno=0/Resolver Error 0 (no error)
        "localhost"
        AF_INET 127.0.0.1

_nss_myhostname_gethostbyname2_r("localhost", AF_INET6) → status=NSS_STATUS_SUCCESS
                   errno=0/--- h_errno=0/Resolver Error 0 (no error)
        "localhost"
        AF_INET6 ::1

_nss_myhostname_gethostbyname2_r("localhost", *) → status=NSS_STATUS_SUCCESS
                   errno=0/--- h_errno=0/Resolver Error 0 (no error)
        "localhost"
        AF_INET 127.0.0.1

_nss_myhostname_gethostbyname2_r("localhost", AF_UNIX) → status=NSS_STATUS_UNAVAIL
                   errno=97/EAFNOSUPPORT h_errno=4/No address associated with name

_nss_myhostname_gethostbyname_r("localhost") → status=NSS_STATUS_SUCCESS
                   errno=0/--- h_errno=0/Resolver Error 0 (no error)
        "localhost"
        AF_INET 127.0.0.1

_nss_myhostname_gethostbyaddr2_r("192.168.0.14") → status=NSS_STATUS_SUCCESS
                   errno=0/--- h_errno=0/Resolver Error 0 (no error) ttl=0
        "laptop"
        AF_INET 192.168.0.14
        AF_INET 192.168.122.1
        AF_INET 169.254.209.76

_nss_myhostname_gethostbyaddr_r("192.168.0.14") → status=NSS_STATUS_SUCCESS
                   errno=0/--- h_errno=0/Resolver Error 0 (no error)
        "laptop"
        AF_INET 192.168.0.14
        AF_INET 192.168.122.1
        AF_INET 169.254.209.76
2016-11-11 13:39:20 +01:00
Zbigniew Jędrzejewski-Szmek d48bb46b5a man: update machine-id(5) with a note about privacy (#4645) 2016-11-11 13:31:52 +01:00
Djalal Harouni 00abd62ab5 Merge pull request #4647 from evverx/arch-testsuite
tests: fix kernel/initrd searching (Arch)
2016-11-11 11:07:40 +01:00