You are not logged in.

#1 2010-11-23 14:42:45

flip
Member
Registered: 2010-11-23
Posts: 4

[SOLVED] sudo pacman -Syu errors

Hi everyone!

First post here smile


I'm having trouble using pacman with sudo.

If I login as root and do

# pacman -Syu

it works as expected, no problems at all.

If I try it with my user account and sudo, it doesn't work, it seems the mirrors are not found and I don't know why.

$ sudo pacman -Syu
:: Synchronizing package databases...
error: failed retrieving file 'core.db.tar.gz' from ftp-stud.hs-esslingen.de : No address record
error: failed to update core (No address record)
error: failed retrieving file 'extra.db.tar.gz' from ftp-stud.hs-esslingen.de : No address record
error: failed to update extra (No address record)
error: failed retrieving file 'community.db.tar.gz' from ftp-stud.hs-esslingen.de : No address record
error: failed to update community (No address record)
error: failed to synchronize any databases

Entry from sudoers file:

flip arch=NOPASSWD: /sbin/shutdown, PASSWD: /usr/bin/pacman

I also tried:

flip ALL=(ALL) ALL

But it makes no difference.


I think I am missing something obvious here. Any ideas?

Cheers!
flip

Last edited by flip (2010-11-23 15:20:00)

Offline

#2 2010-11-23 15:03:28

dyscoria
Member
Registered: 2008-01-10
Posts: 1,007

Re: [SOLVED] sudo pacman -Syu errors

Hi, welcome smile

Check your internet connection.

This is not a problem with sudo, as the pacman command would not run at all otherwise. This is either a problem with your internet connection, or the mirror. If your connection is fine then change your mirror (/etc/pacman.d/mirrorlist).


flack 2.0.6: menu-driven BASH script to easily tag FLAC files (AUR)
knock-once 1.2: BASH script to easily create/send one-time sequences for knockd (forum/AUR)

Offline

#3 2010-11-23 15:08:32

flip
Member
Registered: 2010-11-23
Posts: 4

Re: [SOLVED] sudo pacman -Syu errors

I can connect to the internet as normal user and as root.

I am behind a proxy though, maybe that is part of the problem? Proxy environment variables are correctly set in .bash_profile for user and root account.

Offline

#4 2010-11-23 15:13:06

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

Re: [SOLVED] sudo pacman -Syu errors

Read "man sudoers"....  Hints:

    Defaults !env_reset

or

    Defaults env_keep+="HTTP_PROXY"

Online

#5 2010-11-23 15:19:24

flip
Member
Registered: 2010-11-23
Posts: 4

Re: [SOLVED] sudo pacman -Syu errors

Thanks!

I just found this thread:

https://bbs.archlinux.org/viewtopic.php?pid=747535

And solved it by putting this in sudoers:

Defaults env_keep += "HTTP_PROXY HTTPS_PROXY FTP_PROXY"

Everything works fine now, thanks!

Last edited by flip (2010-11-23 15:23:16)

Offline

#6 2010-11-23 15:39:11

dyscoria
Member
Registered: 2008-01-10
Posts: 1,007

Re: [SOLVED] sudo pacman -Syu errors

Wow. This is why I never install sudo tongue

sudo () {
  su -c "$*"
}


flack 2.0.6: menu-driven BASH script to easily tag FLAC files (AUR)
knock-once 1.2: BASH script to easily create/send one-time sequences for knockd (forum/AUR)

Offline

#7 2010-11-23 15:48:55

flip
Member
Registered: 2010-11-23
Posts: 4

Re: [SOLVED] sudo pacman -Syu errors

I use it to pop up a shell with "pacman -Syu" on X startup, so i don't forget to keep my packages up to date, and to be able to just click something to shutdown/reboot. It's quite handy for that smile

Hey, your approach is actually nice, I think about not using sudo for updating packages anymore. But if you don't want to type in a password, for shutdown, for example, you still have to use sudo.

Last edited by flip (2010-11-23 15:52:48)

Offline

#8 2010-11-23 16:12:04

dyscoria
Member
Registered: 2008-01-10
Posts: 1,007

Re: [SOLVED] sudo pacman -Syu errors

Well actually, there is a way to either shutdown OR reboot without a password (but not both).

The way I do it is put this in ~/.bashrc (or ~/.xinitrc)

setxkbmap -option  terminate:ctrl_alt_bksp

And then edit the line in /etc/inittab to this:

ca::ctrlaltdel:/sbin/shutdown -t3 -h now

Now, I can control-alt-backspace to quit X server and then control-alt-delete to shutdown...all without a password smile


flack 2.0.6: menu-driven BASH script to easily tag FLAC files (AUR)
knock-once 1.2: BASH script to easily create/send one-time sequences for knockd (forum/AUR)

Offline

#9 2010-11-23 16:56:45

tpfkanep
Member
From: South Africa
Registered: 2009-12-15
Posts: 121

Re: [SOLVED] sudo pacman -Syu errors

dyscoria wrote:

Wow. This is why I never install sudo tongue

sudo () {
  su -c "$*"
}

please be so kind as to explain:
- what this function (?) does?
- Where do I save it?
- How do I use it?
thanks

Offline

#10 2010-11-23 17:02:41

dyscoria
Member
Registered: 2008-01-10
Posts: 1,007

Re: [SOLVED] sudo pacman -Syu errors

Put this somewhere in ~/.bashrc and source it (source ~/.bashrc).

It allows commands to be run as root, without staying logged in as root.

For example:

$ sudo pacman -Syu

This will then prompt for root password and run the command, returning back to the regular user after the command has finished.

You can rename it to anything you like. I just called it sudo because it's my version of sudo. Although you can do the same with:

$ su -c "pacman -Syu"

But that's longer to type tongue


flack 2.0.6: menu-driven BASH script to easily tag FLAC files (AUR)
knock-once 1.2: BASH script to easily create/send one-time sequences for knockd (forum/AUR)

Offline

#11 2010-11-23 23:16:09

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

Re: [SOLVED] sudo pacman -Syu errors

Although, using that you have to type your password every time...

Online

#12 2010-11-24 00:45:10

dyscoria
Member
Registered: 2008-01-10
Posts: 1,007

Re: [SOLVED] sudo pacman -Syu errors

True, but I have nimble pianist fingers tongue


flack 2.0.6: menu-driven BASH script to easily tag FLAC files (AUR)
knock-once 1.2: BASH script to easily create/send one-time sequences for knockd (forum/AUR)

Offline

Board footer

Powered by FluxBB