qemu-system-gui 1:5.1+dfsg-4ubuntu2 fails to upgrade

Bug #1906245 reported by Matthieu Baerts on 2020-11-30
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
qemu (Ubuntu)
Critical
Unassigned

Bug Description

Hello,

Thank you for maintaining these QEmu packages!

On Ubuntu Hirsute, I am unable to upgrade this package:

$ sudo apt-get dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  qemu-system-gui
1 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
142 not fully installed or removed.
Need to get 0 B/51.5 kB of archives.
After this operation, 8,192 B disk space will be freed.
Do you want to continue? [Y/n]
(Reading database ... 345606 files and directories currently installed.)
Preparing to unpack .../qemu-system-gui_1%3a5.1+dfsg-4ubuntu2_amd64.deb ...
cp: -r not specified; omitting directory '/var/run/qemu/Debian'
dpkg: warning: old qemu-system-gui:amd64 package pre-removal script subprocess returned error exit status 1
dpkg: trying script from the new package instead ...
dpkg: error processing archive /var/cache/apt/archives/qemu-system-gui_1%3a5.1+dfsg-4ubuntu2_amd64.deb (--unpack):
 there is no script in the new version of the package - giving up
Errors were encountered while processing:
 /var/cache/apt/archives/qemu-system-gui_1%3a5.1+dfsg-4ubuntu2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

It looks like the "Debian" dir is created during the upgrade and causes the issue above.

Related branches

Hi Matthieu,
thanks for the report, but this bug is known and fixed under bug 1905377 in the version you report this against.
It is the "old" maintainer script that still has an issue (and we can't fix that old script).

You can work around the issue by doing:
  rm -rf /var/run/qemu/Debian

Matthieu Baerts (matttbe) wrote :

Hi Christian,

Thank you for the prompt answer. I thought it was different from bug 1905377 because the last version was supposed to fix the same issue.

Note that I already tried the work around you provided but it doesn't help:

  $ sudo rm -r /var/run/qemu/Debian; sudo apt-get dist-upgrade -y >/dev/null; echo "Result: $?"
  E: Sub-process /usr/bin/dpkg returned an error code (1)
  Result: 100

Same if I remove "/var/run/qemu"

  $ sudo rm -r /var/run/qemu/; sudo apt-get dist-upgrade -y >/dev/null; echo "Result: $?"
  E: Sub-process /usr/bin/dpkg returned an error code (1)
  Result: 100

Is it just because I have 1:5.1+dfsg-4ubuntu1? (just to know if we need to find a proper solution or if I can just force stuff?)

Interesting - taking the dup away until we found what is different for you then.

Could you report me a "ls -laF /var/run/qemu/" what else might be the issue there?
I mean you even removed it so ... ?!

The failing script should be
 /var/lib/dpkg/info/qemu-system-gui\:amd64.prerm
Could you replace the "set -e" with "set -ex" there please and report back all the output your upgrade generates?

And finally to keep output down a bit, don't do "sudo apt-get dist-upgrade -y" but maybe "sudo apt install qemu-system-gui -y"

Eager to hear back to see what other issue is hidden in there.

P.S. And thanks for testing the current -dev release even if this time this bite you (and probably everyone else).

Changed in qemu (Ubuntu):
status: New → Incomplete
Matthieu Baerts (matttbe) wrote :

> Could you report me a "ls -laF /var/run/qemu/" what else might be the issue there?

Sure:

% ls -laF /var/run/qemu/
total 0
drwxr-xr-x 3 root root 60 Nov 30 11:43 ./
drwxr-xr-x 42 root root 1120 Nov 30 11:43 ../
drwxr-xr-x 2 root root 40 Nov 30 11:43 Debian/

> I mean you even removed it so ... ?!

Yes, it is created with the upgrade. I had to reboot for other reasons and this directory was not even there before I tried the upgrade.

> Could you replace the "set -e" with "set -ex" there please and report back all the output your upgrade generates?

% sudo apt install qemu-system-gui -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be upgraded:
  qemu-system-gui
1 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
142 not fully installed or removed.
Need to get 0 B/51.5 kB of archives.
After this operation, 8,192 B disk space will be freed.
(Reading database ... 345606 files and directories currently installed.)
Preparing to unpack .../qemu-system-gui_1%3a5.1+dfsg-4ubuntu2_amd64.deb ...
+ mkdir -p /var/run/qemu/Debian 1:5.1+dfsg-4ubuntu1
+ cp /usr/lib/x86_64-linux-gnu/qemu/ui-gtk.so /var/run/qemu/Debian 1:5.1+dfsg-4u
buntu1/
cp: -r not specified; omitting directory '/var/run/qemu/Debian'
dpkg: warning: old qemu-system-gui:amd64 package pre-removal script subprocess r
eturned error exit status 1
dpkg: trying script from the new package instead ...
dpkg: error processing archive /var/cache/apt/archives/qemu-system-gui_1%3a5.1+d
fsg-4ubuntu2_amd64.deb (--unpack):
 there is no script in the new version of the package - giving up
Errors were encountered while processing:
 /var/cache/apt/archives/qemu-system-gui_1%3a5.1+dfsg-4ubuntu2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

When looking at the output and the recent modifications you did in the package, it looks like I have the issue just because I have 1:5.1+dfsg-4ubuntu1 version installed and I can safely force the upgrade, right?

> P.S. And thanks for testing the current -dev release even if this time this bite you (and probably everyone else).

My pleasure! I cannot help more with the packaging, etc. in Ubuntu like I did before but I try to report bugs with the -dev release I use for years now :)

