1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-01 09:21:26 +03:00
Commit Graph

422 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
40acc203c0 systemctl: avoid bumping NOFILE rlimit unless needed
We actually only use the journal when showing status. Move setrlimit call
so it is only called for status.

https://bugzilla.redhat.com/show_bug.cgi?id=1184712
2015-04-14 21:47:20 -04:00
Ronny Chevalier
288a74cce5 shared: add terminal-util.[ch] 2015-04-11 00:34:02 +02:00
Ronny Chevalier
0b452006de shared: add process-util.[ch] 2015-04-10 23:54:49 +02:00
Ronny Chevalier
6482f6269c shared: add formats-util.h 2015-04-10 23:54:48 +02:00
Jan Janssen
a4921cf4e2 systemctl: Use logind for --firmware-setup if possible 2015-04-08 18:22:16 +02:00
Jan Janssen
5bdf22430e logind,systemctl: add reboot to EFI firmware support 2015-04-07 18:51:45 +02:00
David Herrmann
15411c0cb1 tree-wide: there is no ENOTSUP on linux
Replace ENOTSUP by EOPNOTSUPP as this is what linux actually uses.
2015-03-13 14:10:39 +01:00
Zbigniew Jędrzejewski-Szmek
2558691285 systemctl: remove dead check
r could never be less than zero.

CID #1271350.
2015-03-07 15:00:22 -05:00
Lennart Poettering
5ad096b3f1 core: expose consumed CPU time per unit
This adds support for showing the accumulated consumed CPU time per-unit
in the "systemctl status" output. The property is also readable via the
bus.
2015-03-02 12:15:25 +01:00
Zbigniew Jędrzejewski-Szmek
95d383ee47 systemctl: bump NOFILE only for systemctl_main
It is not necessary when running as telinit, etc.

https://bugzilla.redhat.com/show_bug.cgi?id=1184712
2015-02-24 10:11:06 -05:00
Zbigniew Jędrzejewski-Szmek
8527b07be1 systemctl: support auditd.service better
We would print the filename header before trying to open the file. But since
the header was printed to stdout, and the error to stderr, the error would appear
on the terminal before the header. It is cleaner to open the file first, then
and only then print the header.

Also exit on first error. We shouldn't report success if we were unable to open
a file.
2015-02-23 23:38:31 -05:00
Zbigniew Jędrzejewski-Szmek
d028e01814 systemctl: check validity of PID we received 2015-02-23 23:38:30 -05:00
Thomas Hindoe Paaboel Andersen
2eec67acbb remove unused includes
This patch removes includes that are not used. The removals were found with
include-what-you-use which checks if any of the symbols from a header is
in use.
2015-02-23 23:53:42 +01:00
Lennart Poettering
d5d8429a12 everywhere: remove configurability of sysv runlevel to target mapping
With this change runlevel 2, 3, 4 are mapped to multi-user.target for
good, and 5 to graphical.target. This was already the previous mapping
but is now no longer reconfigurable, but hard-coded into the core.

This should generally simplify things, but also fix one bug: the
sysv-generator previously generated symlinks to runlevel[2-5].target
units, which possibly weren't picked up if these aliases were otherwise
only referenced by the real names "multi-user.target" and
"graphical.target".

We keep compat aliases "runlevel[2345].target" arround for cases where
this target name is explicitly requested.
2015-02-18 20:20:14 +01:00
Lennart Poettering
6e646d22f6 systemctl: allow interactive authorization for all bus calls
Make use of the new sd_bus_set_allow_interactive_authorization() call to
globally enable interactive authorization. Also, turn on PK agent for
more calls.

