Hetzner Rescue System

Last change on 2023-12-14 • Created on 2020-03-18 • ID: RO-6CD57

Introduction

The Hetzner Rescue System is a Debian based Linux live environment that allows you administrative access to your server, even if the installed system does not boot anymore. The environment starts using network boot (PXE) and runs in the memory of the server, without touching the drives or your data on them. This makes it possible for you to carry out repairs to the installed system, access the data on the drives, create backups, check the hardware of the server, and to install operating systems. Plus, you can install any other software you need using the Rescue System.

Or you can use a KVM Console together with a bootable ISO image of your choice.

Starting the Hetzner Rescue System

Activating the Rescue System

To start a server in the Rescue System, first, you need to activate it via the the administration interface Robot. To do this, click on Servers, select the correct server, and then open the tab Rescue. Then pick the correct typeand architecture and activate it.

Now use the password that was given to you when you activated the Rescue System to log in as "root" via SSH. Or, if you have already uploaded an SSH key to Robot, you can select the key, and log into the Rescue System without a password.

Restarting the server

To load the Rescue System, you need to restart the server. If you no longer have access to the server, you can use the reset function on Robot. You will find this under the Reset tab for the correct server.

Important note: The activation of the Rescue System is only valid for one boot. If you want to boot your server to the Rescue System again, you will have to activate it on Robot again. If you do not reboot your server within 60 minutes after the activation, the scheduled boot of the Rescue System will automatically become inactive. If you restart the server later, the system will boot from the internal drive(s).

Mounting the drive(s) in the Rescue System

First, you should determine the partition identifiers of your system by running the command lsblk.

If the output looks like the output below, and there are RAID entries in the TYPE column, you have a software RAID running:

root@rescue ~ # lsblk
NAME    MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
loop0     7:0    0     4G  1 loop
sda       8:0    0 447.1G  0 disk
├─sda1    8:1    0     4G  0 part
│ └─md0   9:0    0     4G  0 raid1
├─sda2    8:2    0   512M  0 part
│ └─md1   9:1    0 511.4M  0 raid1
└─sda3    8:3    0 442.6G  0 part
  └─md2   9:2    0 442.5G  0 raid1
sdb       8:16   0 447.1G  0 disk
├─sdb1    8:17   0     4G  0 part
│ └─md0   9:0    0     4G  0 raid1
├─sdb2    8:18   0   512M  0 part
│ └─md1   9:1    0 511.4M  0 raid1
└─sdb3    8:19   0 442.6G  0 part
  └─md2   9:2    0 442.5G  0 raid1

But if the output looks like the one below, there is no software RAID configured on it:

root@rescue ~ # lsblk
NAME    MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
loop0     7:0    0     4G  1 loop
sda       8:0    0 447.1G  0 disk
├─sda1    8:1    0     4G  0 part
├─sda2    8:2    0   512M  0 part
└─sda3    8:3    0 442.6G  0 part
sdb       8:16   0 447.1G  0 disk
└─sdb1    8:17   0   446G  0 part

Now you can mount the correct partition within an empty folder, for example, using /mnt.

  • If you have a software RAID, /dev/md2 is usually the system partition. (Enter cat /proc/mdstat to display all RAID partitions):

    mount /dev/md2 /mnt
  • Without a software RAID, usually the last or second-to-last partition contains the system:

    mount /dev/sda3 /mnt

Mounting LVM volumes

First, use the following command to see all the LVM volumes.

ls /dev/mapper/*

Output example:

/dev/mapper/vg0-home /dev/mapper/vg0-root /dev/mapper/vg0-swap

You can then mount the LVM volumes.

mount /dev/mapper/vg0-root /mnt

Resetting the root password

To reset the root password of an installed Linux or BSD system, you need to mount the system partition as explained in the previous section of this article: "Mounting the Drive(s) in the Rescue System". Then use chroot to switch into the root environment of the mounted system.

chroot-prepare /mnt
chroot /mnt

You can now change the password of the user "root".

passwd

Finally, exit the root environment.

exit

Installing an operating system

Hetzner provides a convenient menu-based script called Installimage for installing an operating system and for customizing settings like drives you want to use, RAID levels, hostname, partitions and LVM. You can find more information on the Installimage page.

Other Rescue Systems

In addition to the Linux-based Rescue System, Hetzner also provides one other system:

Table of Contents