You are not logged in.

#1 2017-02-21 03:05:38

mindstormer
Member
Registered: 2015-05-28
Posts: 28

[solved] checkupdates requires sudo permissions on my desktop machine

On my desktop machine, `checkupdates` requires sudo to provide relevant results.

$ checkupdates | wc -l

returns nothing, takes a second to finish

$ sudo checkupdates | wc -l

returns 7, takes a while to check as expected

I was wondering why my statusbar using this script kept saying I have 0 updates when my laptop using the same script had updates.

I googled and found that someone also had the same issue but fixed his by restarting. It's been several days since and restarting and updating did not fix the issue. Someone also recommended that I

rm -rf /tmp/checkup-db-*

but again, that did not fix the issue.

Last edited by mindstormer (2017-03-07 02:19:54)

Offline

#2 2017-02-21 04:08:14

thiagowfx
Member
Registered: 2013-07-09
Posts: 586

Re: [solved] checkupdates requires sudo permissions on my desktop machine

What is the output of

ls -al /usr/bin/checkupdates

?

Offline

#3 2017-02-21 04:16:53

mindstormer
Member
Registered: 2015-05-28
Posts: 28

Re: [solved] checkupdates requires sudo permissions on my desktop machine

-rwxr-xr-x 1 root root May 18 2016  /usr/bin/checkupdates

Hmm... that's not the default permissions/ownership? I didn't do anything to it--should I

chown $USER:$USER /usr/bin/checkupdates

?

Last edited by mindstormer (2017-02-21 04:33:54)

Offline

#4 2017-02-21 04:24:15

circleface
Member
Registered: 2012-05-26
Posts: 639

Re: [solved] checkupdates requires sudo permissions on my desktop machine

Those permissions look normal.  For the most part, everything in /usr/bin should be owned by root.

Offline

#5 2017-02-21 04:36:13

mindstormer
Member
Registered: 2015-05-28
Posts: 28

Re: [solved] checkupdates requires sudo permissions on my desktop machine

Someone also suggested I use strace to maybe see what files it is trying to open and failing but I don't know if that's helpful and I have no idea how to interpret the really long output.

Offline

#6 2017-02-21 04:40:50

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [solved] checkupdates requires sudo permissions on my desktop machine

What are the permissions on the db in /tmp?


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#7 2017-02-21 04:43:45

circleface
Member
Registered: 2012-05-26
Posts: 639

Re: [solved] checkupdates requires sudo permissions on my desktop machine

Just as a sanity check, try

pacman -Qkk pacman

and make sure it doesn't report anything unusual.

Offline

#8 2017-02-21 05:00:06

mindstormer
Member
Registered: 2015-05-28
Posts: 28

Re: [solved] checkupdates requires sudo permissions on my desktop machine

@jasonwryan
The two databases are 755, owned by $USER:$USER and root:root for checkup-db-$USER and check-up-db-root respectively.

@circleface
`pacman -Qkk pacman` outputs the following:

backup file: pacman: /etc/pacman.conf (Modification time mismatch)
backup file: pacman: /etc/pacman.conf (Size mismatch)
pacman: 349 total files, 0 altered files

Offline

#9 2017-02-21 05:42:50

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,390
Website

Re: [solved] checkupdates requires sudo permissions on my desktop machine

Do you have fakeroot installed?

Offline

#10 2017-02-21 06:04:31

mindstormer
Member
Registered: 2015-05-28
Posts: 28

Re: [solved] checkupdates requires sudo permissions on my desktop machine

Yes, I have fakeroot installed via base-devel group.

Offline

#11 2017-02-21 07:02:05

ayekat
Member
Registered: 2011-01-17
Posts: 1,590

Re: [solved] checkupdates requires sudo permissions on my desktop machine

Does it work if you specify an alternative DB location?

CHECKUPDATES_DB="$HOME"/tmpdb checkupdates

pkgshackscfgblag

Offline

#12 2017-02-21 14:58:03

mindstormer
Member
Registered: 2015-05-28
Posts: 28

Re: [solved] checkupdates requires sudo permissions on my desktop machine

@ayekat No, it does not.