Thanks for the data Matthieu!

Hmm, that is indeed the "old & broken" style that should be (and is for qemu-block-extra) fixed in 5.1+dfsg-4ubuntu2.

...

Packaging:
- d/qemu-system-gui.*.in is gone in the packaging as intended.

Binary Package:
$ apt install qemu-system-gui
$ dpkg -l qemu-system-gui
ii qemu-system-gui:amd64 1:5.1+dfsg-4ubuntu2
root@h:~# ll /var/lib/dpkg/info/qemu-system-gui*
-rw-r--r-- 1 root root 396 Nov 30 11:33 /var/lib/dpkg/info/qemu-system-gui:amd64.list
-rw-r--r-- 1 root root 463 Nov 24 10:16 /var/lib/dpkg/info/qemu-system-gui:amd64.md5sums
=> no maintainer scripts anymore (as intended)

So - as with the former issue - what is failing is the old packages prerm of 1:5.1+dfsg-4ubuntu1.

I found in a discussion (thanks Juliank) why this isn't an issue with qemu-block-extra (which is what this was first found and fixed for) and can resolve it in a coming update.

Changed in qemu (Ubuntu):
status: Incomplete → Triaged

Summary:
of [1] "upgrading" we can not prevent "1.2-3->prerm upgrade 1.2-4" to fail.
But we can make the fallback of "1.2-4-prerm failed-upgrade 1.2-3" working (which it already is for qemu-block-extra).

We essentially need a rather empty "prerm" in hirsute that can be dropped in the next release as it is only covering that issue in the initial 1:5.1+dfsg-4ubuntu1.

... working on it

[1]: https://wiki.debian.org/MaintainerScripts

Changed in qemu (Ubuntu):
status: Triaged → In Progress
Changed in qemu (Ubuntu):
importance: Undecided → Critical

Test:
# install current version - will be >=1:5.1+dfsg-4ubuntu2
$ apt install qemu-system-gui
# get old broken version and install it
$ wget https://launchpad.net/ubuntu/+source/qemu/1:5.1+dfsg-4ubuntu1/+build/20311790/+files/qemu-system-gui_5.1+dfsg-4ubuntu1_amd64.deb
$ dpkg --force-all -i qemu-system-gui_5.1+dfsg-4ubuntu1_amd64.deb
# trigger the bug
$ apt install qemu-system-gui
...
Preparing to unpack .../qemu-system-gui_1%3a5.1+dfsg-4ubuntu2_amd64.deb ...
cp: -r not specified; omitting directory '/var/run/qemu/Debian'
dpkg: warning: old qemu-system-gui:amd64 package pre-removal script subprocess returned error exit status 1
dpkg: trying script from the new package instead ...
dpkg: error processing archive /var/cache/apt/archives/qemu-system-gui_1%3a5.1+dfsg-4ubuntu2_amd64.deb (--unpack):
 there is no script in the new version of the package - giving up
