5

I have a system on which an unknown number of packages have been removed after installation. I'd like to understand what has been changed on the system limited to the changes that are controlled by APT. I know in some cases packages marked auto have been changed to be manual. I don't care if individual files have been modified, I just want to know which packages have been installed / uninstalled / marked manual / marked auto.

To that end, I'd like to get a list of packages which would be installed and marked manual in apt by default from a single distribution image (.iso).

I understand that user choices at install time may affect this list. Ideally what I'm looking for is a core set.

If this isn't possible, then it would be helpful to explain why it's impossible in an answer.

After reading duplicate flags:

I've tried reading here. How to find manually installed packages?

However none of the answers actually answer the question of determining which packages have been manually installed / uninstalled.


How do I list the default installed packages? refers to a .manifest file which doesn't seem to exist in later releases. At-least I can't find it by click-through. In effect the answer seems to have become obsolete.

Final answer

Buried in one of the comments is a reference to http://releases.ubuntu.com If you navigate to your desired version you will find .manifest files. I believe this is the closest I will get to finding an answer. Thanks @karel for your comment.

5 Answers5

3

Maybe there's another way to do it, but the way I do it is to visit the official Ubuntu Releases webpage, click the link for an Ubuntu release, click the first red URL in the list that says (Ubuntu Desktop and Server) after the link, and open the file that has the .manifest extension (example: ubuntu-16.04.3-desktop-amd64.manifest). I usually download and save the .manifest file to my hard drive, instead of opening it in a new tab in my web browser. The .manifest file can be opened locally in any text editor.

Some of the packages listed in the .manifest file are normally used only for installing Ubuntu, and these files are purged during the Ubuntu installation process. Also the GParted partition editor is removed during the Ubuntu installation process, but it can be reinstalled in Ubuntu with sudo apt install gparted.

karel
  • 122,292
  • 133
  • 301
  • 332
2

Understanding which packages are marked 'Manual' is actually pretty simple: ALL packages on the install .iso are marked as manually installed.

This is a workaround to an old problem with the apt design: It was too easy for users to unwittingly uninstall their entire system instead of the minor change they intended to make. The root cause was that ONLY the -desktop metapackage was marked "manual", so the moment you removed the metapackage so you could change music players or run your custom file manager, huge chunks of the installed system became eligible for auto-removal.

You still see this problem today when users of the Minimal Image mistakenly remove their entire Desktop Environment.

Finding the list of packages in the .iso is also pretty easy, though it's not in the most useful format: The list of files, including packages, is at http://cdimage.ubuntu.com.

For example, if you want the list of files (including packages) in 17.10, you want these four files.

Now, your question is a little unusual since you want information; most folks would simply want apt to fix the problem. Beware that the solution you have fastened upon (full list of packages in the .iso) seems a bit of an XY Problem, so let's also talk about easy ways to fix the apparent underlying problem (many packages changed), too:

The easy way to fix the problem is usually to merely install (or --reinstall) the ubuntu-desktop metapackage. That's one reason the metapackages are there. So another way to get the list of changes to be reverted (instead of the full iso packages list) to --simulate an apt --reinstall of ubuntu-desktop.

user535733
  • 68,493
2

The command

$ gzip -cd /var/log/installer/initial-status.gz | grep "^Package:" > initialpackages.txt

will produce a list of all packages which have been installed during installation of the OS in a file named initialpackages.txt in the current working directory.

The result may be incorrect after performing a release upgrade.

mook765
  • 18,644
0

I think you want to use /var/log/apt/history.log and its friends to give the changes that have been made:

zcat /var/log/apt/history.log.*.gz | cat - /var/log/apt/history.log | grep -Po '^Commandline: apt(?:-get)? install (?!.*--reinstall)\K.*'

(Modified from source)

Will give you all the packages that have been installed at the command line using a variation of apt-get install.

It gets the zipped files in the old history.logs adds them with the current history.log and passes through grep, extracting lines with apt[-get] install [and/or reinstall] and showing the rest of the line (-o flag) which amounts to the package name(s).

This'll need a little modding (eg with sed) if you want just the package names on separate lines; an exercise for the reader!

It's worth noting that the synaptic package manager (gksu synaptic or kdesudo synaptic) in the "status" section has a "installed(manually)" list. If you mark the whole list for removal [don't apply it!!] you should be able to save the marked changes and get a list of packages that way. Caution: this locked up synaptic for me (calculating the dependency removals presumably).

pbhj
  • 3,364
0

One option could be to see in the release page of your distro (e.g. https://cdimage.ubuntu.com/ubuntu/releases/24.04.1/release/) a manifest file (e.g. https://cdimage.ubuntu.com/ubuntu/releases/24.04.1/release/ubuntu-24.04.1-live-server-arm64+largemem.manifest)