Skip to content
VPS.net

Recovery Reboot

Booting an SSD VPS into recovery mode starts your virtual server from a separate Ubuntu recovery image instead of your installed operating system. Your server’s disk is left untouched and is available to mount from within the recovery environment, allowing you to troubleshoot and repair your system. Recovery mode is useful for tasks such as:

  • Fixing boot errors or a broken /etc/fstab
  • Regaining access after losing an SSH key or breaking your SSH or firewall configuration
  • Resetting a user’s password
  • Copying important data off the server

There are two ways to log in to the recovery image:

User Credential Available for
ubuntu Your server’s SSH key Servers deployed with an SSH key
root A temporary password created for the recovery image All servers, including servers deployed without an SSH key

You can use either login over SSH, or from the Console tab on your server’s page. The temporary password is shown on your server’s page while it is in recovery mode.

  1. To perform a Recovery Reboot on a server, navigate to the relevant server page, select Server Actions and choose Recovery Reboot.

  2. You will be presented with a confirmation dialogue. Select Recovery Reboot again to confirm the action.

  3. Once complete, a green pop-up message will confirm the success of the action.

  4. On the server’s Server Information tab, a recovery mode box shows how to log in, including the temporary password. Select the eye icon to reveal it, or the copy icon to copy it.

Once the server has booted into recovery mode, connect over SSH using your server’s public IP address. The examples below use 203.0.113.10 as the server IP.

With your SSH key, connect as the ubuntu user:

Terminal window
ssh ubuntu@203.0.113.10

If your key is not in the default location, specify it with -i:

Terminal window
ssh -i ~/.ssh/my_key ubuntu@203.0.113.10

The ubuntu user has sudo privileges. Switch to a root shell to carry out recovery tasks:

Terminal window
sudo -i

With the temporary password, connect as root and enter the password when prompted:

Terminal window
ssh root@203.0.113.10

SSH uses port 22, so make sure your server’s firewall allows it from where you connect. If you can’t connect over SSH, log in from the Console tab on your server’s page instead.

Your server’s disk is attached to the recovery image as a second disk, usually /dev/vdb. It is not mounted automatically. First, identify it:

Terminal window
lsblk -f

The output lists each disk and its partitions along with their filesystem types. Your server’s root filesystem is usually the largest ext4 or xfs partition on vdb. The device names below (such as /dev/vdb1) are examples, so use the names shown in your own lsblk output.

Mount the root partition:

Terminal window
mount /dev/vdb1 /mnt

Your server’s files are now available under /mnt.

The examples below cover common recovery tasks.

If you have lost the private key for your server, or your server was deployed without one, add a public key to the authorized_keys file on your server’s disk.

For the root user:

Terminal window
mkdir -p /mnt/root/.ssh
echo "ssh-ed25519 AAAAC3Nza... you@example.com" >> /mnt/root/.ssh/authorized_keys
chmod 700 /mnt/root/.ssh
chmod 600 /mnt/root/.ssh/authorized_keys

For your server’s default user, replace ubuntu with its username (for example debian):

Terminal window
mkdir -p /mnt/home/ubuntu/.ssh
echo "ssh-ed25519 AAAAC3Nza... you@example.com" >> /mnt/home/ubuntu/.ssh/authorized_keys
chmod 700 /mnt/home/ubuntu/.ssh
chmod 600 /mnt/home/ubuntu/.ssh/authorized_keys

If you created the .ssh directory, give it to the user. Use the numeric user and group IDs from /mnt/etc/passwd, because the recovery image has different users to your server:

Terminal window
grep ubuntu /mnt/etc/passwd # e.g. ubuntu:x:1000:1000:...
chown -R 1000:1000 /mnt/home/ubuntu/.ssh

Run commands inside your installed system (chroot)

Section titled “Run commands inside your installed system (chroot)”

To run commands as if you were logged in to your normal operating system, for example to reset a password or reinstall a package, chroot into the mounted disk:

Terminal window
for d in dev proc sys; do mount --bind /$d /mnt/$d; done
chroot /mnt
# Examples:
passwd root # reset your server's root password
passwd ubuntu # reset a user's password
nano /etc/fstab # fix a broken fstab entry
exit # leave the chroot when finished

From your local computer, use scp or rsync to download files from the mounted disk. Logging in as root with the temporary password lets you copy any file:

Terminal window
scp -r root@203.0.113.10:/mnt/home/ubuntu/important-data ./

If you copy as the ubuntu user instead, files only readable by root may need to be copied to a location the ubuntu user can read first, or have their permissions adjusted, before downloading.

Step 5: Return to your normal operating system

Section titled “Step 5: Return to your normal operating system”

When you have finished, unmount the disk:

Terminal window
umount -R /mnt

Then perform a normal Reboot from the control panel or API to boot back into your installed operating system. See Power Actions. The temporary password stops working at this point.

Once the server is back online, log in as usual. If you see a host key warning, run ssh-keygen -R <server-ip> as described above.

If you are unable to recover your server, please contact our support team.