Offline

#13 2017-03-04 20:28:26

seth
Member
Registered: 2012-09-03
Posts: 51,211

Re: [solved] checkupdates requires sudo permissions on my desktop machine

strace checkupdates 2>&1 | tee checkupdates.strace

paste checkupdates.strace somewhere so one can inspect it for errors or unexpected behavior

Offline

#14 2017-03-05 05:19:51

brianb
Member
From: Montreal, QC
Registered: 2012-02-17
Posts: 81
Website

Re: [solved] checkupdates requires sudo permissions on my desktop machine

I'm having a very similar (possibly the same) problem, except in my case, checkupdates without sudo simply hangs. (See here.) I decided to manually do what checkupdates does to see what the issue is, and this is as far as I got:

% mkdir -p /tmp/checkup-db-brian                                                                                                                    ~
% ln -s /var/lib/pacman/local /tmp/checkup-db-brian                                                                                                 ~
% fakeroot -- pacman -Sy --dbpath /tmp/checkup-db-brian --logfile /tmp/checkup-db-brian/log                                                         ~
:: Synchronizing package databases...
error: failed retrieving file 'core.db' from ftp.uni-hannover.de : Resolving timed out after 10519 milliseconds
error: failed retrieving file 'core.db' from repo.itmettke.de : Resolving timed out after 10521 milliseconds
error: failed retrieving file 'core.db' from mirror.selfnet.de : Resolving timed out after 10520 milliseconds
error: failed retrieving file 'core.db' from archlinux.nullpointer.io : Resolving timed out after 10521 milliseconds
error: failed retrieving file 'core.db' from ftp.halifax.rwth-aachen.de : Resolving timed out after 10520 milliseconds
error: failed retrieving file 'core.db' from archlinux.honkgong.info : Resolving timed out after 10521 milliseconds
error: failed retrieving file 'core.db' from mirrors.prometeus.net : Resolving timed out after 10520 milliseconds
error: failed retrieving file 'core.db' from archlinux.mailtunnel.eu : Resolving timed out after 10521 milliseconds
^C
Interrupt signal received

Compare with:

% sudo pacman -Sy --dbpath /tmp/checkup-db-brian --logfile /tmp/checkup-db-brian/log                                                                ~
[sudo] password for brian: 
:: Synchronizing package databases...
 core                                                                  123.9 KiB   264K/s 00:00 [--------------------------------------------------------] 100%
 extra                                                                1676.3 KiB   187K/s 00:09 [--------------------------------------------------------] 100%
 community                                                               3.8 MiB   466K/s 00:08 [--------------------------------------------------------] 100%

So, for some reason with fakeroot I get a timeout for every single mirror in my mirrorlist.

NB: OP said that their checkupdates "takes a second to finish", whereas in my case it hangs. The difference could be that OP has just one or just a couple mirrors in mirrorlist, whereas I have 20 (obtained with "reflector -n 20 ...").

Offline

#15 2017-03-05 07:48:44

seth
Member
Registered: 2012-09-03
Posts: 51,211

Re: [solved] checkupdates requires sudo permissions on my desktop machine

fakeroot -- ping www.google.com

Offline

#16 2017-03-05 08:47:43

brianb
Member
From: Montreal, QC
Registered: 2012-02-17
Posts: 81
Website

Re: [solved] checkupdates requires sudo permissions on my desktop machine

Seems to work, aside from the error about libfakeroot.so, which I'm not sure how to interpret:

% ping -c3 www.google.com                                                                                                                          ~
PING www.google.com (216.58.204.4) 56(84) bytes of data.
64 bytes from lhr35s07-in-f4.1e100.net (216.58.204.4): icmp_seq=1 ttl=54 time=193 ms
64 bytes from lhr35s07-in-f4.1e100.net (216.58.204.4): icmp_seq=2 ttl=54 time=101 ms
64 bytes from lhr35s07-in-f4.1e100.net (216.58.204.4): icmp_seq=3 ttl=54 time=99.4 ms

