Bug#1134180: dpkg: Prevent removing of misconfigured packages from removing critical system folders

[email protected] Fri, 17 Apr 2026 12:30:52 +0000
Newsgroups gmane.linux.debian.devel.dpkg.bugs
Message-ID <b6008f515372a67e2658293760da0ff605669cd2__34252.3390006804$1776429690$gmane$org@murena.io>
Package: dpkg
X-Debbugs-Cc: [email protected]
Version: 1.23.7
Severity: wishlist

Dear Maintainers,

I was trying to remove a 3rd party package with apt and it deleted the /o=
pt
folder as well. I have identified that it's due to this package incorrect=
ly
identified /opt as part of its file tree, so dpkg removed /opt as well, s=
eeing
it has no other folders/files in it. Indeed this remove operation didn't =
cause
any data loss, however this also prevents any further 3rd party packages =
from
being installed to /opt as well.

Now, of course the main responsibility lies on sloppy packaging practice
of the 3rd party package. But to make sure such packages won't cause prob=
lem
for the OS users, would it make sense for add safeguards that make
dpkg ignore such remove requests when removing these folders
might cause system usability problems? (Like /usr/lib/modules and /usr/sb=
in )

Note that though the following information said I have dpkg 1.22.22 insta=
lled,=20
conflicting=20the information in header, I have manually verified on dpkg=
 1.23.7.

-- System Information:
Debian Release: 13.4
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 's=
table')
Architecture: amd64 (x86_64)

Kernel: Linux 6.12.74+deb13+1-amd64 (SMP w/8 CPU threads; PREEMPT)
Locale: LANG=3DC.UTF-8, LC_CTYPE=3DC.UTF-8 (charmap=3DUTF-8), LANGUAGE no=
t set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages dpkg depends on:
ii  libbz2-1.0   1.0.8-6
ii  libc6        2.41-12+deb13u2
ii  liblzma5     5.8.1-1
ii  libmd0       1.1.0-2+b1
ii  libselinux1  3.8.1-1
ii  libzstd1     1.5.7+dfsg-1
ii  tar          1.35+dfsg-3.1
ii  zlib1g       1:1.3.dfsg+really1.3.1-1+b1

dpkg recommends no packages.

Versions of packages dpkg suggests:
ii  apt            3.0.3
pn  debsig-verify  <none>

-- no debconf information