Errors were encountered while processing:
 /var/cache/apt/archives/qemu-system-gui_1%3a5.1+dfsg-4ubuntu2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

A fixed version builds in [1] and will be tested before uploading the fix (no other changes than for this bug in this)

[1]: https://launchpad.net/~ci-train-ppa-service/+archive/ubuntu/4356

Matthieu Baerts (matttbe) wrote :

Hi Christian,

Thank you for the fix!

  $ wget https://launchpad.net/~ci-train-ppa-service/+archive/ubuntu/4356/+build/20348965/+files/qemu-system-gui_5.1+dfsg-4ubuntu3_amd64.deb
  $ sudo dpkg -i qemu-system-gui_5.1+dfsg-4ubuntu3_amd64.deb
(Reading database ... 345606 files and directories currently installed.)
Preparing to unpack qemu-system-gui_5.1+dfsg-4ubuntu3_amd64.deb ...
+ mkdir -p /var/run/qemu/Debian 1:5.1+dfsg-4ubuntu1
+ cp /usr/lib/x86_64-linux-gnu/qemu/ui-gtk.so /var/run/qemu/Debian 1:5.1+dfsg-4ubuntu1/
cp: -r not specified; omitting directory '/var/run/qemu/Debian'
dpkg: warning: old qemu-system-gui:amd64 package pre-removal script subprocess returned error exit status 1
dpkg: trying script from the new package instead ...
dpkg: ... it looks like that went OK
Unpacking qemu-system-gui:amd64 (1:5.1+dfsg-4ubuntu3) over (1:5.1+dfsg-4ubuntu1) ...

It's working well!

Fix works:
Preparing to unpack .../qemu-system-gui_1%3a5.1+dfsg-4ubuntu3_amd64.deb ...
cp: -r not specified; omitting directory '/var/run/qemu/Debian'
dpkg: warning: old qemu-system-gui:amd64 package pre-removal script subprocess returned error exit status 1
dpkg: trying script from the new package instead ...
dpkg: ... it looks like that went OK
Unpacking qemu-system-gui:amd64 (1:5.1+dfsg-4ubuntu3) over (1:5.1+dfsg-4ubuntu1) ...

Note:
if installing without proposed there is a block on
 qemu-system-gui : Depends: libgdk-pixbuf-2.0-0 (>= 2.22.0) but it is not installable
So to migrating this to hirsute-release this might have some dependencies.

Repackaged deb of 5.1+dfsg-4ubuntu1 to allow users unable to wait for 5.1+dfsg-4ubuntu1 to work around the issue.

For those in a hurry that just want things to work again here a few workarounds for now:

Workaround #1 - uninstall and install
$ apt remove qemu-system-gui
# the remove will complain the same way as the upgrade, but an install
# of the new version over this state "rH" works.
# You most likely had this installed through qemu-system-x86
# so remember to re-install dependency removed packages as well:
$ apt install qemu-system-x86 qemu-system-gui

Workaround #2 - use repackaged 5.1+dfsg-4ubuntu1 (If you can't remove qemu* packages for some reason)
# replace original 5.1+dfsg-4ubuntu1 with one that does not have the prerm issue
$ wget https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1906245/+attachment/5439620/+files/qemu-system-gui_5.1+dfsg-4ubuntu1_amd64.repackaged.lp1906245.deb
$ dpkg -i qemu-system-gui_5.1+dfsg-4ubuntu1_amd64.repackaged.lp1906245.deb
# upgrade to 5.1+dfsg-4ubuntu2 (now working)
$ apt install qemu-system-gui

Workaround #3 - use the PPA version
$ sudo add-apt-repository ppa:ci-train-ppa-service/4356
$ apt install qemu-system-gui
# or
$ apt install upgrade
# This will need libgdk-pixbuf-2.0-0 from proposed thou

FYI This is all good in regard to autopkgtests now, should move to released in the next Britney run.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package qemu - 1:5.1+dfsg-4ubuntu3

---------------
qemu (1:5.1+dfsg-4ubuntu3) hirsute; urgency=medium

  * d/qemu-system-gui.prerm: add no-op prerm to overcome upgrade issues on
    the bad old prerm (LP: #1906245)

 -- Christian Ehrhardt <email address hidden> Mon, 30 Nov 2020 12:53:03 +0100

Changed in qemu (Ubuntu):
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers