You are not logged in.

#1 2012-08-27 08:05:13

beachcoder
Member
Registered: 2009-10-08
Posts: 130

[SOLVED] pacman not working via sudo?

Hi there!

I'm having the following effect with pacman and sudo:

$ sudo pacman -S mercurial
resolving dependencies...
looking for inter-conflicts...

Targets (1): mercurial-2.3-1

Total Download Size:    1.87 MiB
Total Installed Size:   13.50 MiB

Proceed with installation? [Y/n] 
:: Retrieving packages from extra...
error: failed retrieving file 'mercurial-2.3-1-x86_64.pkg.tar.xz' from ftp.hosteurope.de : Operation too slow. Less than 1024 bytes/sec transferred the last 10 seconds
warning: failed to retrieve some files from extra
error: failed to commit transaction (download library error)
Errors occurred, no packages were upgraded.

This is when I try to run pacman via sudo.
When I then do

$ su
Password: 
[root@genesis neo]# pacman -S mercurial
resolving dependencies...
looking for inter-conflicts...

Targets (1): mercurial-2.3-1

Total Download Size:    1.87 MiB
Total Installed Size:   13.50 MiB

Proceed with installation? [Y/n] 
:: Retrieving packages from extra...
 mercurial-2.3-1-x86_64  1918.2 KiB   660K/s 00:03 [######################] 100%
(1/1) checking package integrity                   [######################] 100%
(1/1) loading package files                        [######################] 100%
(1/1) checking for file conflicts                  [######################] 100%
(1/1) checking available disk space                [######################] 100%
(1/1) installing mercurial                         [######################] 100%
Optional dependencies for mercurial
    tk: for the hgk GUI

everything is fine.

My system is a virtual box running behind a proxy. I have made the proxy-settings available in a file /etc/profile.d/proxy.sh by setting and exporting the variables http_proxy and https_proxy, is this maybe the reason for this behavior?

Thanks,
beachcoder

Last edited by beachcoder (2012-08-27 10:21:02)

Offline

#2 2012-08-27 10:02:23

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,362

Re: [SOLVED] pacman not working via sudo?

sudo does not preserve http_proxy or any other env variables. You can either use a flag when calling sudo (troublesome) or edit your sudoers file (check out env_keep)


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#3 2012-08-27 10:20:49

beachcoder
Member
Registered: 2009-10-08
Posts: 130

Re: [SOLVED] pacman not working via sudo?

Thank you!

Adding

Defaults env_keep += "http_proxy https_proxy"

to sudoers solved the problem!

Offline

Board footer

Powered by FluxBB