Merge lp:~dgadomski/ubiquity/lp1749289 into lp:ubiquity

Proposed by Dariusz Gadomski
Status: Work in progress
Proposed branch: lp:~dgadomski/ubiquity/lp1749289
Merge into: lp:ubiquity
Diff against target: 43 lines (+5/-3)
2 files modified
bin/oem-config-firstboot (+0/-1)
bin/ubiquity (+5/-2)
To merge this branch: bzr merge lp:~dgadomski/ubiquity/lp1749289
Reviewer Review Type Date Requested Status
Dimitri John Ledkov Approve
Colin Watson (community) Abstain
Review via email: mp+341450@code.launchpad.net

Description of the change

Fixes a systemd freeze after cancelling debconf UI.

When using systemd and performing a oem installation using a debconf_ui
frontend there is a scenario requiring a reboot to continue (more details
at LP: #1749289).

There were several causes for this:
* bin/oem-config-firstboot - 'set -e' had to be removed, because otherwise
    the script was terminated and no exit code check was done so
    code 10 return from oem-config-wrapper was not handled in the if block.
* bin/ubiquity cancelling the installation returned a code 10,
    which then lead to performing a wizard.do_reboot(). This method
    was not implemented for the debconf frontend. This caused an exception
    and exiting the process with code 1.
    Moreover, stealing the terminal control with the termios.TIOCSCTTY
    made doing input/output in oem-config-firstboot impossible, so even
    after falling into if [ $CODE -eq 10 ] block nothing was presented
    to the user.

After fixing the above issues user is presented with 3 options: to try again,
launch a shell or reboot (as originally intended in the code).

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) wrote :

I don't know if you manually selected me as a reviewer or if I was selected automatically. If the latter, please let me know and I'll see if I can fix that. If the former, please don't do that; I very rarely work on ubiquity any more and I won't be doing reviews of anything non-trivial.

I'll request a review from the ubuntu-installer team instead.

review: Abstain
Revision history for this message
Dariusz Gadomski (dgadomski) wrote :

> I'll request a review from the ubuntu-installer team instead.

Thank you for taking a look Colin.

I've picked you manually since bzr pointed you as the author of the bin/oem-config-firstboot changes that were mutually exclusive (set -e vs handling the exit code of oem-config-wrapper) so I figured that you are the best person to verify what was the expected behavior there. Sadly there were no tests for that part of the code to dispel my doubts.

Revision history for this message
Dariusz Gadomski (dgadomski) wrote :

> I'll request a review from the ubuntu-installer team instead.

Thank you for taking a look Colin.

I've picked you manually since bzr pointed you as the author of the bin/oem-config-firstboot changes that were mutually exclusive (set -e vs handling the exit code of oem-config-wrapper) so I figured that you are the best person to verify what was the expected behavior there. Sadly there were no tests for that part of the code to dispel my doubts.

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

The development of ubiquity has moved to git, still hosted on launchpad. If this merge proposal is still relevant, please resubmit it against the git branches found at https://code.launchpad.net/ubiquity

Sorry for any inconvenience caused.

review: Needs Resubmitting
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

This looks good. Can rebase this onto git trees.

review: Approve

Unmerged revisions

6596. By Dariusz Gadomski

Fixes a systemd freeze after cancelling debconf UI.

When using systemd and performing a oem installation using a debconf_ui
frontend there is a scenario requiring a reboot to continue (more details
at LP: #1749289).

There were several causes for this:
* bin/oem-config-firstboot - 'set -e' had to be removed, because otherwise
    the script was terminated and no exit code check was done so
    code 10 return from oem-config-wrapper was not handled in the if block.
* bin/ubiquity cancelling the installation returned a code 10,
    which then lead to performing a wizard.do_reboot(). This method
    was not implemented for the debconf frontend. This caused an exception
    and exiting the process with code 1.
    Moreover, stealing the terminal control with the termios.TIOCSCTTY
    made doing input/output in oem-config-firstboot impossible, so even
    after falling into if [ $CODE -eq 10 ] block nothing was presented
    to the user.

After fixing the above issues user is presented with 3 options: to try again,
launch a shell or reboot (as originally intended in the code).

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/oem-config-firstboot'
2--- bin/oem-config-firstboot 2016-03-29 02:53:09 +0000
3+++ bin/oem-config-firstboot 2018-03-15 11:03:49 +0000
4@@ -1,6 +1,5 @@
5 #! /bin/bash
6 # Run oem-config on the first boot after shipping to the end user.
7-set -e
8
9 DEBUG=
10 AUTOMATIC=
11
12=== modified file 'bin/ubiquity'
13--- bin/ubiquity 2017-07-18 15:21:41 +0000
14+++ bin/ubiquity 2018-03-15 11:03:49 +0000
15@@ -122,8 +122,6 @@
16 if tty >= 3:
17 os.close(tty)
18
19- fcntl.ioctl(0, termios.TIOCSCTTY, 1)
20-
21 if 'UBIQUITY_BTERM' not in os.environ:
22 os.environ['UBIQUITY_BTERM'] = '1'
23
24@@ -268,7 +266,9 @@
25 unmount_target()
26 distro = distribution().lower()
27 wizard = ui.Wizard(distro)
28+ exit_on_failure = False
29 if os.environ['UBIQUITY_FRONTEND'] == 'debconf_ui':
30+ exit_on_failure = True
31 open_terminal()
32 start_debconf()
33 ret = wizard.run()
34@@ -281,6 +281,9 @@
35 traceback.print_exc()
36 copy_debconf()
37 unmount_target()
38+
39+ if ret != 0 and exit_on_failure:
40+ sys.exit(ret)
41 if ret == 10:
42 wizard.do_reboot()
43 if ret == 11:

Subscribers

People subscribed via source and target branches

to status/vote changes: