3

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.

Philip Couling
  • 480
  • 1
  • 6
  • 20
  • 1
    @karel Bingo! Looks like the releases.ubuntu.com link was burred in a comment. I've proposed an edit on the linked answer to make it easy for future readers. – Philip Couling Feb 05 '18 at 17:22
  • This answer posted by mook765 works great, and it should be the accepted answer to this question. – karel Dec 13 '23 at 16:16

4 Answers4

2

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
  • 114,770
  • 1
    The manifest file may not reflect what is installed on the computer. There is a purge step which removes some software that may no longer be thought necessary. For example, files related to ubiquity which are needed for the initial install and gparted are purged as part of the clean-up. – DK Bose Feb 04 '18 at 14:12
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
  • 62,253
  • 2
    Thank you for reading and answering the question I have asked. I am well aware of the x y problem. It is the bain of my life on stack exchange type sites. I only ask questions after I have spent significant time ensuring my question is unusual. – Philip Couling Feb 04 '18 at 22:23
1

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.

mook765
  • 15,925
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,231
  • This system has lived far to long. Any such system logs have been archived / deleted and cannot be known to be complete. Thats why the only way to be certain is to compare and not trace logs. – Philip Couling Feb 04 '18 at 22:10
  • So just curiousity, not to achieve anything - what system was installed? Was your hardware identical to the current hardware? When do your logs go back to, what date was the install, have you removed packages manually? – pbhj Feb 05 '18 at 16:54
  • I genuinely don't know. I can narrow it down to a handful of likely releases but I've been using ubuntu since 2011 and couldn't say for certain the last time I did a complete fresh install on the system in question. My goal is to understand the difference between what I have now, what it was originally, and what it would be if I did a fresh install over. Notice the goal is to understand, not make changes. – Philip Couling Feb 05 '18 at 17:11
  • This particularly the sources.list info should tell you the original installation media. – pbhj Feb 05 '18 at 20:58