Red Hat Bugzilla – Bug 1300878
[RFE] dnf makecache enabled on readonly-root systems wastes cpu
Last modified: 2016-12-20 13:03:46 EST
Description of problem:
It looks like dnf makecache timer that is eanbled by default for some reason cannot understand that it's running on a readonly root system (i.e. nfsroot)
and fires anyway, so 10 minutes after system start we end up with dnf makecache process that hogs 100% of cpu.
32441 ? RNs 14:24 /usr/bin/python -OO /usr/bin/dnf -v makecache timer
strace shows that it's looping trying to perform:
open("/var/cache/dnf/metadata_lock.pid", O_WRONLY|O_CREAT|O_EXCL, 0644) = -1 EEXIST (File exists)
open("/var/cache/dnf/metadata_lock.pid", O_RDONLY) = -1 ENOENT (No such file or directory)
The file does not exist:
# ls -la /var/cache/dnf/metadata_lock.pid
ls: cannot access /var/cache/dnf/metadata_lock.pid: No such file or directory
The /var/cache/dnf is not one of the default targets to be mounted in tmpfs (and for a good reason).
I see that the timer in question already contains a condition against running when started from livecd image:
Now, if this could be replaced with a check of /etc/sysconfig/readonly-root and not run when READONLY is set to yes - that would be a lot more proper solution.
Or at least a check that /var/cache/dnf is actually writeable.
Version-Release number of selected component (if applicable):
present in all version of dnf starting from FC21
Steps to Reproduce:
If you are not up to the task of doing nfs readonly-root install or the like, you can simulate it by:
1. mount none /var/cache/dnf -t tmpfs
2. mount / /media --bind
3. cp -a /media/var/cache/dnf/* /var/cache/dnf/
4. umount /media
5. strace dnf makecache
Note it's important to do the copying of a real existing dnf cache as otherwise it's smart enough to fail seeing as it cannot create it if the /var/cache/dnf is empty (which it is not on a real readonly nfsroot install)
dnf enters infinite loop hogging 100% of one cpu.
should notice that it cannot do anything.
Even better if dnf makecache was not run by default in such a case.
This all got introduced with the mandatory on-by-default dnf makecache timer as part of dnf package, that sparked quite a heated discussion in bug 1187111.
There's one more step in the reproducer, btw, that I forgot to include:
3.5 mount /var/cache/dnf -o remount,ro
Otherwise the /var/cache/dnf is not readonly and you won't see the problem.
we can add the readonly checker everytime we load cache directory.
This package has changed ownership in the Fedora Package Database. Reassigning to the new owner of this component.
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora 'version'
Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.
Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 23 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.
Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.
Fedora 23 changed to end-of-life (EOL) status on 2016-12-20. Fedora 23 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.
If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
Thank you for reporting this bug and we are sorry it could not be fixed.