boot.ini postinst file breaks non-interactive upgrade

Post Reply
thomas-teknique
Posts: 20
Joined: Wed Jun 05, 2019 9:18 am
languages_spoken: english
ODROIDs: N2
Has thanked: 5 times
Been thanked: 0
Contact:

boot.ini postinst file breaks non-interactive upgrade

Unread post by thomas-teknique » Thu Jun 13, 2019 4:11 pm

On the minimal Ubuntu image, the file /var/lib/dpkg/info/bootini.postinst contains a call to the "dialog" bash utility. This makes non-interactive apt updates (e.g. with Ansible) hang forever.

How can we skip the dialog showing up without editing the postinst file to remove/comment out the call to the dialog command?

User avatar
mad_ady
Posts: 6136
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 118 times
Been thanked: 80 times
Contact:

Re: boot.ini postinst file breaks non-interactive upgrade

Unread post by mad_ady » Thu Jun 13, 2019 6:55 pm

I think you can uninstall dialog, so it won't run. But I agree, dialog should no longer be needed. Persistent boot.ini settings have been integrated long ago and that warning should not be necessary as long as the user edits boot.ini.default as well.

User avatar
meveric
Posts: 10256
Joined: Mon Feb 25, 2013 2:41 pm
languages_spoken: german, english
ODROIDs: X2, U2, U3, XU-Lite, XU3, XU3-Lite, C1, XU4, C2, C1+, XU4Q, HC1, N1, Go, H2 (N4100), N2
Has thanked: 13 times
Been thanked: 99 times
Contact:

Re: boot.ini postinst file breaks non-interactive upgrade

Unread post by meveric » Thu Jun 13, 2019 10:37 pm

mad_ady wrote:
Thu Jun 13, 2019 6:55 pm
I think you can uninstall dialog, so it won't run. But I agree, dialog should no longer be needed. Persistent boot.ini settings have been integrated long ago and that warning should not be necessary as long as the user edits boot.ini.default as well.
Which they don't since 95% of users are probably not even aware something like "persistent boot.ini" exists, hence the warning, cause people were never aware of it.
Donate to support my work on the ODROID GameStation Turbo Image for U2/U3 XU3/XU4 X2 X C1 as well as many other releases.
Check out the Games and Emulators section to find some of my work or check the files in my repository to find the software i build for ODROIDs.
If you want to add my repository to your image read my HOWTO integrate my repo into your image.

thomas-teknique
Posts: 20
Joined: Wed Jun 05, 2019 9:18 am
languages_spoken: english
ODROIDs: N2
Has thanked: 5 times
Been thanked: 0
Contact:

Re: boot.ini postinst file breaks non-interactive upgrade

Unread post by thomas-teknique » Fri Jun 14, 2019 6:46 am

mad_ady wrote:
Thu Jun 13, 2019 6:55 pm
I think you can uninstall dialog, so it won't run. But I agree, dialog should no longer be needed. Persistent boot.ini settings have been integrated long ago and that warning should not be necessary as long as the user edits boot.ini.default as well.
Uninstalling dialog will cause the whole thing to fail, so that's not an option.

Code: Select all

A new boot.ini is installed.
Any changes to boot.ini is lost, such as display configuration
Persistent custom settings from /media/boot/boot.ini.default have been restored
For reference your old boot.ini is saved to /media/boot/boot.ini.old
/var/lib/dpkg/info/bootini.postinst: 39: /var/lib/dpkg/info/bootini.postinst: dialog: not found
dpkg: error processing package bootini (--configure):
subprocess installed post-installation script returned error exit status 127
Errors were encountered while processing:
bootini
E: Sub-process /usr/bin/dpkg returned an error code (1)
meveric wrote:
Thu Jun 13, 2019 10:37 pm
Which they don't since 95% of users are probably not even aware something like "persistent boot.ini" exists, hence the warning, cause people were never aware of it.
The warning is fine, it just needs to honour the DEBIAN_FRONTEND environment variable so it doesn't show the warning when scripts are calling apt-get upgrade.