This allows us to make use of the sd_bus_call_method() convencience
helper at more places.
2015-02-18 18:56:27 +01:00
Lennart Poettering
1cfa9a4cbb systemctl: let's make use of FOREACH_STRING() where we can 2015-02-18 18:56:27 +01:00
Zbigniew Jędrzejewski-Szmek
2404701e67 Transpose args in strv_fnmatch() to be more oo 2015-02-16 14:04:36 -05:00
Zbigniew Jędrzejewski-Szmek
bceccd5ecc Add helper for fnmatch over strv 2015-02-16 13:16:45 -05:00
Thomas Hindoe Paaboel Andersen
8744505aae remove unused variable 2015-02-12 20:44:06 +01:00
Michael Olbrich
c31c4324c5 systemctl: don't update the reboot parameter if none is given
Otherwise systemd-reboot.service will remove the parameter that was set
before. This was broken in commit "b986229efe2cc96157aa14c37bab7843311bbef1
systemctl: bugfix for systemctl reboot command with argument"
2015-02-11 20:37:16 +01:00
Ivan Shapovalov
dab2bce81e systemctl: unit_find_paths(): unify error handling in two code pathes 2015-02-04 20:10:28 -05:00
Ivan Shapovalov
029009d497 systemctl: cat, edit: further polish error messages 2015-02-04 20:10:27 -05:00
Ivan Shapovalov
3e7eed8497 systemctl: cat: fix error handling
- correctly check for local vs. remote transport
- return after receiving error from expand_names()
2015-02-04 20:10:27 -05:00
Ivan Shapovalov
b5e6a60032 systemctl: cat, edit: improve unit load error reporting
- report actual load error for units which could not be loaded
- make unit_find_paths() report all kinds of errors it encounters
  (for consistency)
- consistently handle not-found errors in cat() and edit()
2015-02-04 20:10:27 -05:00
Lennart Poettering
63c372cb9d util: rework strappenda(), and rename it strjoina()
After all it is now much more like strjoin() than strappend(). At the
same time, add support for NULL sentinels, even if they are normally not
necessary.
2015-02-03 02:05:59 +01:00
Zbigniew Jędrzejewski-Szmek
3e495a6651 systemctl: refuse --host with cat
This might be fixed one day, but for now it's better to fail.

https://bugzilla.redhat.com/show_bug.cgi?id=1186952
2015-01-28 21:56:10 -05:00
Sangjung Woo
b986229efe systemctl: bugfix for systemctl reboot command with argument
According to systemctl man page, 'systemctl reboot [arg]' should work
without any errors. However, it does not work because of 'Invalid number
of arguments' error, except for 'reboot [arg]'. This patch fixes the bug
so that both of commands work in exactly the same way.
2015-01-23 09:30:44 -05:00
Lennart Poettering
934277fe6a core: add a property that shows the current memory usage of a unit
This is exposed the memory.usage_in_bytes cgroup property on the bus,
and makes "systemctl status" show it in its default output.
2015-01-23 03:00:15 +01:00
Zbigniew Jędrzejewski-Szmek
1fa2f38f0f Assorted format fixes
Types used for pids and uids in various interfaces are unpredictable.
Too bad.
2015-01-22 01:14:52 -05:00
Zbigniew Jędrzejewski-Szmek
250ba6647b systemctl: do not show dots with --plain
Plain implies a ... "plain" output.

Also do not say "No jobs" with --no-legend. We skip
reporting the number of jobs with --no-legend if there
are any, and 0 is also a number, and should be skipped.
2015-01-19 15:41:03 -05:00
Zbigniew Jędrzejewski-Szmek
3fb90db2d6 systemctl: fix import-environment description, trim help to 80 cols 2015-01-19 13:55:59 -05:00
Ronny Chevalier
86d81e502b systemctl: add missing output modes to help message 2015-01-09 13:54:19 +01:00
Lennart Poettering
f2068bcce0 machined: when cloning a raw disk image, also set the NOCOW flag 2015-01-08 23:13:45 +01:00
Lennart Poettering
b619ec8f83 man: bring systemctl man page and --help text into the same order 2015-01-08 23:13:45 +01:00
Lennart Poettering
079dac08c6 systemctl,loginctl: start polkit agent for all polkit enabled operations 2015-01-08 23:13:45 +01:00
Lennart Poettering
8b0cc9a36c machinectl: show most recent log output in "machinectl status", too 2015-01-08 23:13:45 +01:00
Lennart Poettering
3c7560019e loginctl: show the 10 most recent log user/session log lines in "loginctl user-status" and "loginctl session-status" 2015-01-08 23:13:45 +01:00
Lennart Poettering
de45d72603 journal: bump RLIMIT_NOFILE when journal files to 16K (if possible)
When there are a lot of split out journal files, we might run out of fds
quicker then we want. Hence: bump RLIMIT_NOFILE to 16K if possible.

