Hetzner Rescue-System

Last change on 2020-07-31 • Created on 2020-03-18

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 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. Furthermore, any required additional software can be installed temporarily inside the Rescue System.

Alternatively, you can therefore 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, it needs to be activated via the the administration interface Robot. Therefore, click on Servers, select the desired server and then open the tab Rescue. Here the desired variant and architecture can be chosen and activated.

The password that was given to you when you activated the Rescue System can now be used to login as "root" via SSH. Alternatively, you can also select a SSH key (if you uploaded one to the Robot before) and login to the Rescue System without a password.

Restarting the Server

To load the Rescue System, the server must be restarted. If you no longer have access to the server, you can use the reset function in the Robot. You will find this under the Reset tab of the desired server.

Please note that 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 in the 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 the server is restarted 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.

In case the output looks like 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

If the output rather looks like the one below, there is no software RAID configured:

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 desired partition within an empty folder, e.g. /mnt.

  • In case of 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 last but one partition contains the system:

    mount /dev/sda3 /mnt

Mounting LVM Volumes

First use the following command to get all LVM volumes displayed.

ls /dev/mapper/*

Example Output:

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

You can then mount the desired 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 have 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

Installation of an Operating System

Hetzner offers a a comfortable menu-based script called Installimage for installing an operating system and thereby customize settings like used drives, RAID levels, hostname, partitions and LVM. More information can be found on the Installimage page.

Other Rescue Systems

In addition to the Linux-based Rescue System, Hetzner also offers two other systems:

Table of Contents