Forum
Strange issue: sudo: effective uid is not 0, is sudo installed setuid root? - Printable Version

+- Forum (http://forum.xbian.org)
+-- Forum: Software (/forum-6.html)
+--- Forum: Installation (/forum-16.html)
+--- Thread: Strange issue: sudo: effective uid is not 0, is sudo installed setuid root? (/thread-1835.html)

Pages: 1 2 3


RE: Strange issue: sudo: effective uid is not 0, is sudo installed setuid root? - mk01 - 21st Dec, 2013 08:50 AM

do it in Windows, Linux, any other system

… that's why we are booting directly to bash. to go around non-active root account.


RE: Strange issue: sudo: effective uid is not 0, is sudo installed setuid root? - Xenon - 21st Dec, 2013 04:59 PM

(21st Dec, 2013 07:11 AM)mk01 Wrote:  edit /boot/cmdline.txt and add "init=/bin/bash" at the end of line
reboot
xbian will boot directly into command prompt with root privileges
run commands:
Code:
for f in bin etc lib media mnt opt root sbin usr var xbmc-backup; do chown -R root $f; done
chown root:root /home
chown syslog /var/log/*
chown -R man /var/cache/man
chown -R xbian:xbian /usr/local/share/xbmc/addons/plugin.xbianconfig
chmod 4755 /usr/bin/sudo

then update cmdline.txt again - just revert to previous content (remove init=/bin/bash)
after restart

Code:
sudo dpkg-reconfigure -a

Good morning mk01,
the procedure was fine good and xbian is back again.
I was not able to change the owner to /usr/local/share/xbmc/addons/plugin.xbianconfig because the file was not present, but I guess is not important.

Said that, do you have any idea about the root cause?

Thank you


RE: Strange issue: sudo: effective uid is not 0, is sudo installed setuid root? - mk01 - 21st Dec, 2013 05:19 PM

@Xenon

plugin.xbianconfig error (files missing) is ok: new version of package has files at /usr, older still at /home. within /home xbian:xbian ownership is desired. it was listed just in case you would have -dev version installed already.

glad to hear that it was ok. reason is clear, mistyped "sudo chown -R xbian /" instead of (./). normally I would say user error (and with this definition "user error" I also include any 3rd party addons/scripts with bug) but easily could be programmer error with such typo in official package's install/maintenance scripts.

I remember I was already checking all scripts for XBian's regular packages - all "chown" calls one by one. generaly we use chown xbian:xbian in XBian's scripts (user and also group would have been changed) and on your XBian just user as owner was changed.

what we can do is just wait if this happens again, please let me know. I will look into your XBian then or ask for some specific logs. otherwise there is not much to do now. so stay in touch !


RE: Strange issue: sudo: effective uid is not 0, is sudo installed setuid root? - Xenon - 21st Dec, 2013 11:29 PM

Hi MK01,

it happens again, the only activity was system update (apt-get update && apt-get upgrade) that was ok.

If needed dpkg.log here: http://pastebin.com/fAa7iD92
source.list: http://pastebin.com/60JiSkme

Even I've again this problem XBMC and actually all system is stable and working (trasmission is working as well as playing movie) while when I had the issue before XBMC quit after few minutes of activity.

If I try to be root, I've set password after having the system working, I have this error:

Code:
xbian@xbian /var/log $ su -
Password:
setgid: Operation not permitted

Cheers


RE: Strange issue: sudo: effective uid is not 0, is sudo installed setuid root? - mk01 - 22nd Dec, 2013 12:03 AM

the error will be again caused by setuid bit but non-root ownership.

i will check the packages there in log. in between, can you post this more:

Code:
find /home -type l
find /media -type l



RE: Strange issue: sudo: effective uid is not 0, is sudo installed setuid root? - Xenon - 22nd Dec, 2013 02:44 AM

(22nd Dec, 2013 12:03 AM)mk01 Wrote:  the error will be again caused by setuid bit but non-root ownership.

i will check the packages there in log. in between, can you post this more:

Code:
find /home -type l
find /media -type l

Now I had to change again the HD with NTFS one, long story.
So, using this NTFS (the previous one was extFAT) disk XBMC close (crash???) after few minutes from the boot. This behavious is the same I had when I reopen the post and also in that case I was using NTFS disk (another one). I suspect then this issue with NTFS filesystem make the entire system more unstable.

Back with you request:

Code:
xbian@xbian ~ $ find /home -type l
/home/xbian/incomplete
/home/xbian/torrents
/home/xbian/downloads
xbian@xbian ~ $ find /media -type l
/media/usb0

Code:
xbian@xbian ~ $ ls -la /media/
total 28
drwxr-xr-x 1 xbian root     16 Dec 21 17:29 .
drwxr-xr-x 1 xbian root    184 Nov  1 20:44 ..
drwxrwxrwx 1 xbian xbian 24576 Dec 21 17:31 Dati
lrwxrwxrwx 1 xbian root     11 Dec 21 17:29 usb0 -> /media/Dati

Code:
...
lrwxrwxrwx 1 xbian xbian   22 Dec 21 09:51 downloads -> /media/Dati/downloads/
lrwxrwxrwx 1 xbian xbian   23 Dec 21 09:51 incomplete -> /media/Dati/incomplete/
lrwxrwxrwx 1 xbian xbian   21 Dec 21 09:51 torrents -> /media/Dati/torrents/
...



RE: Strange issue: sudo: effective uid is not 0, is sudo installed setuid root? - mk01 - 22nd Dec, 2013 02:54 AM

I checked the two xbian packages and there is no ugly chown. -config-shell is doing chown twice on file, no directory, without -R (descent into hierarchy) and is doing xbian:xbian - so setting group as well.

will think about it


RE: Strange issue: sudo: effective uid is not 0, is sudo installed setuid root? - rbellamy - 22nd Dec, 2013 05:29 AM

In
Code:
for f in bin etc lib media mnt opt root sbin usr var xbmc-backup; do chown -R root $f; done
Why not:
Code:
chown -R root:root



RE: Strange issue: sudo: effective uid is not 0, is sudo installed setuid root? - mk01 - 22nd Dec, 2013 05:44 AM

because group wasn't changed by the headphone startup script.


RE: Strange issue: sudo: effective uid is not 0, is sudo installed setuid root? - rbellamy - 22nd Dec, 2013 09:12 AM

(22nd Dec, 2013 05:44 AM)mk01 Wrote:  because group wasn't changed by the headphone startup script.

That seems to be the case, but things still seem strange... take another look at my root perms, you can clearly see that they have the root:xbian ownership, which isn't correct - or is that correct?


RE: Strange issue: sudo: effective uid is not 0, is sudo installed setuid root? - mk01 - 22nd Dec, 2013 10:06 AM

if you mean there http://forum.xbian.org/thread-1922-post-19065.html#pid19065

then looks perfeclty ok for me (ok, beside the xbian uid as owner).


RE: Strange issue: sudo: effective uid is not 0, is sudo installed setuid root? - rbellamy - 22nd Dec, 2013 10:12 AM

(22nd Dec, 2013 10:06 AM)mk01 Wrote:  (ok, beside the xbian uid as owner).

You mean "xbian gid as owner", yeah?

That's exactly what I'm talking about - xbian shouldn't own those folders, either as user or group, and the fact that that gid is the owner of those directories leads me to think maybe some other process did something similar to the headphones startup script? Otherwise, how did that happen?

@Xenon and @d4m4s74 - what about you're perms of the top level root folders? What is the gid of the owner?


RE: Strange issue: sudo: effective uid is not 0, is sudo installed setuid root? - mk01 - 22nd Dec, 2013 11:22 AM

no, i mean uid. the listing is

UID : GID

xbian : root is user xbian group root. that is in line with the headphones (chown -R xbian = change user only, leave group as is).


RE: Strange issue: sudo: effective uid is not 0, is sudo installed setuid root? - rbellamy - 22nd Dec, 2013 12:02 PM

(22nd Dec, 2013 11:22 AM)mk01 Wrote:  no, i mean uid. the listing is

UID : GID

xbian : root is user xbian group root. that is in line with the headphones (chown -R xbian = change user only, leave group as is).

Oh, duh, I should have looked more closely... I transposed those.

What do you think of using root:root when resetting the perms?


RE: Strange issue: sudo: effective uid is not 0, is sudo installed setuid root? - mk01 - 22nd Dec, 2013 12:26 PM

there are many services / daemons running with different groups (input / video / rsyslog) where access should be restricted - owner is in general root, but service / daemon write access is managed through group.

you would break these. and again, the headphones startup script was changing just the user.

Code:
find / -xdev -type f -print0 | xargs -0 stat --printf="%U %n\n" | grep -v '^root\ '

output is there (all files with non-root uid ownership) http://pastebin.com/hmTBBwTN

system was Raspbian, with XBian .deb packages installed