Linux rescues
Rescue shell for Linux
If you forgot the password for your Ubuntu system you can recover using the following steps:
- Turn your computer on
- Press ESC at the GRUB prompt
- Press e for edit
- Highlight the line that starts with
kernel
orlinux
and press e - Go to the very end of the line and append :
rw init=/bin/bash
- Press Enter, then press b to boot your system. Your system will boot up now to a passwordless root shell
- Now issue the command passwd username *where "username" is the user for which you want to change the password. Then you will be asked to give new password:
Enter new UNIX password:
Source : https://askubuntu.com/questions/24006/how-do-i-reset-a-lost-administrative-password/165248#165248
Reset language and keyboard
sudo vi /mnt/etc/default/keyboard
dpkg-reconfigure locales
dpkg-reconfigure tzdata
dpkg-reconfigure keyboard-configuration
dpkg-reconfigure console-setup
https://rs1.es/tutorials/2021/11/12/useful-dpkg-reconfigure-commands.html
Mount LUKS from Live system
- Install required packages using the following commands:
sudo apt-get update
sudo apt-get install lvm2 cryptsetup
- Probe required module using the following command:
sudo modprobe dm-crypt
- You find out which drive it was with the following command:
sudo fdisk -l
- You must mount /dev/sda3 myvolume , You need to use cryptsetup:
sudo cryptsetup luksOpen /dev/sde3 myvolume
- Now the device is accessible under /dev/mapper/myvolume
- Scan for LVM volumes and choose the right volume group name that you are looking for:
sudo vgscan
- Suppose it is system, activate that volume:
sudo vgchange -ay system
- To find out your root volume, use the following command:
sudo lvs
- Suppose it is root system you can mount it with the following command:
sudo mount /dev/system/root /mnt/
- To work in volume use the following commands
sudo mount --bind /dev /mnt/dev
sudo mount --bind /dev/pts /mnt/dev/pts
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys
sudo chroot /mnt
Source : https://askubuntu.com/questions/653408/mounting-encrypted-luks-partition-from-live-cd