Bug#1110696: libglib2.0-0t64: Purging libglib2.0-0:i386 removed gschemas.compiled
Simon McVittie
smcv at debian.org
Tue Aug 12 00:06:28 BST 2025
Control: tags -1 + pending
Control: severity -1 important
On Sun, 10 Aug 2025 at 15:14:47 +0800, Tianyu Chen wrote:
>Steps to reproduce:
>
>1. Install a Debian bookworm
>2. sudo dpkg --add-architecture i386
>3. sudo apt update && sudo apt upgrade && sudo apt install libglib2.0-0:i386
>4. sudo apt remove --allow-remove-essential libglib2.0-0:i386 ... (Remove all :i386 packages)
>5. sudo dpkg --remove-architecture i386
>6. Ensure dpkg --print-foreign-architectures has no output
>7. sudo sed -i 's/bookworm/trixie/g' /etc/apt/sources.list
>8. sudo apt update && sudo apt upgrade --without-new-pkgs && \
> sudo apt dist-upgrade && sudo apt autoremove
>9. (Reboot if needed)
>10. sudo apt purge libglib2.0-0:i386
>11. (Boom)
This is actually not quite enough! To reproduce the bug, you have to
purge libglib2.0-0:amd64 *before* libglib2.0-0:i386, so that the
refcount transition for libglib2.0-0 goes from 1 to 0 while purging
libglib2.0-0:i386. If you had purged those two packages the other way
round, it would have been OK.
Reproducer for the bug, which hacks the postrm of libglib2.0-0 to add a
`set -x` so that it's obvious what it is doing:
$ podman run --rm -it debian:bookworm-slim # or use an expendable chroot
# dpkg --add-architecture i386
# apt update
# apt install --no-install-recommends \
libglib2.0-0:i386 libglib2.0-0:amd64 \
gsettings-desktop-schemas \
dconf-gsettings-backend dconf-gsettings-backend:i386 \
dbus-x11 dbus-user-session-
# apt remove --allow-remove-essential $(dpkg-query -W -f '${binary:Package}\n' | grep :i386)
# dpkg --remove-architecture i386
# sed -i -e 's/^set -e$/&x/' /var/lib/dpkg/info/libglib2.0-0\:*.postrm
# sed -i -e 's/bookworm/trixie/g' /etc/apt/sources.list.d/debian.sources
# apt update
# apt dist-upgrade
…
Preparing to unpack .../libglib2.0-0t64_2.84.3-1_amd64.deb ...
libglib2.0-0t64.preinst: Removing /var/lib/dpkg/info/libglib2.0-0:amd64.postrm to avoid loss of /usr/share/glib-2.0/sc
hemas/gschemas.compiled...
removed '/var/lib/dpkg/info/libglib2.0-0:amd64.postrm'
…
# test -e /usr/share/glib-2.0/schemas/gschemas.compiled && echo ok
ok
# dpkg --purge libglib2.0-0:amd64
(Reading database ... 6472 files and directories currently installed.)
# dpkg --purge libglib2.0-0:i386
(Reading database ... 6472 files and directories currently installed.)
Purging configuration files for libglib2.0-0:i386 (2.74.6-2+deb12u6) ...
+ [ -d /usr/lib/i386-linux-gnu/gio/modules ]
+ [ purge = purge ]
+ [ -d /usr/share/glib-2.0/schemas ]
+ [ 1 = 1 ]
+ rm -f /usr/share/glib-2.0/schemas/gschemas.compiled
+ rmdir -p --ignore-fail-on-non-empty /usr/share/glib-2.0/schemas
# test -e /usr/share/glib-2.0/schemas/gschemas.compiled && echo still ok
(no output!)
Here, gsettings-desktop-schemas is a convenient example of a package that
contains a GSettings schema (which GLib summarizes into
an architecture-independent gschemas.compiled via a dpkg trigger).
Similarly dconf-gsettings-backend is a convenient example of a package
that contains GIO modules (which GLib summarizes into a module list per
architecture). dbus-x11 and dbus-user-session- just avoid wasting time
installing and upgrading systemd in a container with no init system.
With an updated libglib2.0-0t64.preinst that disarms libglib2.0-0.postrm
on a more complete set of architectures, the bug no longer appears.
On Sun, 10 Aug 2025 at 10:50:40 +0100, Simon McVittie wrote:
>dpkg team: is there a good way to ask dpkg for a full list of
>architectures that might conceivably have a package installed?
>
>I suppose there's
>
> dpkg-query -W -f '${Architecture}\n' | sort -u | grep -v '^all$'
>
>but, ugh.
Of course the command I wasn't thinking of at the time is:
$(dpkg-query -W -f '${Architecture}\n' libglib2.0-0
which lists the architectures of any versions of libglib2.0-0 that might
still be present and in particular might still have a postrm, including
removed-but-not-purged status.
smcv
More information about the pkg-gnome-maintainers
mailing list