Reset root password in Linux

Steps below will show how to reset root password in debian like machines.

1. Boot the machine and enter in GRUB menu.
2. Press e to go in edit mode.
3. Scroll down to the line starting with kernel.
4. Go to the end of the line and press space bar and type linux single.Press space bar again and type init=/bin/bash
5. Press ctrl X to boot.
6. After machine is booted.type below command.
mount -rw -o remount /
7. Type passwd command to change root password.
8. Reboot

Ubuntu, GRUB 2 and serial console

We can configure Ubuntu machine to connect to it via serial console port(COM port).It will help us to administer the machine when there is no input devices(mouse, keyborad) or no network is available.

Enabling serial console has been changed in GRUB 2.Change GRUB_CMDLINE_LINUX to start console on ttyS0.

Open grub configuration file /etc/default/grub.
sudo vim /etc/default/grub

Set below entries to GRUB_CMDLINE_LINUX
GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,38400n8"

Add serial console entries to the same file
## Serial console
GRUB_TERMINAL=serial
GRUB_SERIAL_COMMAND="serial --speed=38400 --unit=0 --word=8 --parity=no --stop=1"

Update GRUB
sudo update-grub

Reboot the machine check if changes were successful.Run the command below.
sudo cat /proc/cmdline

Output:
BOOT_IMAGE=/boot/vmlinuz-3.13.0-24-generic root=UUID=4c4e78f3-fb88-4617-bf9c-34a53e05c7b2 ro console=tty0 console=ttyS0,38400n8 quiet splash vt.handoff=7

console=tty0 console=ttyS0,38400n8 entry confirms that serial console is enabled.