Brand new to Ubuntu - can't get into recovery mode
Solution 1
You can boot a LiveCD from CD/USB, mount Ubuntu and chroot
into it.
After booting the LiveCD open a Terminal and type sudo fdisk -l /dev/sda
. This will show you which partitions are in use:
$ sudo fdisk -l /dev/sda
Disk /dev/sda: 17.5 GB, 17515986944 bytes
255 heads, 63 sectors/track, 2129 cylinders, total 34210912 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0004634f
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 31082495 15540224 83 Linux
/dev/sda2 31084542 34209791 1562625 5 Extended
/dev/sda5 31084544 34209791 1562624 82 Linux swap / Solaris
You need to find that line which is has Linux
in the last column. In this case /dev/sda1
is your root partition. If you've more than one line with System Linux
you'll have to try out
$ sudo mount /dev/sdaX /mnt #where sdaX is your root partition
$ ls /mnt
bin dev home media proc sbin tmp var
boot etc lib opt root sys usr
The output of ls /mnt
should look like this or you've choose the wrong partition. If so unmount it with sudo umount /mnt
and try again. If you found the correct root partition proceed with:
$ sudo mount --bind /dev /mnt/dev
$ sudo mount --bind /proc /mnt/proc
$ sudo mount --bind /sys /mnt/sys
$ sudo chroot /mnt
$ passwd YOUR_USER_NAME
After setting a new password type:
$ exit
$ sudo umount /mnt/dev
$ sudo umount /mnt/proc
$ sudo umount /mnt/sys
$ sudo umount /mnt
$ sudo reboot
Solution 2
If you press the Insert, F2, or + key, rEFInd will show a menu that may hold additional options, depending on the OS type.
From the options submenu, you can press the Insert, F2, or + key again to edit your boot loader options.
A simple text-mode line editor opens, enabling you to move a cursor back and forth in the line with your arrow keys, delete text, and type in new text. If you want to boot with your edited options, press the Enter key.
Source
Find the kernel line starts with /boot/vmlinux
and add init="/bin/bash"
at the end of the line to boot into root mode and change your password.
Source
Related videos on Youtube
Woody
Updated on September 18, 2022Comments
-
Woody over 1 year
After a mistake, I changed my password but can't remember it now.
I've found out that you can reset it by going into recovery mode, but I can't seem to get there! I have Ubuntu 14.04.2 running alongside OS X Yosemite on my MacBook Pro.
I have the
rEFInd
boot manager installed, but I can delete it. I've tried holdingShift
while booting any of the three (?) options to boot Ubuntu, and tried holdingC
as well.Whatever I do, I can't seem to get into recovery mode.
Here are the three options I get in
rEFInd
, as well as OS X:- Boot boot\vmlinux-3.16.0-41-generic from 14GiB ext4 volume
- Boot boot\vmlinux-3.16.0-30-generic from 14GiB ext4 volume
- Boot Linux from whole disk volume
Can anyone help me please? Bear in mind I can't run any sudo commands as I can't remember my password.
-
Woody almost 9 yearsI can't find the line you're asking me to look at. In the rEFInd line editor, all I get in the first two options I listed is: ro root=UUID=lotsofnumbers initrd=boot\initrd.img-3.16.0-41-generic. With the third option, there is nothing there. I get a kernel panic if I change anything.
-
Woody almost 9 yearsOkay I'm on a LiveUSB now. What do I put on the first line again? Very newbie question, but where is my root partition? I have two root folders in front of me, one on the "Computer" (which I assume is the USB) and one on my 15GB Ubuntu Partition.
-
Oleksandr Shmyrko almost 9 years@Woody I updated the answer
-
Woody almost 9 yearsThat's fantastic, a really helpful guide! You've really saved a lot of important information of mine.
-
Oleksandr Shmyrko almost 9 years@Woody I'm glad I could help. Please consider marking this as your accept answer by clicking on the grey checkmark
-
Rod Smith almost 9 yearsIn the rEFInd boot-options editor, the only line is what kyodake refers to as "the kernel line," but it omits
/boot/vmlinux
. Just addinit="/bin/bash"
to the options.