Alban Crequy
287419c119
containers: systemd exits with non-zero code
...
When a systemd service running in a container exits with a non-zero
code, it can be useful to terminate the container immediately and get
the exit code back to the host, when systemd-nspawn returns. This was
not possible to do. This patch adds the following to make it possible:
- Add a read-only "ExitCode" property on PID 1's "Manager" bus object.
By default, it is 0 so the behaviour stays the same as previously.
- Add a method "SetExitCode" on the same object. The method fails when
called on baremetal: it is only allowed in containers or in user
session.
- Add support in systemctl to call "systemctl exit 42". It reuses the
existing code for user session.
- Add exit.target and systemd-exit.service to the system instance.
- Change main() to actually call systemd-shutdown to exit() with the
correct value.
- Add verb 'exit' in systemd-shutdown with parameter --exit-code
- Update systemctl manpage.
I used the following to test it:
| $ sudo rkt --debug --insecure-skip-verify run \
| --mds-register=false --local docker://busybox \
| --exec=/bin/chroot -- /proc/1/root \
| systemctl --force exit 42
| ...
| Container rkt-895a0cba-5c66-4fa5-831c-e3f8ddc5810d failed with error code 42.
| $ echo $?
| 42
Fixes https://github.com/systemd/systemd/issues/1290
2015-09-21 17:32:45 +02:00
..
2013-03-29 20:30:21 -04:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-22 19:54:09 +02:00
2015-07-25 23:15:51 +02:00
2015-08-25 20:06:46 +02:00
2015-06-18 19:47:44 +02:00
2015-07-25 23:15:51 +02:00
2013-06-26 08:05:14 -04:00
2015-06-18 19:47:44 +02:00
2015-07-29 18:16:48 +02:00
2014-11-03 14:46:28 +01:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-29 21:20:02 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-17 15:22:49 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-08-26 11:02:28 +02:00
2010-05-17 01:44:03 +02:00
2015-06-18 19:47:44 +02:00
2015-08-28 16:19:07 +00:00
2015-09-04 09:07:30 +02:00
2015-08-26 11:00:09 +02:00
2015-09-04 09:07:30 +02:00
2015-09-07 10:57:50 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-07-08 13:53:15 -04:00
2015-07-08 13:53:15 -04:00
2015-07-11 16:11:45 -03:00
2015-07-08 13:51:39 -04:00
2015-07-08 13:51:39 -04:00
2015-07-25 23:15:51 +02:00
2015-07-07 20:35:45 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-07-07 20:35:45 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-07-25 23:15:51 +02:00
2015-07-10 14:32:02 +02:00
2015-06-18 19:47:44 +02:00
2015-07-08 13:53:42 -04:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-09-04 09:07:31 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-09-04 09:07:31 +02:00
2015-09-04 09:07:31 +02:00
2015-06-29 21:20:02 +02:00
2015-09-05 14:56:23 +02:00
2015-09-04 09:07:31 +02:00
2015-09-04 09:07:31 +02:00
2015-09-04 09:07:31 +02:00
2015-06-18 19:47:44 +02:00
2015-07-25 23:15:51 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-09-02 10:01:34 +02:00
2015-06-18 19:47:44 +02:00
2015-07-02 09:15:09 -04:00
2015-09-21 17:32:45 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-22 19:54:09 +02:00
2015-06-22 19:54:09 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-09-21 12:04:45 +00:00
2015-07-25 23:15:51 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-09-02 01:49:47 +00:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-08-02 22:22:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-09-08 12:55:50 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-07-25 23:15:51 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-07-30 10:24:16 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-07-29 20:30:50 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-09-07 20:06:58 +02:00
2015-09-01 18:31:04 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-08-28 02:04:57 +02:00
2015-06-18 19:47:44 +02:00
2015-09-01 16:43:08 +00:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-09-10 18:41:06 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-08-16 18:29:54 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-08-25 18:37:53 +02:00
2015-07-29 18:16:48 +02:00
2015-07-25 23:15:51 +02:00
2015-06-18 19:47:44 +02:00
2015-07-25 13:08:21 -04:00
2015-06-18 19:47:44 +02:00
2015-08-31 13:22:15 +05:30
2015-09-12 08:18:36 +05:30
2015-09-07 20:06:58 +02:00
2015-06-18 19:47:44 +02:00
2015-07-17 15:02:26 +02:00
2015-09-11 18:31:49 +02:00
2015-06-18 19:47:44 +02:00
2015-08-11 13:01:53 +00:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-07-25 23:15:51 +02:00
2015-09-21 17:32:45 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-29 10:33:31 -05:00
2015-06-18 19:47:44 +02:00
2015-09-16 00:21:55 +02:00
2015-08-17 19:16:04 +00:00
2015-06-23 10:40:29 +02:00
2015-06-18 19:47:44 +02:00
2015-08-16 18:29:54 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-17 15:22:49 +02:00
2015-06-17 15:22:49 +02:00
2015-06-18 19:18:33 +02:00
2015-06-17 15:22:49 +02:00
2015-06-17 15:22:49 +02:00
2015-06-17 15:22:49 +02:00
2015-06-17 15:22:49 +02:00
2015-06-17 15:22:49 +02:00
2015-06-17 15:22:49 +02:00
2015-06-17 15:22:49 +02:00
2015-06-17 15:22:49 +02:00
2015-06-18 19:47:44 +02:00
2015-06-30 19:57:40 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00
2015-06-18 19:47:44 +02:00