The officially official Devuan Forum!

You are not logged in.

#1 2021-11-29 18:48:16

Élisabeth
Member
From: France
Registered: 2021-09-06
Posts: 117  

[SOLVED] Need to reset root password

Actually, I need creative ideas to work around a keyboard problem, which has locked me out of my laptop:

I spilt water on my keyboard three days ago and the letters b and n are no longer working.

I can't log in now because my username and passwords contain b.
I wanted to log in as root to change those but the root password contains a b too.

I found instructions how to reset the root password on Debian. But this requires  typing init=/bin/bash on grub.

Any ideas for a temporary workaround?

I have no USB keyboard nor friends who have one. I live in the sticks without ready access to shops.

I just need a smart idea.

Offline

#2 2021-11-29 19:41:31

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 3,125  
Website

Re: [SOLVED] Need to reset root password

How about ssh from another machine?


Brianna Ghey — Rest In Power

Offline

#3 2021-11-29 19:47:45

Élisabeth
Member
From: France
Registered: 2021-09-06
Posts: 117  

Re: [SOLVED] Need to reset root password

That's my only machine.

Offline

#4 2021-11-29 19:50:55

PedroReina
Member
From: Madrid, Spain
Registered: 2019-01-13
Posts: 269  
Website

Re: [SOLVED] Need to reset root password

How about having your instalation media still around and using it in rescue mode?

Offline

#5 2021-11-29 19:54:30

Élisabeth
Member
From: France
Registered: 2021-09-06
Posts: 117  

Re: [SOLVED] Need to reset root password

Change to another keyboard layout ?

Offline

#6 2021-11-29 19:56:45

Élisabeth
Member
From: France
Registered: 2021-09-06
Posts: 117  

Re: [SOLVED] Need to reset root password

PedroReina wrote:

How about having your instalation media still around and using it in rescue mode?

Would that enable me to change my username and password?

Offline

#7 2021-11-29 20:48:34

golinux
Administrator
Registered: 2016-11-25
Posts: 3,317  

Re: [SOLVED] Need to reset root password

There is a way to do it from the boot screen by editing the kernel line.  bluesdog has a howto over on the debian forum that I have used but it may be outdated by now.  I would copy some notes that I have here but don't trust their accuracy because I haven't had to do it in years . . .

Offline

#8 2021-11-29 21:05:48

aitor
Member
From: basque country
Registered: 2016-12-03
Posts: 230  
Website

Re: [SOLVED] Need to reset root password

Run a live system and find out the device /dev/sdXY where the root partition (/) of your devuan installation is on. XY are the drive letter and the partition number. If you are not sure which it is, you can run lsblk -o name,mountpoint for that. In my case:

