Recently I encountered an unpleasent system error on Fedora 24. "filesystem root has only 0 bytes of disk space" after some googling, resolved quite simply to the root partition / being out of space. The problem though was trying to find the right places to delete the right things. If you are like me and installed Fedora simply by following the GUI installer and largely accepted default settings, you end up with your HDD heavily repartitioned into various segments, including /dev, /home, /boot and / being root. Any data on your computer not stored within the other segments is fair game to be taking up space in the / root segment. I was able to find though a number of useful tools for confirming and clearing out old data stored on Fedora 24 and cleanup the / root segment.

Viewing Your Segments

You can view all segments on your system using the df command. This is useful to confirm the problem is the space on your system You'll get an output looking something like this:

As of this writing and the above screenshot, you can see I've already been able to clear out space from my / root partition under the Mounted on column. The / root partition was given 50GB on my system, and I was able to cut down the used space to 82% which was acceptable for me for the time being.

Remove Orphan Packages

On debian there is a tool called deborphan which can be installed to remove "orphaned packages" or packages that no other package depends on. In Fedora there are couple of different commands to replicate this functionality.


package-cleanup is a yum-utils package that still works on Fedora 24, even with yum no longer being used. You can cleanup orphaned packages with the following command

package-cleanup --quiet --leaves --exclude-bin | xargs dnf remove -y  

package-cleanup can sometimes be too bold, so the --exclude-bin parameter is included to avoid potentialy important packages from being removed. The results from package-cleanup are then piped into xargs and the dnf remove command as parameters. --quiet is used to minimize the output and --leaves is the command to look for packages which aren't being relied on by currently installed packages.


For rpm based systems there is an actual identical tool to deborphan named rpmorphan. This tool does similar to mentioned above. If your system though gets the "filesystem root has only 0 bytes of disk space" you will not have any space available to install this package. So you will likely have to execute the package-cleanup command above before you can install rpmorphan. rpmorphan will also look for unused libraries and can also be configured to do further and more braver sweeps of packages. To run rpmorphan, execute the following commands

sudo dnf install rpmorphan  
sudo dnf remove `rpmorphan`  

The first command will install the package, followed by executing and removing the resulting packages from rpmorphan


dnf includes a parameter called autoremove which operates similarily to apt-get autoremove in that it will remove unused depency packages. The problem I found with this command is that it can include programs you may want to keep. Running the call I found dnf wanting to remove programs such as firefox, thunderbird, and wireshark. So I would recommend you use this command with caution, if at all. To execute an autoremove, simply execute the following command

sudo dnf autoremove  

dnf will prompt you with a list of all the packages it will remove, at which point you can answer Y/N to proceed. Check the packages at this point to decide whether to proceed.

Remove Old Package Versions

From your already installed packages, Fedora has a habit of keeping the previously installed outdated versions after an upgrade. These obviously take up space. This can be done simply enough using dnf and a number of commands available through it. The following command will fetch and remove all outdated copies of packages installed on your system

sudo dnf repoquery --quiet --duplicated --latest-limit -1 | xargs -l1 dnf remove -y  

Whats happening in the above command is dnf is making a repoquery for all duplicate packages using the --duplicated flag. These results though will also include the latest version, so a filter is applied using the --latest-limit flag. By setting this to -1 we tell dnf to not include the latest version in its repoquery. This thus generates a list of duplicated packages on your system, not including the latest installed version. This is all then piped into xargs and into the dnf remove command. When I execute this command, older versions of systemd packages showed up. systemd packages are obviously important, but you don't have to worry about them as dnf will not allow you to uninstall them, and will simply skip them as it processes the list

Remove PackageKit Meta

Using the GNOME Disk Usage Analytics tool I discovered the /var/cache/PackageKit folder was taking up 16GB of space in the / root segment. Within this folder is kept cache copies of different programs on your system. These are used by GNOME and not by dnf and is only referred to if you use the GNOME GUI to install your rpm applications. Clearing this cache will give you a large amount of space back in the / root segment. On Fedora, there is an included console client that will refresh the PackageKit system. Execute the following command

sudo pkcon refresh force -c -1  

The refresh refreshes the cached information and the -c command sets the cache age for how old the data can be before it is removed. By passing -1 it sets the cache age for to none, and thus deletes the cache.

Interestingly this command doesn't always work, and after refreshing on the GNOME Disk Usage Analytics tool, still had a large amount of data being stored in the PackageKit folder. In this case, some manual work needs to be done. You can manually clear the folder with the following command

sudo rm -rf /var/cache/PackageKit/metadata/updates/packages/*  

After doing this open the PackageKit config file located at /etc/PackageKit/PackageKit.conf and uncomment the following line within the file


This will stop the PackageKit from caching anymore packages in the future and hopefully mitigate the need to repeat this cleaning process

Cherry Pick Broken and Orphaned Packages

During an upgrade, certain packages may not be easily retrievable using the above methods. Fortunatly dnf comes with a couple of tools to spot out this information. The following commands will only list these odd packages. These calls typicaly will include packages you want to keep, so to use these you will have to run them and then remove them each individualy.

sudo dnf list extras  

This command will list extra packages found on the system that the current version of dnf cannot do much with. An example is if you are upgrading from Fedora 21 to 22, the above command will list packages from Fedora 21 that are of no longer use to Fedora 22. You can identify these packages by their postfix (in our example ending with .fc21). This can be applied to any Fedora upgrade situation

sudo dnf repoquery --unsatisfied  

This command will list any packages that may have broken or has unsatisfied dependencies on your system. In most use cases, you probably will want to update or install the appropriate dependencies for the package, assuming you want to use whatever package that is unsatisfied, but if not, these packages will still be taking up room in their broken state on your system and can be removed to save space.