When a lowly peon pretends to the throne by running a command such as
uid=9999(simple_nobody) groups=100(users) [...]
% rpm -e kernel
rpm responds to the obvious insult with the cryptic
error: can't create transaction lock on /var/lib/rpm/.rpm.lock (Permission denied)
which is a roundabout way of saying "You need to be root to perform such rpm
operations.". Please consider teaching rpm some noblesse oblige and giving
a more informative message.
Rpm goes to quite some lengths to avoid making assumptions about root, it just needs sufficient filesystem (and/or other, depending on the operation in question) privileges.
While of course by default obviously many things like installing and removing packages from system does require root /in practise/, it's entirely possible to set up things in a way that allows eg non-root write-access to the system rpmdb. Not to mention other cases like operating on an rpmdb in an alternative path, installing files to paths where you have write permission. A simplistic message saying "you need to be root" would be just wrong.
The current message tells you quite exactly what rpm is trying to do and what the problem is (insufficient permissions), just as much as this does:
[pmatilai@localhost ~]$ touch /var/lib/rpm/foo
touch: cannot touch `/var/lib/rpm/foo': Permission denied
"of course by default obviously many things like installing and removing packages from system does require root /in practise/"
This alone should be enough to justify improving the text.
"Not to mention other cases like operating on an rpmdb in an alternative path, installing files to paths where you have write permission."
If one has permissions already, there will be no error message, and this bug report does not apply.
If some permissions are missing, if you don't like the obvious heuristic that it
should suggest root, then rpm could fstat the files in dispute, and say that one
needs <OWNER> or <GROUP> privileges to do this. In practice, this will say
Sorry but not worth the trouble, really. This message was already once revised to give the failure reason (whether permission denied or something else), and for a low-level system tool such as rpm, "permission denied" says all there is to say about it: higher privileges are needed to perform this operation. Use a higher level tool to get more hand-holding than that: yum (which Fedora users are recommended to use for package management needs anyway) will happily tell you "you need to be root to perform this command" as it doesn't even try to deal with the other scenarios where the answer is not as simple as that.
Now lets leave this closed, please.