24

I have a Fedora 28 system (EDIT: upgraded from Fedora 27, rather than installed fresh). I can run dnf list --installed to list the 2165 packages installed on my system. I can run dnf leaves (using the leaves plugin) to list all 368 packages which were installed in their own right, rather than as dependencies of something else.

The list of leaves includes both things like sudo-1.8.22-0.2.b1.fc28.x86_64, which is a pretty essential part of the system, and things like steam-1.0.0.54-17.fc28.i686, which is not, and is there because i installed it myself.

Does Fedora / RPM / dnf have the idea of "packages which are part of the base system" as opposed to "packages which a user asked for"? If so, is there any way to list all the latter packages? If not, is there some other way to produce that list, even approximately?

My ultimate goal is to clean up my system by removing old packages i installed but no longer need. The problem is that i have no idea what i've installed.

3
  • The generated kickstart file will contain the initial package configuration (although it may not spell out each individual package). Commented May 20, 2018 at 21:53
  • @IgnacioVazquez-Abrams Do you mean /root/anaconda-ks.cfg? If so, that doesn't seem to say anything about packages - here it is. Also, the timestamp on the file is from when i first installed Fedora 27, rather than when i upgraded to Fedora 28 (which i didn't mention, sorry!). Commented May 21, 2018 at 21:22
  • I have an Ansible playbook which (re)builds my own personal workstation. Commented May 22, 2018 at 0:47

5 Answers 5

27

dnf distinguishes [1] between

  1. manually installed packages
  2. packages that are only installed as a dependency of a manually installed package
  3. packages that were installed as part of a group

To get a list of "packages which a user asked for" you can list category (1) from above with sudo dnf repoquery --userinstalled.

[1] https://dnf.readthedocs.io/en/latest/command_ref.html#mark-command-label

7

dnf history userinstalled looks promising. It lists only 142 packages, some of which i recognise, but some of which are kernels and common system packages.

However, if i look at the intersection of the 'userinstalled' packages and the leaves:

comm -12 <(dnf leaves | sort) <(sudo dnf history userinstalled | sort) 

There are ~50 packages, most of which look at least somewhat familiar:

  • trying to get hardware to work right: acpi broadcom-wl dkms kmod-wl lshw vulkan
  • programming: gcc-gdb-plugin java-1.8.0-openjdk java-1.8.0-openjdk-devel libomp
  • favourite tools: apg ffmpeg lastpass-cli mercurial mosh youtube-dl zsh
  • PDF malarkey: ghostscript-tools-fonts ghostscript-tools-printing texlive-epstopdf-bin
  • desktop utilities: clementine feh steam transmission-cli vlc
  • Android stuff: android-tools jmtpfs libmtp-examples simple-mtpfs
  • RPMFusion: rpmfusion-free-release rpmfusion-nonfree-release
  • solving this problem: dnf-utils python3-dnf-plugin-leaves

And then a bunch of stuff i can't really account for: compat-ffmpeg28 dracut-live fedora-obsolete-packages langpacks-en libnsl2 memtest86+ openssl-pkcs11 python2-beautifulsoup4 python3-beautifulsoup4 python3-dnf-plugin-system-upgrade python2-pypam python3-cssselect python3-html5lib webkit2gtk3-plugin-process-gtk2

I can't be sure that this is everything i've installed myself, but it's a substantial fraction of it, at least.

3
  • I had to use comm -12 <(dnf leaves | sort | sed 's/^- //g') <(dnf history userinstalled | sort) | less Commented Jan 18, 2023 at 16:18
  • I'm on Fedora 39 but don't have dnf leaves where is the command coming from? Commented Nov 14, 2023 at 10:57
  • @white_gecko Must be this plugin, i don't remember installing it, but must have done so at some point: dnf-plugins-core.readthedocs.io/en/latest/leaves.html Commented Nov 14, 2023 at 12:44
3

You could try

dnf history 

which should give you more or less all package installing/removing/update actions you did via dnf. I don't really know how far this history gets back (in time).

Another place to get information about package modifications is to look into /var/log/yum.log. But the log is being rotated per default which will only give you a small time window to reconstruct the modifications.

2
  • You're on to something here! For me, dnf history goes all the way back to when i first installed the machine. Commented May 21, 2018 at 21:48
  • Great, when did you install first? Commented May 21, 2018 at 21:50
1

Fedora 41:

dnf repoquery --installed

1
dnf repoquery --leaves --userinstalled 
1
  • 3
    Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center. Commented Sep 9 at 12:14

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.