[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#874326: apt-get should provide a clear message if not root



Control: tags -1 + newcomer
Control: severity -1 wishlist
Control: notfound -1 1.2.24
Control: found -1 1.4.7

On Tue, Sep 05, 2017 at 08:25:56AM +0300, Jonny Grant wrote:
> Basically apt-get must run as root, […]
> 
> Current output
> ==============
> 
> $ apt-get update
> Reading package lists... Done
> W: chmod 0700 of directory /var/lib/apt/lists/partial failed -
> SetupAPTPartialDirectory (1: Operation not permitted)
> E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission
> denied)
> E: Unable to lock directory /var/lib/apt/lists/
> W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches
> (13: Permission denied)
> W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches
> (13: Permission denied)
> $


The problem is that in THIS configuration (which happens to be the
default) apt needs to run the update operation as root as it otherwise
has no access to various directories/files, but all these (and many
more) locations can be configured independently which can result in
a setup not requiring root rights¹, but due to the many possible ways
this can't be easily checked in highlevel code, you kinda have to run
the lower levels and have them report the issues they find in the setup
each time so people have a useful hint at what is wrong in their setup.

What could be done is adding a "N: You aren't root, are you sure?"-style
message at the end if the setup call failed (and exit at that point
instead of continuing with trying the cache removal).


I am tagging this newcomer as this seems like a simple enough change for
someone to wet their feet with & at the same time is a rather visible
change you can boast about around your Debian friends. :)

The DoUpdate function in apt-private/private-update.cc should be a good
start for looking into it althrough the implementation of the message
might end up in another place (e.g. in the Fetcher implementation in
apt-pkg/acquire.cc). If there are questions we are happy to help here,
on deity@ mailinglist or in the #debian-apt IRC channel.


Best regards

David Kalnischkies

¹ our own testcases in ./test/integration are an example, but there are
other (more user-facing) tools like chdist making use of this as well.

P.S.: Fixing the found version as a 1.2.24 never existed. Picked stable
version at semi-random as it doesn't make a whole lot of difference.

Attachment: signature.asc
Description: PGP signature


Reply to: