Skip to content

Rebooting an OVH VPS in rescue mode to repair it

Christophe TREMBLAY-GUILLOUX
Christophe TREMBLAY-GUILLOUXLinux systems engineer

1. Go to the OVHcloud control panel and to the screen that reboots the VPS in rescue mode

Section titled “1. Go to the OVHcloud control panel and to the screen that reboots the VPS in rescue mode”

OVHcloud rescue mode screen

After a few minutes, an e-mail arrives with the login (root) and the password of the rescue system (unless you registered your SSH key somewhere in the manager): Rescue mode e-mail

Careful, the login in rescue mode is root!

2.1 First attempt from the console of your Linux PC (or other exotic system)

Section titled “2.1 First attempt from the console of your Linux PC (or other exotic system)”
bash
ssh root@vps-xxxxxxx.vps.ovh.net

You get:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:aHD6pBYP1zHxxxxxxx7hp4KwI4yl5gr5OVmBJZ/ZBE.
Please contact your system administrator.
Add correct host key in /home/kiwiof09/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /home/coin/.ssh/known_hosts:75
remove with:
ssh-keygen -f "/home/coin/.ssh/known_hosts" -R "vps-xxxxxxx.vps.ovh.net"
ECDSA host key for vps-xxxxxxx.vps.ovh.net has changed and you have requested strict checking.
Host key verification failed.

2.2 On your workstation, remove the host key fingerprints of the server

Section titled “2.2 On your workstation, remove the host key fingerprints of the server”
bash
ssh-keygen -f "/home/coin/.ssh/known_hosts" -R "vps-xxxxxxx.vps.ovh.net"
ssh-keygen -f "/home/coin/.ssh/known_hosts" -R "51.38.yyy.yyy"
ssh-keygen -f "/home/coin/.ssh/known_hosts" -R "2001:xxxx:xxx:xxxx::xxxx"
bash
ssh root@vps-xxxxxxx.vps.ovh.net

You get:

The authenticity of host 'vps-xxxxxxx.vps.ovh.net (51.38.xxx.xxx)' can't be established.
ECDSA key fingerprint is SHA256:aHD6pBYP1zxxxxxxxKwI4yl5gr5OVmBJZ/ZBE.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'vps-xxxxxxx.vps.ovh.net,51.38.xxx.xxx' (ECDSA) to the list of known hosts.
root@vps-xxxxxxx.vps.ovh.net's password:
Linux vps-xxxxxxx 4.9.0-11-amd64 #1 SMP Debian 4.9.189-3+deb9u2 (2019-11-11) x86_64
GNU/Linux, to the rescue!
Server: vps-xxxxxxx
Login: root
Password: azezeazeaeazezae
root@vps-xxxxxxx:~#
bash
lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 2.5G 0 disk
└─sda1 8:1 0 2.5G 0 part /
sdb 8:16 0 20G 0 disk
└─sdb1 8:17 0 20G 0 part

You can see that the rescue disk is sda1 and that it is mounted as the root (/), but the disk of the server is sdb1!

2.5 Change your root directory so you can work inside the server

Section titled “2.5 Change your root directory so you can work inside the server”
bash
mkdir -p /mnt/sdb1
mount /dev/sdb1 /mnt/sdb1
mount -t proc proc /mnt/sdb1/proc/
mount -t sysfs sys /mnt/sdb1/sys/
mount -o bind /dev /mnt/sdb1/dev/
mount -t devpts devpts /mnt/sdb1/dev/pts
mkdir -p /run/chroot/lock
mount -o bind /run/chroot /mnt/sdb1/run
chroot /mnt/sdb1 /bin/bash
source /etc/default/locale
bash
lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 2.5G 0 disk
└─sda1 8:1 0 2.5G 0 part
sdb 8:16 0 20G 0 disk
└─sdb1 8:17 0 20G 0 part /

If you run into trouble, ask for a quote.

2.8 Leave the environment and go back to the root of the rescue system

Section titled “2.8 Leave the environment and go back to the root of the rescue system”
bash
exit
umount /mnt/sdb1/run
umount /mnt/sdb1/dev/pts
umount /mnt/sdb1/dev/
umount /mnt/sdb1/sys/
umount /mnt/sdb1/proc/
umount /mnt/sdb1

Go back to the OVH manager to leave rescue mode

Section titled “Go back to the OVH manager to leave rescue mode”

And reboot the server in normal mode: Leaving rescue mode in the OVH manager