I have though of a work-around (at least in my case) but it's not ideal and still requires manual intervention afterwards:

Inside script:
  1. apt-mark hold bootini
  2. apt-get dist-upgrade
  3. apt-mark unhold bootini
Then afterwards the user should manually upgrade bootini.

User avatar
mad_ady
Posts: 6136
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 118 times
Been thanked: 80 times
Contact:

Re: boot.ini postinst file breaks non-interactive upgrade

Unread post by mad_ady » Fri Jun 14, 2019 1:17 pm

You can submit a patch for the bootini package, I'm sure Hardkernel will commit it. In the meantime facky workaround #2: replace dialog with a symlink to /bin/true.

I too am interested in ansible upgrades, so if you won't submit ghe patch I'll have to try it myself when I get time...

mdrjr
Site Admin
Posts: 11706
Joined: Fri Feb 22, 2013 11:34 pm
languages_spoken: english, portuguese
ODROIDs: -
Location: Brazil
Has thanked: 0
Been thanked: 5 times
Contact:

Re: boot.ini postinst file breaks non-interactive upgrade

Unread post by mdrjr » Fri Jun 14, 2019 1:43 pm

If you guys can point the correct way to do it.. I'll happily apply it

User avatar
mad_ady
Posts: 6136
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 118 times
Been thanked: 80 times
Contact:

Re: boot.ini postinst file breaks non-interactive upgrade

Unread post by mad_ady » Fri Jun 14, 2019 2:17 pm

If DEBIAN_FRONTEND=noninteractive it should just echo the text. If DEBIAN_FRONTEND= anything else, [strike]it should use the variable as a program name (to display the dialog in a gtk window for instance).[/strike]. If it's not set, fallback to dialog, I guess. There must be a correct way to derive the correct program based on the variable - I'll keep searching.

http://www.microhowto.info/howto/perfor ... ckage.html
https://www.debian.org/releases/sarge/s ... 02.html.en
DEBIAN_FRONTEND

This boot parameter controls the type of user interface used for the installer. The current possible parameter settings are:

DEBIAN_FRONTEND=noninteractive

DEBIAN_FRONTEND=text

DEBIAN_FRONTEND=newt

DEBIAN_FRONTEND=slang

DEBIAN_FRONTEND=ncurses

DEBIAN_FRONTEND=bogl

DEBIAN_FRONTEND=gtk

DEBIAN_FRONTEND=corba

The default front end is DEBIAN_FRONTEND=newt.DEBIAN_FRONTEND=text may be preferable for serial console installs. Generally only the newt frontend is available on default install media, so this is not very useful right now.

thomas-teknique
Posts: 20
Joined: Wed Jun 05, 2019 9:18 am
languages_spoken: english
ODROIDs: N2
Has thanked: 5 times
Been thanked: 0
Contact:

Re: boot.ini postinst file breaks non-interactive upgrade

Unread post by thomas-teknique » Fri Jun 14, 2019 3:48 pm

mad_ady wrote:
Fri Jun 14, 2019 1:17 pm
You can submit a patch for the bootini package, I'm sure Hardkernel will commit it. In the meantime facky workaround #2: replace dialog with a symlink to /bin/true.

I too am interested in ansible upgrades, so if you won't submit ghe patch I'll have to try it myself when I get time...
Haha that could work...

I would only have it skip the call to dialog if DEBIAN_FRONTEND is noninteractive, are there graphical ways to do a dist-upgrade on Ubuntu? If not then that's all that's needed

Code: Select all

--- bootini.postinst.new        2019-06-14 06:40:23.871933824 +0000
+++ bootini.postinst    2019-06-14 06:42:19.397205953 +0000
@@ -22,9 +22,11 @@
 echo "Persistent custom settings from /media/boot/boot.ini.default have been restored"                                                                                                                                                                                                                                       
 echo "For reference your old boot.ini is saved to /media/boot/boot.ini.old"
 
