[Bug 2107657] Re: upgrades to plucky incorrectly remove foreign packages from disabled sources
Nick Rosbrook
2107657 at bugs.launchpad.net
Fri Apr 25 14:52:09 UTC 2025
I verified this fix using ubuntu-release-upgrader 1:25.04.15 from
plucky-proposed:
root at o:~# cat > /etc/apt/sources.list.d/code.sources << EOF
Types: deb
URIs: https://packages.microsoft.com/repos/code
Suites: stable
Components: main
Signed-By: .
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.7 (GNU/Linux)
.
mQENBFYxWIwBCADAKoZhZlJxGNGWzqV+1OG1xiQeoowKhssGAKvd+buXCGISZJwT
LXZqIcIiLP7pqdcZWtE9bSc7yBY2MalDp9Liu0KekywQ6VVX1T72NPf5Ev6x6DLV
7aVWsCzUAF+eb7DC9fPuFLEdxmOEYoPjzrQ7cCnSV4JQxAqhU4T6OjbvRazGl3ag
OeizPXmRljMtUUttHQZnRhtlzkmwIrUivbfFPD+fEoHJ1+uIdfOzZX8/oKHKLe2j
H632kvsNzJFlROVvGLYAk2WRcLu+RjjggixhwiB+Mu/A8Tf4V6b+YppS44q8EvVr
M+QvY7LNSOffSO6Slsy9oisGTdfE39nC7pVRABEBAAG0N01pY3Jvc29mdCAoUmVs
ZWFzZSBzaWduaW5nKSA8Z3Bnc2VjdXJpdHlAbWljcm9zb2Z0LmNvbT6JATUEEwEC
AB8FAlYxWIwCGwMGCwkIBwMCBBUCCAMDFgIBAh4BAheAAAoJEOs+lK2+EinPGpsH
/32vKy29Hg51H9dfFJMx0/a/F+5vKeCeVqimvyTM04C+XENNuSbYZ3eRPHGHFLqe
MNGxsfb7C7ZxEeW7J/vSzRgHxm7ZvESisUYRFq2sgkJ+HFERNrqfci45bdhmrUsy
7SWw9ybxdFOkuQoyKD3tBmiGfONQMlBaOMWdAsic965rvJsd5zYaZZFI1UwTkFXV
KJt3bp3Ngn1vEYXwijGTa+FXz6GLHueJwF0I7ug34DgUkAFvAs8Hacr2DRYxL5RJ
XdNgj4Jd2/g6T9InmWT0hASljur+dJnzNiNCkbn9KbX7J/qK1IbR8y560yRmFsU+
NdCFTW7wY0Fb1fWJ+/KTsC4=
=J6gs
-----END PGP PUBLIC KEY BLOCK-----
EOF
root at o:~# apt update && apt upgrade -y
Hit:1 http://security.ubuntu.com/ubuntu oracular-security InRelease
Hit:2 http://archive.ubuntu.com/ubuntu oracular InRelease
Get:3 https://packages.microsoft.com/repos/code stable InRelease [3590 B]
Hit:4 http://archive.ubuntu.com/ubuntu oracular-updates InRelease
Get:5 https://packages.microsoft.com/repos/code stable/main amd64 Packages [19.3 kB]
Hit:6 http://archive.ubuntu.com/ubuntu oracular-backports InRelease
Fetched 22.9 kB in 0s (52.3 kB/s)
53 packages can be upgraded. Run 'apt list --upgradable' to see them.
Upgrading:
apport gnupg-l10n gpgconf libdw1t64 libplymouth5 openssh-sftp-server plymouth python3-problem-report sosreport vim-runtime
apport-core-dump-handler gnupg-utils gpgsm libelf1t64 libxslt1.1 pci.ids plymouth-theme-ubuntu-text python3-software-properties tzdata vim-tiny
cloud-init gpg gpgv libexpat1 linux-base perl python3-apport rsyslog ubuntu-release-upgrader-core xxd
dirmngr gpg-agent keyboxd liblzma5 openssh-client perl-base python3-distupgrade snapd vim xz-utils
gnupg gpg-wks-client libarchive13t64 libperl5.38t64 openssh-server perl-modules-5.38 python3-jinja2 software-properties-common vim-common
Not upgrading yet due to phasing:
libnetplan1 netplan-generator netplan.io python3-netplan
Summary:
Upgrading: 49, Installing: 0, Removing: 0, Not Upgrading: 4
32 standard LTS security updates
Download size: 60.5 MB
Space needed: 708 kB / 33.0 GB available
[...SNIP...]
root at o:~# apt install code -y
Installing:
code
Installing dependencies:
adwaita-icon-theme libasound2-data libdrm-intel1 libgl1-amber-dri libhttp-date-perl libnet-dbus-perl liburi-perl libxcb-shm0 libxt6t64
alsa-topology-conf libasound2t64 libdrm-nouveau2 libgl1-mesa-dri libhttp-message-perl libnet-http-perl libvulkan1 libxcb-sync1 libxtst6
alsa-ucm-conf libatk-bridge2.0-0t64 libdrm-radeon1 libglapi-mesa libhttp-negotiate-perl libnet-smtp-ssl-perl libwayland-client0 libxcb-xfixes0 libxv1
at-spi2-common libatk1.0-0t64 libegl-mesa0 libgles2 libice6 libnet-ssleay-perl libwayland-cursor0 libxcomposite1 libxxf86dga1
at-spi2-core libatspi2.0-0t64 libegl1 libglvnd0 libio-html-perl libpango-1.0-0 libwayland-egl1 libxcursor1 libxxf86vm1
cpp libauthen-sasl-perl libencode-locale-perl libglx-mesa0 libio-socket-ssl-perl libpangocairo-1.0-0 libwayland-server0 libxdamage1 luit
cpp-14 libavahi-client3 libepoxy0 libglx0 libio-stringy-perl libpangoft2-1.0-0 libwebp7 libxfixes3 mesa-libgallium
cpp-14-x86-64-linux-gnu libavahi-common-data libfile-basedir-perl libgraphite2-3 libipc-system-simple-perl libpciaccess0 libwww-perl libxft2 mesa-vulkan-drivers
cpp-x86-64-linux-gnu libavahi-common3 libfile-desktopentry-perl libgtk-3-0t64 libisl23 libpixman-1-0 libwww-robotrules-perl libxi6 perl-openssl-defaults
dconf-gsettings-backend libcairo-gobject2 libfile-listing-perl libgtk-3-bin libjbig0 librsvg2-2 libx11-protocol-perl libxinerama1 ubuntu-mono
dconf-service libcairo2 libfile-mimeinfo-perl libgtk-3-common libjpeg-turbo8 librsvg2-common libx11-xcb1 libxkbfile1 x11-common
fontconfig libclone-perl libfont-afm-perl libharfbuzz0b libjpeg8 libsharpyuv0 libxaw7 libxml-parser-perl x11-utils
fontconfig-config libcolord2 libfontconfig1 libhtml-form-perl liblcms2-2 libsm6 libxcb-dri2-0 libxml-twig-perl x11-xserver-utils
fonts-dejavu-core libcups2t64 libfreetype6 libhtml-format-perl liblerc4 libthai-data libxcb-dri3-0 libxml-xpathengine-perl xdg-utils
fonts-dejavu-mono libdata-dump-perl libgbm1 libhtml-parser-perl libllvm19 libthai0 libxcb-glx0 libxmu6 zutty
gsettings-desktop-schemas libdatrie1 libgdk-pixbuf-2.0-0 libhtml-tagset-perl liblwp-mediatypes-perl libtie-ixhash-perl libxcb-present0 libxpm4
gtk-update-icon-cache libdconf1 libgdk-pixbuf2.0-bin libhtml-tree-perl liblwp-protocol-https-perl libtiff6 libxcb-randr0 libxrandr2
hicolor-icon-theme libdeflate0 libgdk-pixbuf2.0-common libhttp-cookies-perl libmailtools-perl libtimedate-perl libxcb-render0 libxrender1
humanity-icon-theme libdrm-amdgpu1 libgl1 libhttp-daemon-perl libmpc3 libtry-tiny-perl libxcb-shape0 libxshmfence1
Suggested packages:
cpp-doc alsa-utils libgssapi-perl gvfs libcrypt-ssleay-perl libbusiness-isbn-perl libunicode-map8-perl debhelper cairo-5c
gcc-14-locales libasound2-plugins colord libio-compress-brotli-perl librsvg2-bin libregexp-ipv6-perl libunicode-string-perl mesa-utils xorg-docs-core
cpp-14-doc libdigest-hmac-perl cups-common liblcms2-utils libsub-name-perl libauthen-ntlm-perl xml-twig-tools nickle
Summary:
Upgrading: 0, Installing: 168, Removing: 0, Not Upgrading: 4
Download size: 195 MB
Space needed: 825 MB / 33.0 GB available
[...SNIP...]
Note that https://changelogs.ubuntu.com/meta-release-proposed currently has plucky marked Supported: 1, so we can actually use the --proposed flag to test.
root at o:~# do-release-upgrade --proposed
Checking for a new Ubuntu release
= Welcome to Ubuntu 25.04 'Plucky Puffin' =
The Ubuntu team is proud to announce Ubuntu 25.04 'Plucky Puffin'.
To see what's new in this release, visit:
https://wiki.ubuntu.com/PluckyPuffin/ReleaseNotes
Ubuntu is a Linux distribution for your desktop or server, with a fast
and easy install, regular releases, a tight selection of excellent
applications installed by default, and almost any other software you
can imagine available through the network.
We hope you enjoy Ubuntu.
== Feedback and Helping ==
If you would like to help shape Ubuntu, take a look at the list of
ways you can participate at
https://ubuntu.com/community/contribute
Your comments, bug reports, patches and suggestions will help ensure
that our next release is the best release of Ubuntu ever. If you feel
that you have found a bug please read:
https://help.ubuntu.com/community/ReportingBugs
Then report bugs using apport in Ubuntu. For example:
ubuntu-bug linux
will open a bug report in Launchpad regarding the linux package.
If you have a question, or if you think you may have found a bug but aren't
sure, first try to reach out on one of the communication channels. Matrix is the
go-to for instant chatting, while Discourse would be more approriate for long
discussions in a more asynchronous way. Otherwise you can still join the #ubuntu
IRC channel on Libera.Chat, send an email to the Ubuntu Users mailing list, or
find some help on the Ubuntu forums:
https://ubuntu.com/community/communications/matrix
https://discourse.ubuntu.com/
https://help.ubuntu.com/community/InternetRelayChat
https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
https://ubuntuforums.org/
== More Information ==
You can find out more about Ubuntu on our website, IRC channel and wiki.
If you're new to Ubuntu, please visit:
https://ubuntu.com/
To sign up for future Ubuntu announcements, please subscribe to Ubuntu's
very low volume announcement list at:
https://lists.ubuntu.com/mailman/listinfo/ubuntu-announce
Continue [yN] y
[...SNIP...]
Searching for obsolete software
Reading state information... Done
Remove obsolete packages?
27 packages are going to be removed.
Continue [yN] Details [d]d
Remove (was auto installed) humanity-icon-theme libapt-pkg6.0t64
libassuan0 libdrm-nouveau2 libdrm-radeon1 libdw1t64 libfwupd2
libgl1-amber-dri libglapi-amber libgusb2 libicu74
libmodule-scandeps-perl libnl-genl-3-200 libnsl2 libperl5.38t64
libpython3.12-minimal libpython3.12-stdlib libpython3.12t64
libsgutils2-1.46-2 libxcb-dri2-0 perl-modules-5.38 python3-colorama
python3.12 python3.12-gdbm python3.12-minimal sosreport ubuntu-mono
Continue [yN] Details [d]
After noting that code was not going to be removed, I continued the
upgrade. At the end, I checked the following:
root at o:~# grep "Foreign.*" /var/log/dist-upgrade/main.log
2025-04-25 14:14:49,246 DEBUG Foreign (before rewriting sources): code
2025-04-25 14:14:49,246 DEBUG Foreign (after rewriting sources):
root at o:~# apt policy code
code:
Installed: 1.99.3-1744761595
Candidate: 1.99.3-1744761595
Version table:
*** 1.99.3-1744761595 100
100 /var/lib/dpkg/status
** Tags removed: verification-needed verification-needed-plucky
** Tags added: verification-done verification-done-plucky
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to ubuntu-release-upgrader in
Ubuntu.
https://bugs.launchpad.net/bugs/2107657
Title:
upgrades to plucky incorrectly remove foreign packages from disabled
sources
Status in ubuntu-release-upgrader package in Ubuntu:
Triaged
Status in ubuntu-release-upgrader source package in Plucky:
Fix Committed
Bug description:
[Impact]
Users may have third-party packages unnecessarily removed during their
upgrade to plucky, because ubuntu-release-upgrader does not exclude
such packages from the removal candidates, as it did previously.
[Test Plan]
Basically, install a package from a third-party PPA, and do the
upgrade. Confirm that the package is considered foreign at the
beginning of the upgrade, but that it is not later removed.
1. Configure a PPA and install a package from it. Using a popular
example that motivated this bug report:
$ cat > /etc/apt/sources.list.d/code.sources << EOF
Types: deb
URIs: https://packages.microsoft.com/repos/code
Suites: stable
Components: main
Signed-By: .
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.7 (GNU/Linux)
.
mQENBFYxWIwBCADAKoZhZlJxGNGWzqV+1OG1xiQeoowKhssGAKvd+buXCGISZJwT
LXZqIcIiLP7pqdcZWtE9bSc7yBY2MalDp9Liu0KekywQ6VVX1T72NPf5Ev6x6DLV
7aVWsCzUAF+eb7DC9fPuFLEdxmOEYoPjzrQ7cCnSV4JQxAqhU4T6OjbvRazGl3ag
OeizPXmRljMtUUttHQZnRhtlzkmwIrUivbfFPD+fEoHJ1+uIdfOzZX8/oKHKLe2j
H632kvsNzJFlROVvGLYAk2WRcLu+RjjggixhwiB+Mu/A8Tf4V6b+YppS44q8EvVr
M+QvY7LNSOffSO6Slsy9oisGTdfE39nC7pVRABEBAAG0N01pY3Jvc29mdCAoUmVs
ZWFzZSBzaWduaW5nKSA8Z3Bnc2VjdXJpdHlAbWljcm9zb2Z0LmNvbT6JATUEEwEC
AB8FAlYxWIwCGwMGCwkIBwMCBBUCCAMDFgIBAh4BAheAAAoJEOs+lK2+EinPGpsH
/32vKy29Hg51H9dfFJMx0/a/F+5vKeCeVqimvyTM04C+XENNuSbYZ3eRPHGHFLqe
MNGxsfb7C7ZxEeW7J/vSzRgHxm7ZvESisUYRFq2sgkJ+HFERNrqfci45bdhmrUsy
7SWw9ybxdFOkuQoyKD3tBmiGfONQMlBaOMWdAsic965rvJsd5zYaZZFI1UwTkFXV
KJt3bp3Ngn1vEYXwijGTa+FXz6GLHueJwF0I7ug34DgUkAFvAs8Hacr2DRYxL5RJ
XdNgj4Jd2/g6T9InmWT0hASljur+dJnzNiNCkbn9KbX7J/qK1IbR8y560yRmFsU+
NdCFTW7wY0Fb1fWJ+/KTsC4=
=J6gs
-----END PGP PUBLIC KEY BLOCK-----
EOF
$ apt update
$ apt install code -y
2. Run the upgrade. Note that due to the fact that plucky is now
released, but upgrades are disabled, we cannot use the --proposed flag
to test upgrades conveniently. Instead, we need to manually download
the tarball from https://changelogs.ubuntu.com/meta-release-proposed,
unpack it, and run the script.
$ wget http://archive.ubuntu.com/ubuntu/dists/plucky-proposed/main/dist-upgrader-all/current/plucky.tar.gz
$ tar xf plucky.tar.gz
$ sudo -E ./plucky --frontend DistUpgradeViewText
3. When the upgrade gets to the 'Remove obsolete packages?' stage,
enter 'd' for details, and verify that 'code' is not suggested for
removal.
4. Check the upgrade log to ensure that 'code' was considered foreign
at the beginning of the upgrade:
$ grep "Foreign.*rewrite" /var/log/dist/upgrade/main.log
[Where problems could occur]
This patch fixes the list of foreign packages used to exclude from
removal during the obsolete removal step. At this point, the package
removals are only for clean up, and should not have any impact on the
upgrade. Any theoretical issue would be seen in the package removal
step.
[Original Description]
This is a bug introduced by commit ba84c16586 ("DistUpgrade: warn
about foreign packages after rewriting sources"). This commit is
intended to be non-functional with respect to package removals etc.,
but inadvertently changed the list of packages which should be
excluded from consideration for removal.
The packages which are considered "foreign" will be different before
and after rewriting the new sources. Later, packages which were deemed
"foreign" at the beginning of the upgrade will be excluded from
removal.
The above patch tracks foreign packages before and after rewriting
sources for the purposes of supplying the warning, but later uses the
post-rewrite list when considering exclusions, whereas it should use
the pre-rewrite list.
This could be reproduced with any PPA, but to illustrate with a
popular example (public key from
https://packages.microsoft.com/keys/microsoft.asc):
$ cat > /etc/apt/sources.list.d/code.sources << EOF
Types: deb
URIs: https://packages.microsoft.com/repos/code
Suites: stable
Components: main
Signed-By: .
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.7 (GNU/Linux)
.
mQENBFYxWIwBCADAKoZhZlJxGNGWzqV+1OG1xiQeoowKhssGAKvd+buXCGISZJwT
LXZqIcIiLP7pqdcZWtE9bSc7yBY2MalDp9Liu0KekywQ6VVX1T72NPf5Ev6x6DLV
7aVWsCzUAF+eb7DC9fPuFLEdxmOEYoPjzrQ7cCnSV4JQxAqhU4T6OjbvRazGl3ag
OeizPXmRljMtUUttHQZnRhtlzkmwIrUivbfFPD+fEoHJ1+uIdfOzZX8/oKHKLe2j
H632kvsNzJFlROVvGLYAk2WRcLu+RjjggixhwiB+Mu/A8Tf4V6b+YppS44q8EvVr
M+QvY7LNSOffSO6Slsy9oisGTdfE39nC7pVRABEBAAG0N01pY3Jvc29mdCAoUmVs
ZWFzZSBzaWduaW5nKSA8Z3Bnc2VjdXJpdHlAbWljcm9zb2Z0LmNvbT6JATUEEwEC
AB8FAlYxWIwCGwMGCwkIBwMCBBUCCAMDFgIBAh4BAheAAAoJEOs+lK2+EinPGpsH
/32vKy29Hg51H9dfFJMx0/a/F+5vKeCeVqimvyTM04C+XENNuSbYZ3eRPHGHFLqe
MNGxsfb7C7ZxEeW7J/vSzRgHxm7ZvESisUYRFq2sgkJ+HFERNrqfci45bdhmrUsy
7SWw9ybxdFOkuQoyKD3tBmiGfONQMlBaOMWdAsic965rvJsd5zYaZZFI1UwTkFXV
KJt3bp3Ngn1vEYXwijGTa+FXz6GLHueJwF0I7ug34DgUkAFvAs8Hacr2DRYxL5RJ
XdNgj4Jd2/g6T9InmWT0hASljur+dJnzNiNCkbn9KbX7J/qK1IbR8y560yRmFsU+
NdCFTW7wY0Fb1fWJ+/KTsC4=
=J6gs
-----END PGP PUBLIC KEY BLOCK-----
EOF
$ apt update
$ apt install code -y
$ do-release-upgrade --devel
[...]
Eventually, looking at the logs, we can see the different in the pre-
vs post-rewrite foreign packages:
$ grep "Foreign.*rewriting" /var/log/dist-upgrade/main.log
2025-04-18 15:38:36,057 DEBUG Foreign (before rewriting sources): code
2025-04-18 15:38:36,057 DEBUG Foreign (after rewriting sources):
Then, later, code will be shown as a remove candidate when the user is
prompted about removals:
[...]
Remove obsolete packages?
28 packages are going to be removed.
Continue [yN] Details [d]d
Remove: code <------- Should not be here
Remove (was auto installed) humanity-icon-theme libapt-pkg6.0t64
libassuan0 libdrm-nouveau2 libdrm-radeon1 libdw1t64 libfwupd2
libgl1-amber-dri libglapi-amber libgusb2 libicu74
libmodule-scandeps-perl libnl-genl-3-200 libnsl2 libperl5.38t64
libpython3.12-minimal libpython3.12-stdlib libpython3.12t64
libsgutils2-1.46-2 libxcb-dri2-0 perl-modules-5.38 python3-colorama
python3.12 python3.12-gdbm python3.12-minimal sosreport ubuntu-mono
Continue [yN] Details [d]
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/+bug/2107657/+subscriptions
More information about the foundations-bugs
mailing list