Ask Your Question

deleted /var dnf cache and now dnf doesn't work, Is there a way to fix dnf ?

asked 2016-06-24 13:22:46 -0500

centinel20 gravatar image

Hi this is my first time here. I have been a Fedora user for years though and this is the first issue i have been unable to solve. I read the stickies and the guidelines and hope I am doing this right. thanks in advance.

I actually have 2 fedora23 installations one in a USB stick another on a hard drive. In preparation to updating to fedora24 on my USB stick I followed the steps on the fedora magazine page . When the download said it needed 1.4G of space and since my /var has 4G i Thought I was good. When it was almost done I ran out of space and dnf stopped. I can't upload a file but the log states:

`Traceback (most recent call last): File "/usr/lib64/python3.4/", line 523, in move os.rename(src, real_dst) OSError: [Errno 18] Invalid cross-device link: '/tmp/dnf-1aeymz4j/repodata' -> '/var/cache/dnf/fedora-fe3d2f0c91e9b65c/repodata'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3.4/site-packages/dnf/cli/", line 112, in _main File "/usr/lib/python3.4/site-packages/dnf/cli/", line 1096, in run return File "/usr/lib/python3.4/site-packages/dnf/cli/commands/", line 89, in run self.base.fill_sack() # performs the md sync File "/usr/lib/python3.4/site-packages/dnf/", line 239, in fill_sack self._add_repo_to_sack(r) File "/usr/lib/python3.4/site-packages/dnf/", line 111, in _add_repo_to_sack repo.load() File "/usr/lib/python3.4/site-packages/dnf/", line 837, in load self._replace_metadata(handle) File "/usr/lib/python3.4/site-packages/dnf/", line 692, in _replace_metadata shutil.move(handle.metadata_dir, self.metadata_dir) File "/usr/lib64/python3.4/", line 532, in move copytree(src, real_dst, symlinks=True) File "/usr/lib64/python3.4/", line 343, in copytree raise Error(errors) shutil.Error: [('/tmp/dnf-1aeymz4j/repodata/86a9c4f451ecfec1633638a477b6acef805fd6606978c7bd3c67434034f915a8-comps-f23.xml.xz', '/var/cache/dnf/fedora-fe3d2f0c91e9b65c/repodata/86a9c4f451ecfec1633638a477b6acef805fd6606978c7bd3c67434034f915a8-comps-f23.xml.xz', '[Errno 28] No space left on device'), ('/tmp/dnf-1aeymz4j/repodata/874f220caf48ccd307c203772c04b8550896c42a25f82b93bd17082d69df80db-filelists.xml.gz', '/var/cache/dnf/fedora-fe3d2f0c91e9b65c/repodata/874f220caf48ccd307c203772c04b8550896c42a25f82b93bd17082d69df80db-filelists.xml.gz', '[Errno 28] No space left on device'), ('/tmp/dnf-1aeymz4j/repodata/repomd.xml', '/var/cache/dnf/fedora-fe3d2f0c91e9b65c/repodata/repomd.xml', '[Errno 28] No space left on device')] Jun 24 11:43:58 CRITICAL [('/tmp/dnf-1aeymz4j/repodata/86a9c4f451ecfec1633638a477b6acef805fd6606978c7bd3c67434034f915a8-comps-f23.xml.xz', '/var/cache/dnf/fedora-fe3d2f0c91e9b65c/repodata/86a9c4f451ecfec1633638a477b6acef805fd6606978c7bd3c67434034f915a8-comps-f23.xml.xz', '[Errno 28] No space left on device'), ('/tmp/dnf-1aeymz4j/repodata/874f220caf48ccd307c203772c04b8550896c42a25f82b93bd17082d69df80db-filelists.xml.gz', '/var/cache/dnf/fedora-fe3d2f0c91e9b65c/repodata/874f220caf48ccd307c203772c04b8550896c42a25f82b93bd17082d69df80db-filelists.xml.gz', '[Errno 28] No space left on device'), ('/tmp/dnf-1aeymz4j/repodata/repomd.xml', '/var/cache/dnf/fedora-fe3d2f0c91e9b65c/repodata/repomd.xml', '[Errno 28] No space left on device')]`

