Merge lp:~pitti/ubiquity/systemd into lp:ubiquity

Proposed by Martin Pitt
Status: Merged
Merged at revision: 6250
Proposed branch: lp:~pitti/ubiquity/systemd
Merge into: lp:ubiquity
Diff against target: 286 lines (+140/-76)
8 files modified
d-i/update-control (+1/-0)
debian/changelog (+12/-0)
debian/control (+1/-1)
debian/oem-config.oem-config.service (+36/-0)
debian/rules (+2/-0)
debian/ubiquity.ubiquity.service (+10/-0)
debian/ubiquity.ubiquity.upstart (+1/-75)
scripts/start-ubiquity-dm (+77/-0)
To merge this branch: bzr merge lp:~pitti/ubiquity/systemd
Reviewer Review Type Date Requested Status
Ubuntu Installer Team Pending
Review via email: mp+246535@code.launchpad.net

Description of the change

Port to systemd. For ubiquity-dm I factorized the script as almost all of it is re-usable. For oem-config.service I replicated the necessary shell logic as most of upstart's one can be replaced with systemd directives like Condition=*.

I tested this on today's live image, with upgrading to udisks2 2.1.4-1git3 (for bug 1410851), otherwise ubiquity can't start. I used "init=/bin/systemd
break=casper-bottom" in gfxboot to inject my locally built ubiquity debs and
ensured that in ubiquity-only mode ubiquity-dm comes up properly. I did a full test install, and aside from having to work around bug 1408495 the install went fine.

I also tested oem-config by installing systemd-sysv and the local oem-config
debs, rebooted, ran oem-config-prepare, and ran through it.

I didn't test oem-config-debconf, as I currently don't know how. Ubuntu, Kubuntu etc. don't have alternates any more, server's OEM mode doesn't work (just filed bug 1411124), and Mythbuntu etc. don't have vivid images. I tried to install oem-config on a server install, but that brings in tons of desktop/graphical packages, thus I believe that oem-config isn't actually meant for text mode, and that the debconf frontend is just for preseeding?

However, I believe it's not necessary to port oem-config-debconf.upstart; oem-config.service ensures it's running after plymouth but before lightdm or other display managers, so it should start fine.

To post a comment you must log in.
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

Doesn't ubiquity job need "SuccessExitStatus=1" -> to port "normal exit 0 1" from upstart?

oem-config/ubiquity is a pain to install direct - as usually the wrong type of frontend is pulled in. To try server oem-config (which should work) could you attempt something like:
$ sudo apt-get install ubiquity-frontend-debconf oem-config-debconf oem-config

We had server oem-config bugs before and i thought we fixed them up for trusty srus or some such. Let me look at the bug you filed.

Revision history for this message
Martin Pitt (pitti) wrote :

> Doesn't ubiquity job need "SuccessExitStatus=1

I wouldn't like to do that. The cases are either when the script has a bug, or if the "something more serious has happened, e.g. debconf locked?!" case is reached; in both cases I think it's desirable to call the unit "failed" and not paper over such things.

> To try server oem-config (which should work)

Ah, thanks, that seems to pull in a reasonable set of packages. I did that plus create an "oem" user, ran sudo oem-config-prepare, and now get the debconf stuff. I'll test that with systemd.

Revision history for this message
Martin Pitt (pitti) wrote :

I tested oem-config text mode: Under upstart I do see the initial debconf screen, but the keyboard is completely dead. Perhaps because the job is running on its own private PTY? Under systemd, oem-config runs noninteractively due to a lot of "Inappropriate ioctl for device" and purges itself, but of you don't see anything because there's no PTY at all.

So the text mode debconf has to get wired in differently; presumably there are a few TTY* options missing, otherwise it won't get a terminal at all.

Revision history for this message
Martin Pitt (pitti) wrote :

