0

I have the following problem:

I have a laptop with Ubuntu-Server 18.04.4 LTS but haven't used it for nearly a year now, so I forgot a lot of stuff and also my username and password(I guess trial and error will work)for login.

I googled the problem and found I need to go into GRUB recovery menu but my laptop uses my standard boot menu, or at least there are no signs of grub being installed. I installed a new live image of Ubuntu on a USB-Stick and started my laptop but I can't click on "recovery mode" only choose the language at the beginning.

I have found a terminal under help and also reset my password trough it for the user name found but I think it's not the right username because it didn't work

P.S. I have no dual boot

  • When it boots, are you presented with a login screen? Do you know the server boots? – DankyNanky Sep 08 '20 at 08:57
  • Furthermore, if you can get to a root shell, can you cat /etc/passwd for the user account? If you ran passwd $user and it didn't error out, you reset a password for a valid user. – DankyNanky Sep 08 '20 at 08:58

1 Answers1

1

I would assume that your computer is using grub, as it is the default bootloader for Ubuntu. But, if it's not, or you can't use recovery mode for some other reason, try this. Boot off of the live flash drive, and select "Try Ubuntu" instead of install. Mount your usual boot volume to /mnt/main, or any other mount point. Use

less /mnt/main/etc/passwd

to show a list of users. Find your username, and exit less.

Then run

sudo chroot /mnt/main

This will effectively put you in a shell on your usual boot volume. From there, you can run

passwd username

and enter a new password. Exit the chrooted shell, and reboot without the flash drive. Login using the username found in /etc/passwd and the password you chose previously.

  • FYI I wrote a Q&A here a few years earlier than your link: https://askubuntu.com/questions/1029040/how-to-manually-mount-a-partition I think my Q&A is simpler than your link for Ubuntu users but perhaps not as in-depth for fringe cases. Can I get your opinion? Also to get a list of users you could use: ls /mnt/main/home – WinEunuuchs2Unix Jul 07 '21 at 00:32
  • @WinEunuuchs2Unix I edited to link to your Q instead. As for the last bit, technically that wouldn't work if the user had their home folder set elsewhere, while it would always be in /etc/passwd – Pixelated Fish Jul 07 '21 at 04:24