I tried to use sudo dnf clean all but /var stays full. and now i cant sudo dnf update When this happened I started working on the other system for the same upgrade I tried to make space on the /var folder and ... (more)

edit retag flag offensive close merge delete


Welcome to ask.fedora. The problem may not be in /var at all, but in some other folder on the same partition. Please use a comment (not an answer) to give the results of df -h / because /var needs to be on that partition and that will show us how much space their really is. Once we've gotten you some space, we can worry about rebuilding the cache.

sideburns gravatar imagesideburns ( 2016-06-24 14:08:01 -0500 )edit


Filesystem               Size  Used Avail Use% Mounted on
    /dev/mapper/fedora-root   13G  5.4G  6.7G  45% /
        tmpfs                    7.9G   88K  7.9G   1% /tmp
        /dev/sdb1                477M  165M  283M  37% /boot
        /dev/mapper/fedora-home   97G   29G   64G  31% /home
        /dev/mapper/fedora-var   3.9G  3.9G     0 100% /var
centinel20 gravatar imagecentinel20 ( 2016-06-24 18:37:45 -0500 )edit

second system:

Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/fedora-root   13G  6.9G  4.9G  59% /
tmpfs                    7.9G   40K  7.9G   1% /tmp
/dev/mapper/fedora-var   3.8G  417M  3.2G  12% /var
/dev/mapper/fedora-home  106G   81G   20G  81% /home
/dev/sda3                239M  159M   64M  72% /boot
centinel20 gravatar imagecentinel20 ( 2016-06-25 01:22:40 -0500 )edit

Also nautilus has stopped working on the system with the full /var partition. It starts but crashes and never comes back. Neither from the menu or the command line.

centinel20 gravatar imagecentinel20 ( 2016-06-25 13:36:34 -0500 )edit

I don't use Gnome or nautilus, but I'm guessing that the two issues are related. And, both systems are using LVM that I've never played with. However, it's possible that most of the cruft giving you trouble is in a subfolder. Try running ls -lh /var/log | grep total to see how much space your logs are taking up. As an example, mine only takes up 143M.

sideburns gravatar imagesideburns ( 2016-06-25 16:11:35 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2016-07-06 00:07:45 -0500

cmurf gravatar image

dnf clean all is safe, as is directly rm'ing the contents of /var/cache/dnf. Something else may have become broken or confused due to the full file system interrupting some important transaction. I suggest fsck the filesystem (this was ext4?) and manually remove the entire contents of /var/cache/dnf. If dnf does not run, the exact error might be useful.

Also, try rpm -V to verify dnf and dependencies, or even verify all packages. Something may be broken. You can download replacements from koji and make rpm reinstall.

edit flag offensive delete link more


If you look at the comments on the question I have posted the error:

$ sudo dnf update
Error: Failed to synchronize cache for repo 'updates'

This happens with all dnf commands. What is the full rpm command?

$ sudo rpm -V dnf


$ sudo rpm -V all

Or what? file system is ext4 and I did delete cache in /var manualy, thats when dnf started to fail. Tahnks.

centinel20 gravatar imagecentinel20 ( 2016-07-06 22:11:38 -0500 )edit

answered 2016-07-05 18:01:30 -0500

charims gravatar image

How I find all the space when I run out

du -s /var/* | sort -n

find the directory using up the most of the space(bottom of the list), then run

du -s /var/<large dir>/* | sort -n

Continue, Once you are down to the dir, figure out what to do with the files. If its in /var/cache/dnf it should be relatively safe to delete(however cleaning your cache should have done so already). However, you may find that its some logs or something that took up the space. Once we know what it is, we can recommend what to do with the files.

edit flag offensive delete link more


space is not the problem. the problem is that when I was cleaning up /var I must have deleted something inmportant because now all dnf commands fail to sycronize cache, for example:

$ sudo dnf update

Error: Failed to synchronize cache for repo 'updates'
centinel20 gravatar imagecentinel20 ( 2016-07-05 23:15:44 -0500 )edit

Question Tools

1 follower


Asked: 2016-06-24 13:22:46 -0500

Seen: 1,283 times

Last updated: Jul 06 '16