Do these even for journalctl. On Fedora the soft RLIMIT_NOFILE is at 1K,
the hard at 4K by default for normal user processes, this code hence
bumps this up for users to 4K.

https://bugzilla.redhat.com/show_bug.cgi?id=1179980
2015-01-08 03:20:45 +01:00
Ivan Shapovalov
60d27f1916 path-lookup, systemctl: export lookup_paths_init_from_scope() from shared/install.c and use it 2015-01-05 11:13:30 -05:00
Lennart Poettering
aba843317d systemctl: properly iterate through service array when dispatching to sysv
https://bugzilla.redhat.com/show_bug.cgi?id=1175734
2015-01-05 01:56:47 +01:00
Zbigniew Jędrzejewski-Szmek
a39b4bdd10 systemctl: do not repeat hibernate/sleep attempts
If some sleep operation was not possible (e.g. because swap is missing),
we would try twice: once through logind, which would result in a clean error:
  Failed to execute operation: Sleep verb not supported
and then second time by starting the appropriate unit directly, which is
more messy. If logind tells us that something is not possible (or already
in progress), report that to the user and quit. If logind is present and working
we should not try to work around it.

Loosely based on https://bugs.freedesktop.org/show_bug.cgi?id=87832.
2014-12-30 18:39:52 -05:00
Lennart Poettering
d8f52ed25a machinectl: add "enable" and "disable" verbs for enabling/disabling systemd-nspawn for containers
This is basically just a shortcut for "systemctl enable
systemd-nspawn@<foobar>.service", but does escaping.
2014-12-29 17:00:05 +01:00
Lennart Poettering
ebd011d95b machinectl: add new "start" verb to start a container as a service in nspawn 2014-12-29 17:00:05 +01:00
Lennart Poettering
de33fc6257 sd-bus: rename sd_bus_open_system_container() to sd_bus_open_system_machine()
Pretty much everywhere else we use the generic term "machine" when
referring to containers in API, so let's do though in sd-bus too. In
particular, since the concept of a "container" exists in sd-bus too, but
as part of the marshalling system.
2014-12-24 16:53:04 +01:00
Jan Synacek
75836b9d20 systemctl: fix argument handling when invoked as "shutdown" 2014-12-16 00:30:34 -05:00
Zbigniew Jędrzejewski-Szmek
bc854dc7cd systemctl: refuse to edit runtime dropins when they already exist in /etc
The check for existing unit files and dropins is unified.

path_join() is updated to not insert duplicate separators.
2014-12-16 00:30:34 -05:00
Zbigniew Jędrzejewski-Szmek
ad2a035820 systemctl: share path lookup between 'cat' and 'edit'
'systemctl cat' now works for templates too.

'systemctl edit' does not refuse to edit units that have changed on
disk. That restriction didn't seem useful, actually editing units that
have changed on disk before they are started is very reasonable.

'edit' with instances and templates works again:

Now:

$ build/systemctl edit getty@
Failed to copy /etc/systemd/system/getty@.service.d/override.conf to /etc/systemd/system/getty@.service.d/.override.confdff6290408c86369: Permission denied
$ build/systemctl edit getty@tty3
Failed to create directories for /etc/systemd/system/getty@tty3.service.d/override.conf: Permission denied
$ build/systemctl edit --full getty@tty3
Failed to copy /usr/lib/systemd/system/getty@.service to /etc/systemd/system/.getty@tty3.serviced3d175087e7e439b: Permission denied
Failed to create temporary file for /etc/systemd/system/getty@tty3.service: Permission denied
$ build/systemctl edit --full getty@
Failed to copy /usr/lib/systemd/system/getty@.service to /etc/systemd/system/.getty@.servicea3caad491c0f2f3d: Permission denied
Failed to create temporary file for /etc/systemd/system/getty@.service: Permission denied
2014-12-16 00:30:34 -05:00
Zbigniew Jędrzejewski-Szmek
8df1850740 systemctl: split out LookupPaths initialization 2014-12-16 00:30:34 -05:00
Zbigniew Jędrzejewski-Szmek
33f6c497f3 systemctl: move two functions up
No functional change.
2014-12-16 00:30:33 -05:00
Zbigniew Jędrzejewski-Szmek
3f36991e00 systemctl: unify warning about unit files changed on disk 2014-12-16 00:30:33 -05:00