PDA

View Full Version : Rootsh and permission problems with dpkg,apt-get+QBW


Dany-69
2010-08-04, 02:10
Hi guys:)
is a bit that I'm playing with QBW to create buttons on the desktop that will allow me to make some tedious procedures about packages ..

In particular I would like one to remove old dependencies .. one to upgrade the app ... and finally one to purge the old packages

1) To remove old dependencies I added a simple

sudo apt-get -y clean && apt-get -y autoclean && apt-get -y autoremove

Result: The first time asking for the password (and even this is not good because if I enter the command in QBW there is no way to enter the password) ... I enter "root" ... and he replies:

Sorry, user user is not allowed to execute '/usr/bin/apt-get -y clean' as root on Nokia-N900

Even closing and reopening the terminal it does not require me the pass for a certain period of time .. Only the output about the missing permission

2) To upgrade the app a :

sudo apt-get update && apt-get -y upgrade

Result .. :

Sorry, user user is not allowed to execute '/usr/bin/apt-get update' as root on Nokia-N900

3) To purge all the packages I have tried with:

sudo dpkg --list |grep "^rc" | cut -d " " -f 3 | xargs dpkg --purge

Result

Sorry, user user is not allowed to execute '/ usr / bin / dpkg --list' as root on Nokia-N900.
dpkg: Requested operation requires superuser privilege

On the advice of a friend I tried:

dpkg --list |grep "^rc" | cut -d " " -f 3 | xargs dpkg --purge | sudo gainroot

to first run the command sudo gainroot.. response ..

~ $ dpkg --list |grep "^rc" | cut -d " " -f 3 | xargs dpkg --purge | sudo gainroot
Root shell enabled
dpkg: Requested operation requires superuser privilege
~ $

All controls, performed manually with sudo gainroot and then the rest, work perfectly.

But for QBW i need the commands to work with only 1 input...

Why all these problems with sudo? T_T

I even tried uninstalling and reinstalling rootsh .. but nothing ..

Solutions? :(

EDIT: and there's something even more strange... the sudo command for the "sudo kernel-config ecc ecc" works..
I can change frequences and kernel options without any problem .. o.o ...

codeMonkey
2010-08-04, 08:17
Sudo isn't quite set up right on the devices.
If you've got the rootsh from extras (not devel) you should be able to replace sudo with rootsh in all of the above commands for it to work. The one from extras-devel has a couple of differences in the usage of rootsh is deprecated, but there may be another workaround there.

Big Phat Jan
2010-08-04, 08:44
Edit: Apologies, just saw codeMonkey's better suggestion and it works. Please don't edit your sudoers file (unless you really want to use sudo instead!).

- Original post -

It sounds like you need to edit your sudoers file.

You need to be careful when you do this. If you mess it up you may not be able to perform any commands as a superuser (including fixing the sudoers file!).

Make sure you always use the visudo command as root rather than directly editing the file and it will warn you of syntax errors.

The easiest way to get the behaviour you seem to want you need to add this line (using visudo):

user ALL = NOPASSWD: ALL

You could restrict sudo to only work for the specific commands you want - google is your friend in this case. You might want to search and familiarise yourself with the sudoers file anyway before proceeding.

Cheers,
Jan

AlMehdi
2010-08-04, 09:04
Try:

echo "apt-get -y clean && apt-get -y autoclean && apt-get -y autoremove" | sudo gainroot

gft2k1
2010-08-04, 10:12
if you have installed rootsh 1.8 from extras devel uninstall it and install rootsh 1.5 from extras.

in your qbw widget replace all "sudo" with "rootsh" et voilą !

all your commands works !!

IzzehO
2010-08-04, 10:16
if you have installed rootsh 1.8 from extras devel uninstall it and install rootsh 1.5 from extras.

in your qbw widget replace all "sudo" with "rootsh" et voilą !

all your commands works !!

This.

I really hate 1.8 as it has ruined any ability to distribute scripts. While I'm quite comfortable editing my sudoers file... the noob around the corner that is using my script isn't. Unfortunately it's also a pain in the neck to get them to install 1.5.

gft2k1
2010-08-04, 10:21
This.

I really hate 1.8 as it has ruined any ability to distribute scripts. While I'm quite comfortable editing my sudoers file... the noob around the corner that is using my script isn't. Unfortunately it's also a pain in the neck to get them to install 1.5.

i agree with you

AlMehdi
2010-08-04, 11:57
This.

I really hate 1.8 as it has ruined any ability to distribute scripts. While I'm quite comfortable editing my sudoers file... the noob around the corner that is using my script isn't. Unfortunately it's also a pain in the neck to get them to install 1.5.

Just use sudo gainroot and the problem is solved. I prefer v1.8 as i use sudo my self.. but when i want to instruct on something i use sudo gainroot.

IzzehO
2010-08-04, 12:09
Just use sudo gainroot and the problem is solved. I prefer v1.8 as i use sudo my self.. but when i want to instruct on something i use sudo gainroot.

Try:

echo "apt-get -y clean && apt-get -y autoclean && apt-get -y autoremove" | sudo gainroot

Your right, this does work well. Unfortunately there are limitations that mean I have to do a couple work arounds, but it works well enough for what I need: thanks!

Dany-69
2010-08-04, 13:16
Just use sudo gainroot and the problem is solved. I prefer v1.8 as i use sudo my self.. but when i want to instruct on something i use sudo gainroot.

AlMehdi your solution is the best one :)
I do not know how to thank you ;)

But i got a question ..
Why the sudo commnand works with the kernel? :confused:

Only the packages processes aren't set to work with sudo?

ie under what circumstances I am forced to use the form that you just cited and in which a sudo?

And the pipe shouldn't make the sudo gainroot process first? o.O like here:

~ $ dpkg --list |grep "^rc" | cut -d " " -f 3 | xargs dpkg --purge | sudo gainroot
Root shell enabled
dpkg: Requested operation requires superuser privilege

Infact it appears "Root shell enabled" ... why not work if i'm root? o.o

Or why don't work a "dpkg --list | sudo gainroot" ?

EDIT... the command for purge automatically all packages don't work... -.-'''

~ $ echo "dpkg --list |grep "^rc" | cut -d ' ' -f 3 | xargs dpkg --purge" | sudo gainroot
Root shell enabled
dpkg: --purge needs at least one package name argument

Type dpkg --help for help about installing and deinstalling packages ;
Use `dselect' or `aptitude' for user-friendly package management;
Type dpkg -Dhelp for a list of dpkg debug flag values;
Type dpkg --force-help for a list of forcing options;
Type dpkg-deb --help for help about manipulating *.deb files;
Type dpkg --license for copyright license and lack of warranty (GNU GPL) .

Options marked produce a lot of output - pipe it through `less' or `more' !
~ $

AlMehdi
2010-08-04, 15:25
I am not completly sure exactly how it works. Just that "sudo gainroot" is a way to gain root for both 1.5 and 1.8.

Some strings need to use different " ' “ to make it work. I have never needed it for dpkg but you could try:

echo dpkg --list | sudo gainroot

Dany-69
2010-08-04, 15:28
This way it works.. o.O
Mmmmm ... the mistery of the terminal xD
Tnx a lot ;)