I adjusted the unit now to grab and use a proper TTY, and stop the getty. This now works well, I went through all the dialogs, verified that my user got created, the locale changed, openssh installed, and oem-config got purged. Another reboot after that also worked as expected.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'd-i/update-control'
2--- d-i/update-control 2014-04-01 17:52:52 +0000
3+++ d-i/update-control 2015-01-15 11:01:05 +0000
4@@ -36,6 +36,7 @@
5 'debhelper (>= 9)',
6 'dh-autoreconf',
7 'dh-di (>= 3)',
8+ 'dh-systemd',
9 'dpkg-dev (>= 1.14.4)',
10 'gir1.2-soup-2.4',
11 'gir1.2-timezonemap-1.0',
12
13=== modified file 'debian/changelog'
14--- debian/changelog 2015-01-07 09:52:06 +0000
15+++ debian/changelog 2015-01-15 11:01:05 +0000
16@@ -1,3 +1,15 @@
17+ubiquity (2.21.4) UNRELEASED; urgency=medium
18+
19+ * Factorize ubiquity-dm startup logic out of
20+ debian/ubiquity.ubiquity.upstart into scripts/start-ubiquity-dm; don't
21+ call initctl emit when running under systemd.
22+ * Add systemd unit for ubiquity-dm.
23+ * start-ubiquity-dm: Make setterm failures non-fatal; under systemd
24+ services don't run under a PTY.
25+ * Add systemd unit for oem-config.
26+
27+ -- Martin Pitt <martin.pitt@ubuntu.com> Wed, 14 Jan 2015 13:44:28 +0100
28+
29 ubiquity (2.21.3) vivid; urgency=medium
30
31 [ Martin Wimpress ]
32
33=== modified file 'debian/control'
34--- debian/control 2014-11-12 14:34:35 +0000
35+++ debian/control 2015-01-15 11:01:05 +0000
36@@ -3,7 +3,7 @@
37 Priority: optional
38 Maintainer: Ubuntu Installer Team <ubuntu-installer@lists.ubuntu.com>
39 Uploaders: Colin Watson <cjwatson@ubuntu.com>, Evan Dandrea <ev@ubuntu.com>
40-Build-Depends: apt, autopoint, bf-utf-source, check, dctrl-tools, debconf (>= 1.5.43), debconf-utils, debhelper (>= 9), devio, dh-autoreconf, dh-di (>= 3), dpkg-dev (>= 1.15.7), gir1.2-soup-2.4, gir1.2-timezonemap-1.0, gir1.2-webkit-3.0, gir1.2-xkl-1.0, gnome-icon-theme, gobject-introspection, imagemagick, intltool (>= 0.40.0), intltool-debian (>= 0.30+20040212), iso-codes, isoquery, keymapper (>= 0.5.3-7), libbogl-dev, libcairo2-dev, libdebconfclient0-dev (>= 0.68), libdebian-installer4-dev (>= 0.76), libgirepository1.0-dev, libglib2.0-dev, libgtk-3-dev, libido3-0.1-dev, libindicator3-dev, libiw-dev (>= 27+28pre9), liblocale-gettext-perl, libparted-dev (>= 2.2), librsvg2-bin, locales, pep8, pkg-config, po-debconf (>= 1.0), pyflakes (>= 0.7.2), python-gi-dev, python-scour, python3-all (>= 3.1), python3-apt (>= 0.7.100.3~), python3-cairo, python3-dbus, python3-gi, python3-gi-cairo, python3-icu (>= 1.0), python3-mock (>= 0.7.0), python3-pam, tzdata, ubuntu-artwork, udev, wget, xkb-data (>= 0.9), xkb-data-i18n, xvfb
41+Build-Depends: apt, autopoint, bf-utf-source, check, dctrl-tools, debconf (>= 1.5.43), debconf-utils, debhelper (>= 9), devio, dh-autoreconf, dh-di (>= 3), dh-systemd, dpkg-dev (>= 1.15.7), gir1.2-soup-2.4, gir1.2-timezonemap-1.0, gir1.2-webkit-3.0, gir1.2-xkl-1.0, gnome-icon-theme, gobject-introspection, imagemagick, intltool (>= 0.40.0), intltool-debian (>= 0.30+20040212), iso-codes, isoquery, keymapper (>= 0.5.3-7), libbogl-dev, libcairo2-dev, libdebconfclient0-dev (>= 0.68), libdebian-installer4-dev (>= 0.76), libgirepository1.0-dev, libglib2.0-dev, libgtk-3-dev, libido3-0.1-dev, libindicator3-dev, libiw-dev (>= 27+28pre9), liblocale-gettext-perl, libparted-dev (>= 2.2), librsvg2-bin, locales, pep8, pkg-config, po-debconf (>= 1.0), pyflakes (>= 0.7.2), python-gi-dev, python-scour, python3-all (>= 3.1), python3-apt (>= 0.7.100.3~), python3-cairo, python3-dbus, python3-gi, python3-gi-cairo, python3-icu (>= 1.0), python3-mock (>= 0.7.0), python3-pam, tzdata, ubuntu-artwork, udev, wget, xkb-data (>= 0.9), xkb-data-i18n, xvfb
42 Standards-Version: 3.9.4
43 X-Python3-Version: >= 3.1
44 XS-Testsuite: autopkgtest
45
46=== added file 'debian/oem-config.oem-config.service'
47--- debian/oem-config.oem-config.service 1970-01-01 00:00:00 +0000
48+++ debian/oem-config.oem-config.service 2015-01-15 11:01:05 +0000
49@@ -0,0 +1,36 @@
50+[Unit]
51+Description=End-user configuration after initial OEM installation
52+Before=display-manager.service
53+After=plymouth-quit.service
54+Conflicts=getty@tty1.service
55+ConditionFileIsExecutable=/usr/sbin/oem-config-firstboot
56+ConditionPathExists=/var/lib/oem-config/run
57+ConditionPathExists=/dev/tty1
58+
59+# We never want to run the oem-config job in the live environment (as is the
60+# case in some custom configurations) or in recovery mode.
61+ConditionKernelCommandLine=!boot=casper
62+ConditionKernelCommandLine=!single
63+ConditionKernelCommandLine=!rescue
64+ConditionKernelCommandLine=!emergency
65+
66+[Service]
67+Type=oneshot
68+StandardInput=tty
69+StandardOutput=tty
70+StandardError=tty
71+TTYPath=/dev/tty1
72+TTYReset=yes
73+TTYVHangup=yes
74+ExecStart=/bin/sh -ec '\
75+ for x in $(cat /proc/cmdline); do \
76+ case $x in \
77+ debug-oem-config) debug=--debug ;; \
78+ ubiquity/frontend=*) export frontend="${x#*=}" ;; \
79+ automatic-oem-config) automatic=--automatic ;; \
80+ esac; \
81+ done; \
82+ exec oem-config-firstboot $debug $automatic'
83+
84+[Install]
85+WantedBy=multi-user.target
86
87=== modified file 'debian/rules'
88--- debian/rules 2014-04-09 21:34:01 +0000
89+++ debian/rules 2015-01-15 11:01:05 +0000
90@@ -235,6 +235,7 @@
91 dh_installdocs
92 dh_installdebconf
93 # oem-config
94+ dh_systemd_enable --name=oem-config
95 dh_installinit -n --name=oem-config
96 dh_installinit -n --name=oem-config-debconf
97 dh_installman
98@@ -278,6 +279,7 @@
99 grep-dctrl -v -FTemplate base-installer/ d-i/templates \
100 >> debian/ubiquity/DEBIAN/templates
101 # ubiquity
102+ dh_systemd_enable --name=ubiquity
103 dh_installinit --no-start --name=ubiquity
104 dh_installman
105 dh_lintian
106
107=== added file 'debian/ubiquity.ubiquity.service'
108--- debian/ubiquity.ubiquity.service 1970-01-01 00:00:00 +0000
109+++ debian/ubiquity.ubiquity.service 2015-01-15 11:01:05 +0000
110@@ -0,0 +1,10 @@
111+[Unit]
112+Description=Ubuntu live CD installer
113+Before=display-manager.service
114+
115+[Service]
116+Type=oneshot
117+ExecStart=/usr/share/ubiquity/start-ubiquity-dm
118+
119+[Install]
120+WantedBy=graphical.target
121
122=== modified file 'debian/ubiquity.ubiquity.upstart'
123--- debian/ubiquity.ubiquity.upstart 2014-10-06 14:48:06 +0000
124+++ debian/ubiquity.ubiquity.upstart 2015-01-15 11:01:05 +0000
125@@ -24,78 +24,4 @@
126
127 emits starting-dm
128
129-script
130- test -x /usr/bin/ubiquity-dm || exit 0
131-
132- ubiquity=
133- automatic=
134- debug=
135- ldtp=
136- noninteractive=
137- choose=
138- frontend=
139- for x in $(cat /proc/cmdline); do
140- case $x in
141- debug-ubiquity)
142- debug="-d"
143- ubiquity=1
144- ;;
145- automatic-ubiquity)
146- automatic="--automatic"
147- ubiquity=1
148- ;;
149- maybe-ubiquity)
150- ubiquity=1
151- choose="--greeter"
152- ;;
153- ldtp-ubiquity)
154- ubiquity=1
155- ldtp="--ldtp"
156- ;;
157- only-ubiquity)
158- ubiquity=1
159- ;;
160- noninteractive)
161- ubiquity=1
162- noninteractive=1
163- ;;
164- ubiquity/frontend=*)
165- frontend="${x#*=}"
166- ;;
167- esac
168- done
169- [ "$ubiquity" ]
170-
171- if [ -r /etc/default/locale ]; then
172- . /etc/default/locale
173- if [ -n "$LANG" ]; then
174- export LANG
175- fi
176- if [ -n "$LANGUAGE" ]; then
177- export LANGUAGE
178- fi
179- fi
180-
181- initctl emit starting-dm DM=ubiquity-dm
182-
183- # turn off console blanking for install process
184- setterm -blank 0 > /dev/console
185-
186- if [ -n "$noninteractive" ]; then
187- plymouth quit || :
188- exec ubiquity noninteractive $debug
189- else
190- if ! ubiquity-dm vt7 :0 ubuntu /usr/bin/ubiquity $debug $automatic $choose $ldtp --only $frontend; then
191- # has X crashed, or has ubiquity?
192- if [ "$automatic" ] && ! [ -f /var/log/installer/version ]; then
193- # in case we crashed before the X startup sequence
194- plymouth quit || :
195- exec ubiquity noninteractive $debug
196- else
197- # something more serious has happened, e.g. debconf locked?!
198- exit 1
199- fi
200- fi
201- fi
202- exit 0
203-end script
204+exec /usr/share/ubiquity/start-ubiquity-dm
205
206=== added file 'scripts/start-ubiquity-dm'
207--- scripts/start-ubiquity-dm 1970-01-01 00:00:00 +0000
208+++ scripts/start-ubiquity-dm 2015-01-15 11:01:05 +0000
209@@ -0,0 +1,77 @@
210+#!/bin/sh
211+# startup logic of ubiquity-dm, shared between upstart job and systemd unit
212+
213+set -e
214+test -x /usr/bin/ubiquity-dm || exit 0
215+
216+ubiquity=
217+automatic=
218+debug=
219+ldtp=
220+noninteractive=
221+choose=
222+frontend=
223+for x in $(cat /proc/cmdline); do
224+ case $x in
225+ debug-ubiquity)
226+ debug="-d"
227+ ubiquity=1
228+ ;;
229+ automatic-ubiquity)
230+ automatic="--automatic"
231+ ubiquity=1
232+ ;;
233+ maybe-ubiquity)
234+ ubiquity=1
235+ choose="--greeter"
236+ ;;
237+ ldtp-ubiquity)
238+ ubiquity=1
239+ ldtp="--ldtp"
240+ ;;
241+ only-ubiquity)
242+ ubiquity=1
243+ ;;
244+ noninteractive)
245+ ubiquity=1
246+ noninteractive=1
247+ ;;
248+ ubiquity/frontend=*)
249+ frontend="${x#*=}"
250+ ;;
251+ esac
252+done
253+[ "$ubiquity" ] || exit 0
254+
255+if [ -r /etc/default/locale ]; then
256+ . /etc/default/locale
257+ if [ -n "$LANG" ]; then
258+ export LANG
259+ fi
260+ if [ -n "$LANGUAGE" ]; then
261+ export LANGUAGE
262+ fi
263+fi
264+
265+[ -e /run/systemd/system ] || initctl emit starting-dm DM=ubiquity-dm
266+
267+# turn off console blanking for install process
268+setterm -blank 0 > /dev/console || true
269+
270+if [ -n "$noninteractive" ]; then
271+ plymouth quit || :
272+ exec ubiquity noninteractive $debug
273+else
274+ if ! ubiquity-dm vt7 :0 ubuntu /usr/bin/ubiquity $debug $automatic $choose $ldtp --only $frontend; then
275+ # has X crashed, or has ubiquity?
276+ if [ "$automatic" ] && ! [ -f /var/log/installer/version ]; then
277+ # in case we crashed before the X startup sequence
278+ plymouth quit || :
279+ exec ubiquity noninteractive $debug
280+ else
281+ # something more serious has happened, e.g. debconf locked?!
282+ exit 1
283+ fi
284+ fi
285+fi
286+exit 0

Subscribers

People subscribed via source and target branches

to status/vote changes: