Comment 56 for bug 1768610

Revision history for this message
Iain Lane (laney) wrote :

> Well, I just wanted to make sure this happened as early as possible, since this is not related to what the package installs, I thought it was better to handle this in preinst, so that this can be also just removed at later times.

The thing about the preinst is that it runs super early, you can't even rely on the package's dependencies being installed. In this case we don't use any non-Essential tools, so it's OK, but often this is a problem. We don't *need* to use the preinst, since either the pkg is removed or not removed before we even start installing x11-common - at postinst time it's going to still be removed or it's going to get upgraded to the fixed version.

There's a bug in x11-common. If the preinst check triggers twice (like on a xenial dist-upgrade and then again when you upgrade to bionic), the upgrade fails:

Preparing to unpack .../x11-common_1%3a7.7+19ubuntu7.1_all.deb ...
Moving obsolete conffile /etc/X11/Xsession.d/50_check_unity_support to /etc/X11/Xsession.d/50_check_unity_support.x11-back...
mv: cannot stat '/etc/X11/Xsession.d/50_check_unity_support': No such file or directory
dpkg: error processing archive /var/cache/apt/archives/x11-common_1%3a7.7+19ubuntu7.1_all.deb (--unpack):
 new x11-common package pre-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 /var/cache/apt/archives/x11-common_1%3a7.7+19ubuntu7.1_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Fixed that by adding a [ -f ] check, and then I made the same fixes as on the MP, expanded the changelog a bit, and uploaded to the silo (3299) for all releases. Please check my diffs - particularly the versions.

Could you add some testcases for this please? Like

 - remove nux-tools from bionic-release (pre-sru), upgrade, reinstall nux-tools (no prompt)
 - remove nux-tools from bionic-proposed/updates (sru), upgrade, reinstall nux-tools (no prompt)
 - modify config file, remove nux-tools, upgrade, reinstall nux-tools (should prompt)
 - install nux-tools, upgrade, no prompt

You end up with either no /etc/X11/Xsession.d/50_check_unity_support, its new contents or you are asked what to do if you've changed it before. Never the old content.