Score:0

Enter recovery mode in headless ubuntu setup?

cn flag

I know, there are lots of posts about this to enter recovery mode etc. But I have a raspberry running headless ubuntu server, and sadly I have no keyboard or monitor to connect to it.

So what I did is:

sudo chmod 777 /usr -R

and now I face:

sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set

Is wiping my server the best option if I don't want to run out and buy a monitor and micro HDMI cable? I could get a keyboard from work, but if I can't see what's going on, I wonder if that would work.

So I have physical access, I just don't have the hardware to get into recovery mode as I understand it.

guiverc avatar
cn flag
You didn't provide release details; but I'd likely remove the media & correct using another system (though you'll need a *like* system to get the file stat/attributes from; or backup of what was in that directory - as whilst most files have similar file attributes; not all will).
Artur Meinild avatar
vn flag
As you have figured out, it's dangerous to change permission on system files. Also, see my answer regarding KVM access.
viktor spett avatar
cn flag
Well, yes, I have a long way to go with Linux :) Thank you for the idea to remove and correct the media @guiverc, but I don't have a backup or any "like system". While I don't understand how I would correct it, I guess it won't matter. Or would it help if I took out the micro ssd plugged it in my Laptop and edited the files in nautilus?
guiverc avatar
cn flag
Editing the files would change the contents of the file; that's not what you did - you changed the file attributes/stats using the `chmod` command; you need to return the 777 (1+2+4) back for each file to what it was... that value is what I'd have got from your backups, or a *like* system.
viktor spett avatar
cn flag
I see, well then it's settled, I will just start from scratch tonight. To be honest It's nothing much, just a Plex and SMB server with home assistant basically. Would you recommend going with 21.10, now that I have the chance? (I am currently on 21.04)
Score:2
vn flag

If you want to be able to enter BIOS/UEFI, Boot menu, Recovery mode, or other "special" modes on a headless server, you need to have some kind of virtual KVM (keyboard, video, mouse) connection.

Most "real" servers have an IPMI interface with a management LAN port that provides this access, however a Raspberry Pi does not have this feature, so here you need something even more special.

One option is to configure another Pi as a IP-KVM, like this. Jeff Geerling also has a video about this.

If you don't have a IP-KVM device, you need a physical keyboard, video and mouse to do anything outside a remote connection on a running OS (like SSH, VNC etc.).

viktor spett avatar
cn flag
Thank you for the idea with a virtual KVM, unfortunately I only own one Pi :)
Artur Meinild avatar
vn flag
Yes, then unfortunately you're out of luck with accessing the system without a keyboard and monitor.
viktor spett avatar
cn flag
All right, once again, thank you for your fast replies!
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.