-dialog --msgbox "A new boot.ini is installed.
-Any changes to boot.ini is lost, such as display configuration
-Persistent custom settings from /media/boot/boot.ini.default have been restored
-For reference your old boot.ini is saved to /media/boot/boot.ini.old" 0 0
+if [ "$DEBIAN_FRONTEND" != "noninteractive" ]; then
+       dialog --msgbox "A new boot.ini is installed.
+       Any changes to boot.ini is lost, such as display configuration
+       Persistent custom settings from /media/boot/boot.ini.default have been restored
+       For reference your old boot.ini is saved to /media/boot/boot.ini.old" 0 0
+fi

Andrew Sayers
Posts: 31
Joined: Fri May 17, 2019 5:06 pm
languages_spoken: english
ODROIDs: N2
Has thanked: 6 times
Been thanked: 3 times
Contact:

Re: boot.ini postinst file breaks non-interactive upgrade

Unread post by Andrew Sayers » Sun Jun 16, 2019 6:56 am

I think the proper solution is to rewrite the postinst script to use debconf. debconf-devel seems to want you to move the text to a template file, then pass the template filename to debconf from the postinst script?

thomas-teknique
Posts: 20
Joined: Wed Jun 05, 2019 9:18 am
languages_spoken: english
ODROIDs: N2
Has thanked: 5 times
Been thanked: 0
Contact:

Re: boot.ini postinst file breaks non-interactive upgrade

Unread post by thomas-teknique » Mon Jun 17, 2019 5:00 pm

Andrew Sayers wrote:
Sun Jun 16, 2019 6:56 am
I think the proper solution is to rewrite the postinst script to use debconf.
This seems a bit overkill for a script that just displays a message?

Andrew Sayers
Posts: 31
Joined: Fri May 17, 2019 5:06 pm
languages_spoken: english
ODROIDs: N2
Has thanked: 6 times
Been thanked: 3 times
Contact:

Re: boot.ini postinst file breaks non-interactive upgrade

Unread post by Andrew Sayers » Tue Jun 18, 2019 12:47 am

thomas-teknique wrote:
Mon Jun 17, 2019 5:00 pm
Andrew Sayers wrote:
Sun Jun 16, 2019 6:56 am
I think the proper solution is to rewrite the postinst script to use debconf.
This seems a bit overkill for a script that just displays a message?
The thing about package management is, there's always another edge case. For example, some people will use unattended upgrades and want this message e-mailed to them (e-mail address in a hard-to-parse config file). And since Korean seems to be a supported language for the N2, they might want the message translated too.

Debian packaging definitely doesn't have the learning curve it ought to, but sadly this is one of those "there's no kill like overkill" situations. It's been many years since I played with this stuff, but I seem to remember finding it easier to get started by copying existing packages. I've had a quick look at the packages on my laptop and steam looks like a good one to copy. It's a fairly simple package with a note that pops up (albeit in preinst). You can download and inspect the package like this:

Code: Select all

wget http://cdn-fastly.deb.debian.org/debian/pool/non-free/s/steam/steam_1.0.0.59-4_i386.deb
mkdir steam-deb
dpkg-deb -R steam_1.0.0.59-4_i386.deb steam-deb/
find steam-deb
If I'm reading that package correctly, our template would look something like this:

Code: Select all

Template: bootini/recreated
Type: note
Description: A new boot.ini is installed
 Any changes to boot.ini is lost, such as display configuration
 Persistent custom settings from /media/boot/boot.ini.default have been restored
 For reference your old boot.ini is saved to /media/boot/boot.ini.old
... and the postinst script would look something like:

Code: Select all

...

. /usr/share/debconf/confmodule

...

db_input high bootini/recreated || true

(I haven't tested any of this though)

Post Reply

Return to “Ubuntu”

Who is online

Users browsing this forum: No registered users and 0 guests