Resetting password in Linux Mint when disk is encrypted
This is actually way easier than you might think. Here's how you do it:
Boot into a Live CD.
-
Decrypt and mount your partition on your hard disk. If you have a couple of partitions that all get mounted at boot, you will need to mount all of those, and in the correct order. Note that while you can get away with it this time, usually this includes bind-mounting
/proc
and/dev
into the hard drive mountpoint.I won't go into how to do this, since I forget, but you should be able to find how to online (just search for "mount an encrypted partition linux" or something), or ask a new question here.
-
If you haven't already opened a terminal, open one, and type
chroot /path/to/your/encrypted/drive bash
, where/path/to/your/encrypted/drive
is where you mounted the hard drive partition.chroot
stands for "change root". Root here is referring to the root of your directory tree, not the root account. Basically any program that you run from now on will see the hard drive, not the CD, as the root of the filesystem.bash
at the end tellschroot
what program to run from the new root - so you're runningbash
from your hard drive, not from the CD.bash
will think it's executing from something like/usr/bin/bash
, but in reality it'll be executing from/path/to/your/encrypted/drive/usr/bin/bash
.If my garbled explanation was unreadable, here's the Wikipedia article and the manpage.
Run
passwd
.Type
exit
to get out of the chroot and reboot out of the CD and into your hard drive.Profit.
Related videos on Youtube
NickAldwin
Disclaimer: The man in the picture is not intended to represent NickAldwin's actual appearance. Any similarities between Dr. Strangelove and NickAldwin are completely coincidental.
Updated on September 18, 2022Comments
-
NickAldwin over 1 year
I have a system (VM, actually) with Linux Mint 15 on it. The disk is encrypted, but I remember that password -- just not the password for my account. I've tried changing the command in GRUB from
ro
torw init=/bin/bash
, per guides online, but that doesn't seem to play nicely with the disk encryption. Is there a way to decrypt the disk, then drop straight to a root prompt (in order to usepasswd
)?-
Admin over 10 yearsAre you able to boot off a live CD and mount the drive and go through the encryption authentication that way?
-
NickAldwin over 10 years@50-3 I have a live CD ISO I can run. Can I change the password from there after mounting the drive? If so, how do I do both (mounting and changing password) -- I'm not very familiar.
-
-
NickAldwin over 10 yearsCool. I'll try this out when I can.
-
dribler over 10 yearsLook for
cryptsetup luksOpen
with the correct options for your drive. You probably also have lvm, sovgchange -ay
after the luks volume is mounted since dm-crypt with lvm is the default fde setup for Debian based systems. -
user over 10 yearsActually, for point 2, it should be enough to mount just the root file system, since
passwd
, all the libraries it needs, and /etc/passwd, are all normally squarely within the root file system. -
user2914606 over 10 yearsUnless you had
/etc
separated. Or/usr
(if you're on Arch Linux), although this configuration is buggy as it is. -
NickAldwin over 10 yearsSorry for the delay but I must wait for some non-corrupted RAM before I try this. I'll accept it once I can try it.