Active Topics

 



Notices


Reply
Thread Tools
Posts: 326 | Thanked: 335 times | Joined on Feb 2010
#1
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:

Code:
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 .. :

Code:
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

Code:
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 ..

Code:
~ $ 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 ...

Last edited by Dany-69; 2010-08-04 at 02:39.
 
Posts: 755 | Thanked: 406 times | Joined on Feb 2008 @ UK
#2
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.
 

The Following User Says Thank You to codeMonkey For This Useful Post:
Posts: 134 | Thanked: 91 times | Joined on Nov 2009 @ Imperial College London
#3
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

Last edited by Big Phat Jan; 2010-08-04 at 08:49.
 

The Following User Says Thank You to Big Phat Jan For This Useful Post:
Posts: 1,751 | Thanked: 844 times | Joined on Feb 2010 @ Sweden
#4
Try:

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

The Following 2 Users Say Thank You to AlMehdi For This Useful Post:
Posts: 101 | Thanked: 30 times | Joined on Jul 2010
#5
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 !!
 

The Following 2 Users Say Thank You to gft2k1 For This Useful Post:
Posts: 557 | Thanked: 370 times | Joined on Apr 2010
#6
Originally Posted by gft2k1 View Post
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.
 

The Following 2 Users Say Thank You to IzzehO For This Useful Post:
Posts: 101 | Thanked: 30 times | Joined on Jul 2010
#7
Originally Posted by IzzehO View Post
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
 

The Following User Says Thank You to gft2k1 For This Useful Post:
Posts: 1,751 | Thanked: 844 times | Joined on Feb 2010 @ Sweden
#8
Originally Posted by IzzehO View Post
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.
 

The Following User Says Thank You to AlMehdi For This Useful Post:
Posts: 557 | Thanked: 370 times | Joined on Apr 2010
#9
Originally Posted by AlMehdi View Post
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.
Originally Posted by AlMehdi View Post
Try:

Code:
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!
 

The Following User Says Thank You to IzzehO For This Useful Post:
Posts: 326 | Thanked: 335 times | Joined on Feb 2010
#10
Originally Posted by AlMehdi View Post
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?

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:

Code:
~ $ 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... -.-'''

Code:
~ $ 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' ! 
~ $

Last edited by Dany-69; 2010-08-04 at 15:19.
 
Reply


 
Forum Jump


All times are GMT. The time now is 15:58.