--- www.google.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 99.479/131.475/193.934/44.170 ms
%
% fakeroot -- ping -c3 www.google.com                                                                                                              ~
ERROR: ld.so: object 'libfakeroot.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
PING www.google.com (216.58.204.4) 56(84) bytes of data.
64 bytes from lhr35s07-in-f4.1e100.net (216.58.204.4): icmp_seq=1 ttl=54 time=1815 ms
64 bytes from lhr35s07-in-f4.1e100.net (216.58.204.4): icmp_seq=2 ttl=54 time=795 ms
64 bytes from lhr35s07-in-f4.1e100.net (216.58.204.4): icmp_seq=3 ttl=54 time=104 ms

--- www.google.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2019ms
rtt min/avg/max/mdev = 104.213/905.134/1815.287/702.801 ms, pipe 2

Offline

#17 2017-03-05 15:55:18

seth
Member
Registered: 2012-09-03
Posts: 51,211

Re: [solved] checkupdates requires sudo permissions on my desktop machine

ok?

fakeroot -- dig ftp.uni-hannover.de
fakeroot -- curl -v 'http://ftp.uni-hannover.de/archlinux/core/os/x86_64/core.db' > /dev/null

Offline

#18 2017-03-05 17:54:40

brianb
Member
From: Montreal, QC
Registered: 2012-02-17
Posts: 81
Website

Re: [solved] checkupdates requires sudo permissions on my desktop machine

OK, now we're getting somewhere: "fake -- dig" works both with and without "sudo", but "fakeroot -- curl" fails (i.e. hangs) without "sudo", as does "fakeroot -- wget". Huh.

Last edited by brianb (2017-03-05 17:55:23)

Offline

#19 2017-03-05 18:01:31

brianb
Member
From: Montreal, QC
Registered: 2012-02-17
Posts: 81
Website

Re: [solved] checkupdates requires sudo permissions on my desktop machine

Someone else appears to have had this exact same problem 2 years ago: [SOLVED] Fakeroot can't resolve a host. DNS issue ? (curl/wget). There's a solution at the very bottom, which says to "place 'dns' in /etc/nssswitch.conf on line 9", but I already have 'dns' there:

# Begin /etc/nsswitch.conf

passwd: compat mymachines systemd
group: compat mymachines systemd
shadow: compat

publickey: files

hosts: files mymachines resolve [!UNAVAIL=return] dns myhostname
networks: files

protocols: files
services: files
ethers: files
rpc: files

netgroup: files

# End /etc/nsswitch.conf

Offline

#20 2017-03-05 20:10:19

seth
Member
Registered: 2012-09-03
Posts: 51,211

Re: [solved] checkupdates requires sudo permissions on my desktop machine

nslookup ftp.uni-hannover.de
fakeroot -- nslookup ftp.uni-hannover.de

Since the latter is likely gonna fail:

strace nslookup ftp.uni-hannover.de 2>&1 | tee nslookup.strace.good
fakeroot -- strace nslookup ftp.uni-hannover.de 2>&1 | tee nslookup.strace.bad

Offline

#21 2017-03-05 20:43:06

brianb
Member
From: Montreal, QC
Registered: 2012-02-17
Posts: 81
Website

Re: [solved] checkupdates requires sudo permissions on my desktop machine

Solved! I figured it out: I needed to enable "systemd-resolved.service". Following the wiki entry for systemd-networkd, I did:

# rm /etc/resolv.conf
# systemctl enable systemd-resolved.service
# ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
# systemctl restart systemd-resolved.service

Everything works fine now!

(I recently installed Arch a new laptop, and during the setup process, I must've enabled "systemd-networkd" without also enabling "systemd-resolved". Somehow, I managed to go a month without noticing any issue, except for the fact that my xmobar status bar would freeze every hour, because it was trying to run "checkupdates". Lo and behold...)

I hope this solution works for OP, too.

Offline

#22 2017-03-07 02:19:15

mindstormer
Member
Registered: 2015-05-28
Posts: 28

Re: [solved] checkupdates requires sudo permissions on my desktop machine

I had systemd-networkd and system-resolved services already enabled, but

ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf

seems to fix it for me. I'm not sure how... Thanks.

Offline

Board footer

Powered by FluxBB