Running Fedora 22's dnf
as a normal user versus as root
If you're me, you've probably done this at some point:
# dnf clean metadata [...] # dnf check-update [... lists some available updates ...]
Then in another window, running as myself:
; dnf updateinfo info [... doesn't report anything ...]
Wait, what?
What's going on here is that dnf
maintains separate package
databases for root and for individual users. When you run dnf
as root, it consults (and updates) the 'official' DNF package
databases and metadata under /var/cache/dnf
. When you run dnf
as any non-root user, it uses a /var/tmp/dnf-<user>-<random>
directory instead; although everything in /var/cache/dnf
is
world-readable, dnf makes no attempt to look at it. As a result
it's completely possible for root's dnf
commands and your dnf
commands to give completely different results.
You can reduce the odds of this by remembering to do 'dnf clean
metadata
' or the like as yourself too, but this doesn't absolutely
guarantee that root's data and your data are in sync. When your
dnf
command re-pulls the package information, it may fetch it
from a different mirror that is more (or less) up to date than the
mirror root's dnf
used.
(And of course this wastes bandwidth on re-fetching data you already have.)
I hate the idea of running 'dnf updateinfo info
' as root instead
of myself, but I'm probably going to have to get used to it. There
are just too many annoyances otherwise.
PS: Yes, I know about 'dnf clean expire-cache
'; I used to do it
all the time with yum. Unlike with yum, with DNF it doesn't work
really well to get me the latest update state. Have I mentioned
that I'm not fond of DNF?
Sidebar: How dnf
should behave
When run as a normal user, DNF should try to use /var/cache/dnf
data files if they're suitable, ie if they're sufficiently up to
date and DNF is being used in a mode where it only needs read access
to them. Only if DNF has been asked to do something that would
normally write to /var/cache/dnf
would it switch to the
/var/tmp/dnf-<user>-...
scheme. In other words, if you just used
information commands as a normal user you'd get to take advantage
of the system DNF database.
|
|