You are not logged in.

#1 2020-12-09 00:39:43

LucasBiazi
Member
Registered: 2020-11-11
Posts: 111

[SOLVED] Can't sudo, can't su

I did some stupid things by accident regarding chown, and now I'm locked on CRTL + ALT + F2, no DE. However, I've got a peep of light. I have timeshift installed, hence a backup from some days ago. However, in order to execute timeshift --restore, I need to do it as sudo, currently impossible. Whenever I try to run it, I get:

sudo
/etc/sudo.conf is owned by uid 1000, should be 0
/usr/bin/sudo must be owned by uid 0 and have the setuid bit set

When trying su...

su
# password input
su: cannot set groups operation not permitted

I have some important files in my storage, so I don't want to re-install everything, any suggestion is appreciated, thanks in advance!

PS: I'm posting it from other pc.


————————————————
Solution:
Booted from an Ubuntu live CD, open terminal, go chroot:

sudo mkdir /mnt/name
cd /mnt/name #name does not matter, type anything 
sudo mount /dev/yourdrive /mnt/name
sudo chroot /mnt/name /bin/bash

Warning: instead of ‘yourdrive’ put the correct path, which will vary depending on your specs.
Tip: If you are also on an Ubuntu live, go to the application Disk, and copy the path from there.

Once you’re in chroot, change the permissions using chown root:root path. Before trying to boot again, try to sudo and fix the remaining issues.

This should fix the issue. 

Ps: sorry if there is a formation error here and there, I’m posting it from a phone.

Last edited by LucasBiazi (2020-12-09 18:41:11)


Always backup important files when editing it.

Offline

#2 2020-12-09 01:11:11

kermit63
Member
Registered: 2018-07-04
Posts: 174

Re: [SOLVED] Can't sudo, can't su

You can restore timeshift backups from another system running timeshift. It can be another installed system that can access the borked installation or by using live media, as long as timeshift is running on it.

You ought to read the timeshift documentation if you are going to rely on it, especially the part about system restore.

Offline

#3 2020-12-09 02:50:11

LucasBiazi
Member
Registered: 2020-11-11
Posts: 111

Re: [SOLVED] Can't sudo, can't su

kermit63 wrote:

You can restore timeshift backups from another system running timeshift. It can be another installed system that can access the borked installation or by using live media, as long as timeshift is running on it.

You ought to read the timeshift documentation if you are going to rely on it, especially the part about system restore.

Did it, still the same error...

If I had to re-install arch, could I still save my files?

Last edited by LucasBiazi (2020-12-09 02:57:41)


Always backup important files when editing it.

Offline

#4 2020-12-09 02:54:37

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,222
Website

Re: [SOLVED] Can't sudo, can't su

Boot the install media, chroot, and fix the permissions / run timeshift.

Offline

#5 2020-12-09 03:23:38

LucasBiazi
Member
Registered: 2020-11-11
Posts: 111

Re: [SOLVED] Can't sudo, can't su

fukawi2 wrote:

Boot the install media, chroot, and fix the permissions / run timeshift.

When I'm on the chroot, I tried:

sudo chown root:root /etc/sudo.conf
sudo: /etc/sudo.conf is owned by uid 1000, should be 0
sudo: /etc/sudo.conf is owned by uid 1000, should be 0
sudo: error in /etc/sudo.conf, line 0 while loading plugin "sudoers_policy"
sudo: fatal error, unable to load plugins

Plus, for some reason, now I can only type in the GNOME finder... I'm currently typing there, CTRL + C and then CTRL + V...


Always backup important files when editing it.

Offline

#6 2020-12-09 03:24:34

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,543

Re: [SOLVED] Can't sudo, can't su

Why are you using sudo in that case?

Offline

#7 2020-12-09 03:29:49

LucasBiazi
Member
Registered: 2020-11-11
Posts: 111

Re: [SOLVED] Can't sudo, can't su

Scimmia wrote:

Why are you using sudo in that case?

Haven't even realized that, sorry, I'll keep trying the last suggested solution now that I could use chown...


Always backup important files when editing it.

Offline

#8 2020-12-09 03:55:12

LucasBiazi
Member
Registered: 2020-11-11
Posts: 111

Re: [SOLVED] Can't sudo, can't su

I did as fukawi2 said, but I'm still getting the same error after trying to boot on arch.


Always backup important files when editing it.

Offline

#9 2020-12-09 04:20:39

RoundCube
Member
Registered: 2016-05-14
Posts: 42

Re: [SOLVED] Can't sudo, can't su

Hmmm … I see the path is /etc/sudo.conf

If you do this in a chroot from the live media, well, then you use also the chroot's sudo, not the one from the live media. And that one is borked.

Should be something like su -c "
chown root:root /mnt/etc/sudo.conf
"

Offline

#10 2020-12-09 05:59:06

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,494

Re: [SOLVED] Can't sudo, can't su

'sudo.conf' is just a file so back it up as sudo.conf.bak then touch a new one and cat the content to it & remove the bak file. Done;)

mv /etc/sudo.conf /etc/sudo.conf.bak
touch /etc/sudo.conf
cat /etc/sudo.conf.bak > /etc/sudo.conf

Offline

#11 2020-12-09 18:17:59

LucasBiazi
Member
Registered: 2020-11-11
Posts: 111

Re: [SOLVED] Can't sudo, can't su

I, apparently, solved the sudo issue. However, when I try to boot, no DE shows up. Right before the loading, I see “Bluetooth service: failed”, and then no DE shows up. I tried to use timeshift in all my snapshots, none of them worked out. I guess this installation is thrashed to hell already. Maybe I should just install it all again?


Always backup important files when editing it.

Offline

#12 2020-12-09 18:31:39

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,494

Re: [SOLVED] Can't sudo, can't su

I'm not a timeshift user and can't comment on that, but, if your sudo issue is solved, please mark this thread 'solved'.
It's also appreciated if you tell/explain which solution you used to solve the issue.
For all your further Q. open a new one, preferably one item per thread, thanks.

Offline

#13 2020-12-09 18:32:46

LucasBiazi
Member
Registered: 2020-11-11
Posts: 111

Re: [SOLVED] Can't sudo, can't su

Sure, I’ll update the OP, and close the thread. Thank you all!


Always backup important files when editing it.

Offline

#14 2020-12-09 20:50:12

seth
Member
Registered: 2012-09-03
Posts: 50,983

Re: [SOLVED] Can't sudo, can't su

Because of the context: you don't backup onto a non-posix filesystem (like vfat), do yo?

Offline

Board footer

Powered by FluxBB