NAME   MOUNTPOINT
sda    
|-sda1 /
|-sda2 
|-sda5 /home
`-sda6 [SWAP]

Mount the partition as root (the root filesystem is usually a ext4 partition):

# mount -t ext4 /dev/sda1 /mnt

Now bind the directories:

# mount -o bind /sys /mnt/sys
# mount -t proc proc /mnt/proc
# mount -o bind /dev /mnt/dev
# mount -o bind /dev/pts /mnt/dev/pts

If you are going to change only root's password, this step is superfluous, but some other tasks might require it. For example, if you want to restore the grub, the above binding will provide access to detect other operating systems.

Chroot the partition:

# chroot /mnt

At this point you can give a new password for root (for example, babylon tongue ):

# passwd
New password: 
Retype new password: 
passwd: password updated successfully

To end with, exit the chrooted system and unmount all the directories:

# exit
# umount /mnt/dev/pts
# umount /mnt/dev
# umount /mnt/proc
# umount /mnt/sys
# umount /mnt

You have just changed root's password.

Last edited by aitor (2021-11-29 21:24:07)


If you work systematically, things will come by itself (Lev D. Landau)

Offline

#9 2021-11-29 21:13:36

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 3,125  
Website

Re: [SOLVED] Need to reset root password

The OP has already explained that the "b" & "n" keys don't work.

Using rescue mode from the Devuan ISO image is the correct solution because that only requires menu inputs to obtain a root shell in the installed system.

aitor wrote:

Now bind the directories

The arch-install-scripts package includes the arch-chroot command which will (bind) mount the API filesystems automagically.


Brianna Ghey — Rest In Power

Offline

#10 2021-11-29 21:22:59

Élisabeth
Member
From: France
Registered: 2021-09-06
Posts: 117  

Re: [SOLVED] Need to reset root password

golinux wrote:

There is a way to do it from the boot screen by editing the kernel line.  bluesdog has a howto over on the debian forum that I have used but it may be outdated by now.  I would copy some notes that I have here but don't trust their accuracy because I haven't had to do it in years . . .

Yes, that's what I tried.
The linux line has to be appended with

init=/bin/bash

I don't have n and b !

Offline

#11 2021-11-29 21:26:51

aitor
Member
From: basque country
Registered: 2016-12-03
Posts: 230  
Website

Re: [SOLVED] Need to reset root password

Élisabeth wrote:
golinux wrote:

There is a way to do it from the boot screen by editing the kernel line.  bluesdog has a howto over on the debian forum that I have used but it may be outdated by now.  I would copy some notes that I have here but don't trust their accuracy because I haven't had to do it in years . . .

Yes, that's what I tried.
The linux line has to be appended with

init=/bin/bash

I don't have n and b !

In a live system you can copy and paste them from anywhere.


If you work systematically, things will come by itself (Lev D. Landau)

Offline

#12 2021-11-29 21:33:17

aitor
Member
From: basque country
Registered: 2016-12-03
Posts: 230  
Website

Re: [SOLVED] Need to reset root password

aitor wrote:

Now bind the directories

You are right, but the mistake was below, at the end of the post:

To end with, exit the chrooted system and unmount all the partitions:

Fixed it. Thanks smile


If you work systematically, things will come by itself (Lev D. Landau)

Offline

#13 2021-11-29 21:40:48

aitor
Member
From: basque country
Registered: 2016-12-03
Posts: 230  
Website

Re: [SOLVED] Need to reset root password

aitor wrote:
aitor wrote:

Now bind the directories

You are right, but the mistake was below, at the end of the post:

To end with, exit the chrooted system and unmount all the partitions:

Fixed it. Thanks smile

Head_on_a_stick: i misunderstood you, you were quoting the phrase in reference to the arch-install-scripts package. Well..., fixed anyway. They are directories.


If you work systematically, things will come by itself (Lev D. Landau)

Offline

#14 2021-11-29 22:56:27

ralph.ronnquist
Administrator
From: Battery Point, Tasmania, AUS
Registered: 2016-11-30
Posts: 1,251  

Re: [SOLVED] Need to reset root password

Yes, as said,  if you have a Devuan ISO (any of them), then its "Advanced -> Rescue" option is the way to go; it'll bring you all the way into a root login within your root file system without needing working b or n.

Once there, you use the command "passwd" to set a new root password.

Thereafter you have to figure out how to deal with that the username has a b. Perhaps create a new user, or perhaps work out how to remap some keypad keys (or other keys) to be b and n.

Offline

#15 2021-11-30 07:07:56

Élisabeth
Member
From: France
Registered: 2021-09-06
Posts: 117  

Re: [SOLVED] Need to reset root password

aitor wrote:

In a live system you can copy and paste them from anywhere.

I have a Devuan installation ISO, not live. (I wish I knew where I put it.)
And I think I have a Debian live.

I think a new keyboard is inevitable. If it hasn't dried after three days I don't hold out much hope.

But I'm looking for this interim solution because finding the right one for this laptop might take a bit - a backlit french AZERTY.

Offline

#16 2021-11-30 08:46:27

ralph.ronnquist
Administrator
From: Battery Point, Tasmania, AUS
Registered: 2016-11-30
Posts: 1,251  

Re: [SOLVED] Need to reset root password

I have a Devuan installation ISO, not live. (I wish I knew where I put it.)

Yes, that one you can start into "rescue"; just make sure you stop before partitioning.

And I think I have a Debian live.

A Debian live should also work if you can operate that without the broken keys; if you get a root prompt in a terminal, you might be able to do

# mkdir /A
# mou<TAB> /dev/sda1 /A
# chroot /A $(which passwd)

and then reboot into that system.
If the mou<TAB> is ambiguous a double <TAB> will yield the options for you to copy and paste from.
Note that maybe your root file system is not on /dev/sda1 of course .. you'll find out.

Offline

#17 2021-11-30 11:41:47

rolfie
Member
Registered: 2017-11-25
Posts: 1,172  

Re: [SOLVED] Need to reset root password

Chimaera: On my lightdm login screen I have a small icon in the middle of the bottom that opens a screen keyboard that can be operated with the mouse. Maybe that helps.

rolfie

Offline

#18 2021-11-30 12:32:43

hevidevi
Member
Registered: 2021-09-17
Posts: 230  

Re: [SOLVED] Need to reset root password

you dont need to use init=/bin/bash just put a number 1 where that is supposed to go at the end of the kernel parameter and press F10 to boot. This brings you into maintenance mode or single user mode. But it still doesn't solve your issue of the b key not working. Definitely seems like you need a live session as has been mentioned previously.

Offline

#19 2021-11-30 21:00:52

Altoid
Member
Registered: 2017-05-07
Posts: 1,581  

Re: [SOLVED] Need to reset root password

Hello:

Head_on_a_Stick wrote:

How about ssh from another machine?

Élisabeth wrote:

That's my only machine.

I'm sorry, maybe I've missed something.

Couldn't you try to ssh from the machine you are writing from now?
I am obviously assuming that it is not your laptop and that whatever machine you are using to post has an available ethernet port you can access.

Best,

A.

Last edited by Altoid (2021-11-30 21:04:09)

Offline

#20 2021-11-30 21:14:03

Élisabeth
Member
From: France
Registered: 2021-09-06
Posts: 117  

Re: [SOLVED] Need to reset root password

Altoid wrote:
Head_on_a_Stick wrote:

How about ssh from another machine?

Élisabeth wrote:

That's my only machine.

Couldn't you try to ssh from the machine you are writing from now?.

I'm typing on my mobile phone. And it's a pain in the back.

Offline

#21 2021-11-30 21:25:14

Élisabeth
Member
From: France
Registered: 2021-09-06
Posts: 117  

Re: [SOLVED] Need to reset root password

I never found my Devuan USB and didn't get anywhere with the Debian USB installation stick.

But I got into single user mode via the boot screen.
I managed to type

 init=/bin/bash

by copying and pasting the broken letters with Emacs commands. wink

Now I'm struggling to autocomplete the mount command because there are several in /bin and /sbin

It also thinks I have a QUERTY keyboard but I roughly remember where the keys are.

Offline

#22 2021-11-30 21:25:31

Altoid
Member
Registered: 2017-05-07
Posts: 1,581  

Re: [SOLVED] Need to reset root password

Hello:

Élisabeth wrote:

... on my mobile phone.

I see.

Don't have one of those so it did not ocurr to me.
I use an old Blackberry 9320.  8^ )

Élisabeth wrote:

And it's a pain in the back.

Yes.
I can relate to that.
Is it an android device?

Best,

A.

Offline

#23 2021-11-30 21:47:50

Élisabeth
Member
From: France
Registered: 2021-09-06
Posts: 117  

Re: [SOLVED] Need to reset root password

I can type the mount command

/?i?/mou?t /de?/sda2 /m?t

The v is broken now too.

I'm getting the warning that the source is write protected and mounted read only.

Offline

#24 2021-11-30 21:49:05

ralph.ronnquist
Administrator
From: Battery Point, Tasmania, AUS
Registered: 2016-11-30
Posts: 1,251  

Re: [SOLVED] Need to reset root password

How about using backquote with echo to make use of globbing, e.g.

# `echo /?i?/mou?t` /dev/sda1 /A

EDIT: actually might not need backquoting even:

# /?i?/mou?t /dev/sda1 /A

Offline

#25 2021-11-30 21:55:11

Élisabeth
Member
From: France
Registered: 2021-09-06
Posts: 117  

Re: [SOLVED] Need to reset root password

Altoid wrote:

Is it an android device?

Yes, no Apple or Windows in this house.

But as per my previous post, I got into single user mode.

Offline

Board footer