`apt-mark showmanual` shows almost all packages. messed up?
apt-mark showmanual lists a lot of packages for me:
root@hcompneu:~# apt-mark showmanual | wc -l 4013 root@hcompneu:~# apt-mark showmanual | head a11y-profile-manager-indicator abiword abiword-common abiword-plugin-grammar account-plugin-facebook account-plugin-flickr account-plugin-google account-plugin-identica account-plugin-twitter accountsservice root@hcompneu:~# apt-mark showmanual | tail yelp-xsl zeitgeist zeitgeist-core zeitgeist-datahub zenity zenity-common zip zlib1g zlib1g-dev zlib1g:i386
As I understand, it should only list those packages which I manually installed. I don’t remember in each case anymore but I’m pretty sure I did not install all of those manually. Actually, I rarely installed any software on this system, despite Chrome, OpenOffice and some other very basic things. So I would expect a list of maybe 10-100 packages but not more. Maybe it also includes ubuntu-desktop, grub and linux or so from the base Ubuntu installation.
Maybe in the past though I wrote some scripts to fix up a broken system by automatically calling
apt-get install XXX on various packages. Or maybe I did other things. I don’t really remember anymore.
Could that be the case here? So I somehow messed it up? If that is the case, what would you suggest? Mark all to automatically installed, and then by hand add some selected packages like ubuntu-desktop?
Or is such output correct and I understand it wrongly? I read this and I’m not sure. It looks like it is much more complicated to get the list of manually installed packages? Or why is the answer so complicated?
apt-mark showmanual buggy?
root@hcompneu:~# ls -ld /var/log/installer/ drwxr-xr-x 2 root root 4096 Dez 27 11:27 /var/log/installer/ root@hcompneu:~# grep -r cdrom /etc/apt/ --include=*.list root@hcompneu:~# dpkg -l | grep ^ii | wc -l 3812
TL;DR No, your system is not messed up. Moreover, you can leave all things as they are, so in the current state.
Let’s consider three systems:
|Current System||Installation media||Age||
|Ubuntu 18.04.6 LTS with MATE desktop(*)||Ubuntu 12.04.4 LTS||7 y.o.||5680||3953|
|Ubuntu 18.04.6 LTS with MATE desktop(*)||Ubuntu 10.04 LTS||11 y.o.||6395||3947|
|Yours Ubuntu 18.04 LTS (**)||~Ubuntu 8.04 LTS||~13 y.o.||3812||4013|
- (*) my systems were originally installed from Ubuntu desktop installation disks, thus shipped with GNOME and/or Unity (not a flavour). Then I have installed MATE desktop using official PPAs for 12.04 LTS, 14.04 LTS and their meta-packages; then when 16.04 LTS were released I have re-installed MATE desktop as task package using commands like
sudo apt-get install ubuntu-mate-desktop^. This installation of task package causes all such packages to be marked as manually installed and thus protects them from removal. All other software were installed manually during life-span of the both systems.
- (**) the strange thing about your system is that you have total number of installed packages 3812 less than manually installed packages 4013. You have to investigate this using Synaptic.
I tried to conduct some research with fresh installations of old and new systems. Below is the table about clean installations of ordinary Ubuntu desktop ISOs.
||Synaptic: Status → Installed (manual)|
|22.04 LTS (dev)||1700||44||44||31|
We can understand here that functionality of Ubiquity installer and APT by itself have changes over time.
From the above table we can see that old systems have huge numbers of manually installed packages from their day 0 of installation.
Newer Ubuntu versions have smaller numbers, this ease their maintenance. They probably have more meta-packages installed which prevent package removal because of dependencies.
Another experiment I have done: I upgraded fresh Ubuntu installation from 8.04 LTS to 10.04 LTS → 12.04 LTS → 14.04 LTS → 18.04 LTS → 20.04 LTS and in the resulting 20.04.3 LTS system I have 1867 manually installed packages of 2913 total packages.
The "manual" installation status of package prevents its removal, so you should not set package as auto-installed.
Good resources to read:
man apt-marklocally or online, the below quote is essential:
apt-mark– show, set and unset various settings for a package
showmanualcan be used in the same way as
showautoexcept that it will print a list of manually installed packages instead.
The system is not "messed up", but basically your understanding of what manually installed means is incorrect. A package is never actually marked manual or not-manual. It can only ever be marked auto or not-auto.
A package is marked auto when it is installed automatically to satisfy a dependency. This means that it can (and implies that it should) be removed automatically when no other package depends on it any longer.
On a normal desktop system the majority of packages are installed when the OS is first installed by the installer. These packages have to be installed not-auto, or else they would be removed because nothing depends on them.
Take for example ‘abiword’ near the top of your list. This is a word processor that is probably quite normal to have installed on a desktop system. I assume that you used one of many flavours of desktop installers. It probably didn’t ask you specifically if you wanted abiword. You probably didn’t install abiword yourself by name. You still chose to have it by choosing the install medium that you used.
Since there is no other package on your system that depends on you having abiword installed in order to work, it cannot be marked auto or else it would be removed. This means it is not marked auto.
apt-mark showmanual lists the packages that are not marked auto.
Note also that many installers install everything non-auto even if they could mark them auto because something depends on them. Even the important core packages that hundreds of things depend on get marked non-auto. In this sense, maybe the installer is "messsed up", but it is nothing special about your system.
My best attempt at getting a list of things I might have installed myself is:
aptitude search -F '%p' --disable-columns '~i !~M !~E !~prequired !~pimportant !~pstandard !~tminimal !~tstandard'
To exclude packages that are depended on, use:
aptitude search -F '%p' --disable-columns '~i !~M !~R~i !~E !~prequired !~pimportant !~pstandard !~tminimal !~tstandard'
The output of the showmaual option includes any package that ever got updates, so not really what you want. The below command I copied from some other answer (don’t recall where or I’d attribute it), and compares the output against the initial install list, producing the packages you installed yourself. Put it into a file in your bin area for convenience.
comm -23 <(apt-mark showmanual | sort -u) <(gzip -dc /var/log/installer/initial-status.gz | sed -n 's/^Package: //p' | sort -u)
The first time I ran apt-mark showmanual, I knew the list was too big because things like "tar" were included, which I knew I had never manually touched. "tar" however had had an update applied, which caused it to be output. Since "tar" was included in the initial system packages, it gets removed by the script, just leaving things that "showed up" after the initial system installation.
According to the man-page of
apt-mark all dependencies of meta-packages are marked as
manual. So you can run:
to mark all of these packages as auto. After that,
shows less packages.