From 0e56b0cba0500b265c3043940532d2f3b04456ef Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Thu, 1 Sep 2016 22:33:00 +1200 Subject: [PATCH] Clean up systemd jobs. The main visible effect of this is that if console-conf crashes or is killed it restarts instantly rather than 90 seconds later. It also removes the flicker where a getty gets started and then instantly killed during startup. --- debian/console-conf-serial.conf | 5 ++--- debian/console-conf.conf | 5 ++--- debian/console-conf.console-conf@.service | 8 ++------ debian/console-conf.serial-console-conf@.service | 4 ++-- subiquitycore/utils.py | 2 +- 5 files changed, 9 insertions(+), 15 deletions(-) diff --git a/debian/console-conf-serial.conf b/debian/console-conf-serial.conf index 25f35b08..a606c73a 100644 --- a/debian/console-conf-serial.conf +++ b/debian/console-conf-serial.conf @@ -1,3 +1,2 @@ -[Unit] -After=serial-console-conf@%i.service -Wants=serial-console-conf@%i.service \ No newline at end of file +[Service] +ExecStartPre=/bin/systemctl start serial-console-conf@%i.service diff --git a/debian/console-conf.conf b/debian/console-conf.conf index 6f982156..9f3670b6 100644 --- a/debian/console-conf.conf +++ b/debian/console-conf.conf @@ -1,3 +1,2 @@ -[Unit] -After=console-conf@%i.service -Wants=console-conf@%i.service \ No newline at end of file +[Service] +ExecStartPre=/bin/systemctl start console-conf@%i.service diff --git a/debian/console-conf.console-conf@.service b/debian/console-conf.console-conf@.service index 29b16b84..b2399d9f 100644 --- a/debian/console-conf.console-conf@.service +++ b/debian/console-conf.console-conf@.service @@ -1,9 +1,7 @@ [Unit] Description=Ubuntu Core Firstboot Configuration %I After=systemd-user-sessions.service plymouth-quit-wait.service -ExecPreStart=systemctl stop getty@%I After=rc-local.service -ExecStop=systemctl start getty@%I IgnoreOnIsolate=yes ConditionPathExists=/dev/tty0 ConditionPathExists=!/var/lib/console-conf/complete @@ -11,10 +9,8 @@ ConditionPathExists=!/var/lib/console-conf/complete [Service] Environment=PYTHONPATH=/usr/share/subiquity ExecStartPre=/bin/systemctl stop getty@%I -ExecStart=-/sbin/agetty -n --noclear -l /usr/share/subiquity/console-conf-wrapper %I $TERM -ExecStop=/bin/systemctl start getty@%I -#ExecStopPost=/bin/echo "Post stop, starting getty@%I" -#ExecStopPost=/bin/systemctl start getty@%I +ExecStart=/sbin/agetty -n --noclear -l /usr/share/subiquity/console-conf-wrapper %I $TERM +ExecStopPost=/bin/systemctl start getty@%I Type=idle Restart=always RestartSec=0 diff --git a/debian/console-conf.serial-console-conf@.service b/debian/console-conf.serial-console-conf@.service index cb77ffa1..80f83ad1 100644 --- a/debian/console-conf.serial-console-conf@.service +++ b/debian/console-conf.serial-console-conf@.service @@ -8,8 +8,8 @@ ConditionPathExists=!/var/lib/console-conf/complete [Service] Environment=PYTHONPATH=/usr/share/subiquity ExecStartPre=/bin/systemctl stop serial-getty@%I -ExecStart=-/sbin/agetty -n --keep-baud -f /usr/share/subiquity/console-conf-wait -w -l /usr/bin/console-conf --login-options "--serial" 115200,38400,9600 %I $TERM -ExecStop=/bin/systemctl start serial-getty@%I +ExecStart=/sbin/agetty -n --keep-baud -f /usr/share/subiquity/console-conf-wait -w -l /usr/bin/console-conf --login-options "--serial" 115200,38400,9600 %I $TERM +ExecStopPost=/bin/systemctl start serial-getty@%I Type=idle Restart=always RestartSec=0 diff --git a/subiquitycore/utils.py b/subiquitycore/utils.py index a33e1e72..d44e84f9 100644 --- a/subiquitycore/utils.py +++ b/subiquitycore/utils.py @@ -222,5 +222,5 @@ def mark_firstboot_complete(): def disable_first_boot_service(): """ Stop firstboot service; which also restores getty service """ log.info('disabling first boot service') - run_command(["systemctl", "stop", "console-conf@*.service", "serial-console-conf@*.service"]) + run_command(["systemctl", "stop", "--no-block", "console-conf@*.service", "serial-console-conf@*.service"]) return