Compare installed packages with Fedora default?

dnf repoquery --userinstalled shows a giant list of packages, I think it might be due to to gnome-software.
Is there a convenient way to unmark everything?

Probably dnf mark remove *.
But wait, don’t you need a set of installed packages to have an OS…
Though I still want to compare my list with that of Fedora 38 default.
I’m trying to find the extra packages introduced during my F37 to F38 upgrade that won’t go away.
(Related: Who created unbound folders)

The gnome-software/PackageKit bug might have been fixed already, and thus not relevant to this question, though not sure if I found the right one.

Actually I don’t know if it’s fixed.

These are packages that won’t be autoremoved when removing packages. So in general, it is better to leave them as “userinstalled”. This status was initially inherited from the liveUSB system, and ultimately from the initial build of that system.

The live system is built by using rpm to install a bunch of packages and groups, and some additional packages will be installed as dependencies. The latter set of packages are marked as “not userinstalled”.

Running dnf history info 1 will show the build of the initial live system, and what was installed.

1 Like

Before I go and write a live USB, anyone has a dnf repoquery --userinstalled output from a fresh Fedora 38 install (never used PackageKit/GNOME-Software)?
Just found out from my newish AArch64 Workstation install that the list is really short, compared to my AMD64 install upgraded from F37 using GNOME-Software. Going to see if it’s the case on AMD64 F38 live ISO.

[liveuser@localhost-live ~]$ dnf repoquery --userinstalled

Exactly the same packages as my AArch64 install, plus the langpacks-en.
Damn… GNOME-Software did do me dirty.
A fresh Fedora 38 install, even after dnf upgrade, still shows the same as above.

p.s. Do not use dnf mark remove \*. It’s the reason for my fresh F38 reinstall, seemed to break dependencies and made dnf autoremove want to remove protected packages (sudo, grub, etc.).

To bulk remove marks from user installed:

dnf mark remove $(dnf repoquery --userinstalled --exclude=kernel,kernel-\*,langpacks\*)

Ref: Bash command substitution

p.s. The problem might not be caused by GNOME-Software. When I did dnf system-upgrade on F29 to F31, a bunch of packages were marked as user installed after the upgrade. Though the version is old, might not happen nowadays.

Why would you want to do this?

The user installed mark is there to protect packages from being inadvertently auto-removed when removing some package at a later time. If you run dnf autoremove it would basically remove almost everything not marked as user installed.

Because they were not present when compared to a fresh install and were never installed by me, but marked as user installed by some software, which is the topic of this post…

Autoremove will not really remove everything. As far as I can tell, what a distribution installs by default is defined in groups. So they have group mark instead of user mark.

$ dnf group list --installed
Last metadata expiration check: 2:21:20 ago on Tue 21 Nov 2023 14:30:20 UTC.
Installed Environment Groups:
   Fedora Workstation
Installed Groups:
   Container Management

(And each group here includes more groups until they reach packages, too much to list here.)

EDIT: Since I don’t know what causes the issue, I suppose it might be possible for group packages to end up marked user installed, though it wasn’t the case for me. But in which case, they will be removed despite belonging to a group. I haven’t found a way to restore group marks, dnf will only mark them as group when they are first removed and then installed via group.

// This would be dangerous if group packages are marked as user installed instead for some reason
dnf autoremove
dnf group install "Fedora Workstation"