I installed a plain Ubuntu 10.10 on my computer and installed some software via apt-get. Last week I managed to break everything and just started from scratch, and I need to reinstall my software. Is there some way to create a list with all the packages that I have installed manually?
So that it would give me a list like texlive, ...
and not texlive, texlive-dep1, textlive-dep2, ...
and all the standard packages removed?
If I could somehow figure out which programs out of the regular install I have removed, that would be awesome too!
Update 2015-05-23: I now use Ansible as configuration management on my systems. There I specify the packages to install. This serves the goal, installing all the programs on a fresh system, even better. So this question might be the entry into some light configuration management.
With this suggestion, I'm assuming your old installation will still boot!
To replicate one set of packages on another machine:
On System A, run:
Move the
my-selections
file over to System B.On System B, run:
and then:
Important note: if you have installed packages from non-standard repositories and/or PPAs, you will also want to copy
/etc/apt/sources.list
and the contents of/etc/apt/sources.list.d/
from System A to System B before you run the upgrade.You can use
dpkg
to see what you've removed as well (NB: this will also include packages that you manually installed and removed):You can see your results in the terminal, or, of course, redirect to a file.
This thread from superuser.com gives this solution:
If your apt logs are in /var/log/apt, something like this should work:
Or if you want to get rid of some of the repetitive junk in the output:
You could use apt-mark, but I recommend debfoster:
This will inspect all installed packages and figure out which ones are keeping the others installed:
As you answer "y" to each question (just push Enter to move quickly), debfoster will collect the package list and write them line-by-line to a file. By default this is at
/var/lib/debfoster/keepers
. It looks like this:I configure debfoster via
/etc/debfoster.conf
to put this list at/etc/debfoster-keepers
and track the file with etckeeper to keep history and backups. The answer here shows how to install a list of packages from a newline-delimited text file:Note a limitation here, packages you purged have a '-' in front of them. So you want to remove those lines before calling apt-mark.
Even though the debfoster's website says that debfoster is deprecated in favor of aptitude, I prefer debfoster's prompt and simple configuration. It puts you in the middle of your package database and lets you clean things up, making the auto and manual packages more obvious.
Type "h" at the debfoster prompt to explain your options. Type "?" to see the package description. The how-to here might be useful.
Gives all manually installed packages (not system packages, not dependencies). For examples it shows
build-essential
but notgcc
.For those who prefer using apt-* tools, there's an apt-mark utility that allows both querying and modifying manual/auto state.
You can also specify pattern for packages you interested in:
I finally got it now:
I'm able to pull everything by opening the log files in /var/log/apt/
I then go in and manually filter out the apt-get install packages. There may be a way to do this programatically but I'm not aware of it.
this way you see the list of commands performed in the past.
Remove the grep code if you need more information:
if the log is compressed (i.e. end with gz)
to zip it again when finished you can do:
I didn't see any solutions here work for me, I have installed quite a few deb packages with dpkg and a few of the items I was particularly looking for were missing.
A rather lengthy one liner, but convenient to copy and paste would be:
The above command saves a list of packages to a file in your current working directory named
my-packages
.Explanation
I first built a list of packages that composed the baseline of packages selected during installation.
Followed by a long list of items installed in general.
I then compared the two files
initial
andinstalled
to list only the items unique to installed.From there I wanted to filter out the dependencies, this is where this method may miss some desired packages, it is unaware of dependencies that are also explicitly installed.
I wrote a quick bash function to shorten this steps in processing these items.
After that I passed each line from my file
custom
into this function withxargs
.Once I had the long list of every possible dependency, (not sure on the every possible statement), I once again got the lines that were unique to a single file.
And my finished list of packages is now in a file named
manual
available for me to review.