Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm not using Unity, so I don't have a handy button to click on to start software-center. It's occasionally useful to search for software, though, so I run it from the command line. However, then I can't actually install the software through that interface (no permissions). So I tried sudo software-center instead, hoping to fix that. After entering my password on the command line, I'm presented with a dialog box asking for:

Enter password for keyring 'default' to unlock

What should I enter here to get software-center to actually start up as root?

Here's some more information. I'm running Enlightenment (E17) as my desktop environment. The buttons that appear on the side bar in unity don't appear to have an equivalent in E17, which is why i'm running software-center from the command line. When i do so, as me instead of root, at the point where i try to install something, an error message pops up that says:

Authentication Error. Software can't be installed or removed because the authentication service is not available. (org.freedesktop.PolicyKit.Error.Failed: ('system-bus-name', {'name': ':1.96'}): org.debian.apt.install-or-remove-packages

Policykit does not appear to be running, or at least nothing resembling that name shows up with "ps wux". So i guess that raises the question, would anyone know how to get that to start up automatically when i log in?

Thanks!

share|improve this question
    
What desktop manager are you using? –  Braiam Jan 8 at 1:52
    
Also you say "However, then I can't actually install the software through that interface (no permissions)." It actually doesn't ask you for permissions? –  Braiam Jan 8 at 12:58
    
If you're using an alternative DE/WM, you need to make sure /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1 is run at start-up. Software Centre uses PolicyKit and needs this to be running. –  Flimm Jan 8 at 14:46
1  
The Bodhi Linux forums have a duplicate of this question and the answer is to use gksudo software-center. The OP just says he or she is "not using Unity", but it's not clear that official Ubuntu is involved. I suspect the OP is using Bodhi. @user232901 Are you using Bodhi or Ubuntu? –  chaskes Jan 9 at 7:03
2  
@Braiam Sorry, forgot to link it. Ubuntu Software Center PolicyKit error on BodhiLinux forum –  chaskes Jan 10 at 19:11

3 Answers 3

You shouldn't be running software-center as root. You should simply launch it as your own user. Installing a package should prompt you with a policykit dialog box asking for your password. Is that not happening?

share|improve this answer
    
The problem is that 1) he's not using unity 2) we don't know what DM/WM he's using 3) could be that the .desktop file is missing. –  Braiam Jan 8 at 1:51
2  
Marc is perfectly right, software-center shouldn't be started as root, no matter what desktop environment you may be using. The software-center should always be started as the user and the policykit policy coming with the aptdaemon backend will take care of authenticating the user when comes the time to install a package. Starting it as root is just making it more likely to mess up some permissions in user-owned files and in my experience, won't make policykit any happier (usually quite the opposite). –  stgraber Jan 8 at 1:53
1  
Braiam, none of that matters. PolicyKit is available across all Ubuntu DM/WM/DE, and one should simply start software-center as normal user, yourself and not as root. –  Dima Jan 8 at 9:47
    
@stgraber "However, then I can't actually install the software through that interface (no permissions)." How we fix that? –  Braiam Jan 8 at 12:34
1  
@stgraber It's often unnecessary to run software-center as root, but I'm not convinced there's actually anything wrong with it. Mangled permissions result from running GUI apps as root using a wrong technique. For example, sudo software-center risks this; gksudo software-center doesn't. As for polkit, often applications that use PolicyKit don't themselves support being run as root or have bugs that prevent it from working (e.g., users-admin), but I don't think that's a polkit limitation. Sometimes polkit problems are worked around effectively by running software-center as root. –  Eliah Kagan Jan 10 at 4:38

You need pkexec instead:

pkexec software-center

That way is like you were starting it from the GUI.

share|improve this answer
1  
Not everywhere/all the time apparently - in my system that command leads to a core dump whereas gksudo software-center runs fine. –  guntbert Jan 7 at 21:48
    
@guntbert something is wrong in your system then. pkexec is what is run when I click the software center in Ubuntu. –  Braiam Jan 8 at 0:03
1  
This answer is incorrect, software-center does not require root privileges to operate (browse apps, leave reviews, etc.). It only raises privileges dynamically when needed to install system-wise deb based applications. –  Dima Jan 8 at 9:49
    
@Dima "However, then I can't actually install the software through that interface (no permissions)" then how we fix that? –  Braiam Jan 8 at 12:33
    
I think this is still a reasonable thing to try. I recommend removing or, better, expanding/fixing the thing about this command being "like you were starting it from the GUI." Indeed Software Center only performs specific actions as root through polkit when run as a normal user (which is the best way to run it when possible). But although pkexec software-center and gksudo software-center aren't guaranteed to work (or even be supported), as far as I know they're reasonable troubleshooting steps. Unless someone knows that pkexec software-center never works... –  Eliah Kagan Jan 10 at 4:44

A good option is to use the following two commands:

sudo -i           #login as root
software-center   #run software-center as root

If you want to use pkexec software-center as @Braiam suggested in his answer you will most likely get some errors and the command leads to a core dump (as @gunbert said in this comment). The right way to run software-center as root using pkexec is:

pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY software-center

And this is normal because man pkexec is very clear in this sense:

       [...] pkexec will not allow you to run X11 applications
       as another user since the $DISPLAY and $XAUTHORITY environment
       variables are not set.[...]

Also, see Why user should never use normal sudo to start graphical application?

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.