Cannot update Fedora via dnf

I’m trying to upgrade fedora from fedora 35 to 37. My root partition does not have a lot of free space, but my /home partitiion has 30GB free. So, I need to use my \home partition instead of my root partition when doing “dnf system-upgrade …”. I tried symlinking the directions:

/var/cache/dnf
/var/lib/dnf/system-upgrade

to directoriies in my /home partition. I also tried using the --downloaddir options and tried adding “cachedir” in /etc/dnf/dnf.conf. But it still tells me that it cannot update because there isn’t enough space in the root directory. How can I tell dnf not to use the root partition, but install use my /home partition?

Can you give us a better idea of just how much space is used and needed (e.g., the output from lsblk)?

The cachedir option is a decent approach. Are there (non-RPM) things that you can temporarily move to your /home partition (e.g., maybe you have some large directories under /opt or /srv)?

Beyond that, maybe uninstall a few things.

Also, you might have better luck upgrading just one release version at a time.

Welcome to the forums Gregory,

I think you will need to shrink your /home and expand your /root
You can find different ways to do that by searching here on the forums or other places.

You might want to consider reinstalling Fedora if you want to be up to date as you will have to go 35>37>39>41 three upgrades to get to the current version, with 42 coming out very soon.

1 Like

thx for the reply!

NAME            MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0             7:0    0   104M  1 loop /var/lib/snapd/snap/core/16928
loop1             7:1    0 373.8M  1 loop /var/lib/snapd/snap/anbox/186
loop2             7:2    0    64M  1 loop /var/lib/snapd/snap/core20/2379
loop3             7:3    0 104.2M  1 loop /var/lib/snapd/snap/core/17200
loop4             7:4    0  63.7M  1 loop /var/lib/snapd/snap/core20/2434
loop5             7:5    0  44.4M  1 loop /var/lib/snapd/snap/snapd/23545
loop6             7:6    0  44.4M  1 loop /var/lib/snapd/snap/snapd/23771
loop7             7:7    0 310.8M  1 loop 
sda               8:0    1  29.1G  0 disk 
├─sda1            8:1    1   1.8G  0 part 
├─sda2            8:2    1   9.7M  0 part 
└─sda3            8:3    1  20.5M  0 part 
zram0           252:0    0     8G  0 disk [SWAP]
nvme0n1         259:0    0 476.9G  0 disk 
├─nvme0n1p1     259:1    0   200M  0 part /boot/efi
├─nvme0n1p2     259:2    0   500M  0 part /boot
└─nvme0n1p3     259:3    0 476.3G  0 part 
  ├─fedora-root 253:0    0    50G  0 lvm  /
  ├─fedora-swap 253:1    0   7.8G  0 lvm  [SWAP]
  └─fedora-home 253:2    0 418.4G  0 lvm  /home

and df -h

Filesystem               Size  Used Avail Use% Mounted on
devtmpfs                 4.0M     0  4.0M   0% /dev
tmpfs                    7.7G  1.3G  6.4G  17% /dev/shm
tmpfs                    3.1G  2.2M  3.1G   1% /run
/dev/mapper/fedora-root   49G   44G  2.6G  95% /
tmpfs                    7.7G  285M  7.4G   4% /tmp
/dev/loop0               104M  104M     0 100% /var/lib/snapd/snap/core/16928
/dev/loop3               105M  105M     0 100% /var/lib/snapd/snap/core/17200
/dev/loop2                64M   64M     0 100% /var/lib/snapd/snap/core20/2379
/dev/loop1               374M  374M     0 100% /var/lib/snapd/snap/anbox/186
/dev/loop5                45M   45M     0 100% /var/lib/snapd/snap/snapd/23545
/dev/loop4                64M   64M     0 100% /var/lib/snapd/snap/core20/2434
/dev/loop6                45M   45M     0 100% /var/lib/snapd/snap/snapd/23771
/dev/nvme0n1p2           474M  268M  178M  61% /boot
/dev/mapper/fedora-home  411G  322G   69G  83% /home
/dev/nvme0n1p1           200M   42M  158M  21% /boot/efi
tmpfs                    1.6G  148K  1.6G   1% /run/user/1000

Is there a way I could upgrade via usb (not reinstall)?

LVM is supposed to make resizing a little easier than it would be with normal partitions. You might have a decent chance of being able to move some of the space that is available under /home to / without too much hassle. However, all your volumes are a bit close to their limits percentage wise. I’d start looking for things to delete or else attach some more storage before trying to update.


Edit: It looks like snap is known for eating a lot of space. You might want to follow this guide first and see if you can free some space by purging old/unused “revisions” that snap keeps by default: How to Clean Up Snap Versions to Free Up Disk Space

And another quick question. To be clear, there’s no way to get dnf to use the /home partition instead of the root partition?

I haven’t done it, but just going by the documentation, that cachedir setting in /etc/dnf/dnf.conf should work (make a subdirectory first, e.g., sudo mkdir /home/dnf). However, that is just for the initial download of the files. You will still need space on the final destination filesystem for the installed packages and, because it installs packages before removing them, you will need about twice the total space of all the packages you are upgrading. You have no where near enough space for that right now. You really need to figure out what is eating up all your space and remove it (or at least stash it somewhere). In a pinch, you might delete /var/log/journal. I’m not sure how significant that would be though. Use du -hs <path> to see how much space a directory is using. Don’t just delete directories though unless you know the software can cope with that (systemd-journald can handle /var/log/journal being removed). Before you delete anything, use rpm -qf <path> to make sure it isn’t part of an installed package. If it is part of a package, use sudo dnf remove <package-name> to remove it rather than rm.

Also check for package caches for old Fedora releases under /var/cache/dnf. I think I remember older versions of dnf being bad about leaving things behind under that directory.

1 Like

Many systems that were updated from f40 to f41 still have the cache for both versions of dnf as well as the cache for the system-upgrade.
Those can be cleaned up with dnf clean all (for dnf5), dnf4 clean all (for dnf4), and dnf4 system-upgrade clean for the system-upgrade cache.

Cleaning up the cache may provide some additional space as well.
The snap parts seem to take a lot of space as previously mentioned

2 Likes

Thx everyone for your help! I was finally able upgrade Fedora! – three times. As was suggested above, I resized my root and /home partition (via lvreduce/lvexpand, but forgeting the -r option initially – opps). I also removed snap (and flatpak), again suggested above. I also followed the suggestions in this article:

which was incredibly useful. After all this, I barely had enough space.

3 Likes