Cherry Servers

How to Use Rescue Mode to Troubleshoot Your Server

Rescue mode is a valuable tool for troubleshooting when your server’s primary operating system isn’t working correctly and you need to recover from issues like file system corruption, failed migrations, or boot problems. It allows you to boot into a minimal environment to repair or inspect your system, or even perform system-level tasks on unmounted partitions.

This guide will detail the steps required to use rescue mode to troubleshoot on a Cherry Servers dedicated bare metal server.

#Instructions to Use Rescue Mode for Troubleshooting

#Step 1: Access the Cherry Servers Client Portal

  1. Log in to your Cherry Servers account using your credentials.
  2. Navigate to the server you need to troubleshoot.

#Activate Rescue Mode

  1. Select the server you need to work on.
  2. Click on "Actions" in the top right corner of the client portal.
  3. From the drop-down menu, select "Enter rescue mode".
  4. A pop-up window will appear to generate a temporary password. This password allows you to access your server while it’s booted into rescue mode.
  5. Click "Enter rescue mode" and wait a few minutes while the server reboots into rescue mode.
  6. Once the server is successfully in "Rescue mode", you’ll see a confirmation message in the client portal.

#Connect to Your Server in Rescue Mode

  1. Use an SSH client to connect to your server. The IP address will be displayed in the Cherry Servers client portal.
  2. Use the "root" username and the password you generated earlier. Ensure you have the password saved, as it will not be displayed again for security reasons.

#Step 4: Mount the Filesystem (If Needed)

Once logged in, the server’s primary drive won’t be automatically mounted. Depending on the task, you may need to mount the drive manually.

  1. Identify the root partition with the following command:
    Command Line
    lsblk
    
    The output will show available devices, such as /dev/sda1, /dev/nvme0n1p1, or /dev/md127 if you're using RAID.
    Outputroot@7215:~# lsblk
    NAME    MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINTS
    loop0     7:0   0 413.6M  0 loop  /media/root-ro
    loop1     7:1   0  63.9M  1 loop  /snap/core20/2318
    loop2     7:2   0    87M  1 loop  /snap/lxd/29351
    loop3     7:3   0  38.8M  1 loop  /snap/snapd/21759
    sda       8:0   0 232.9G  0 disk
    ├─sda1    8:1   0     1M  0 part
    └─sda2    8:2   0 232.9G  0 part
      └─md127 9:127 0 232.8G  0 raid1
    sdb      8:16   0 232.9G  0 disk
    ├─sdb1   8:17   0     1M  0 part
    └─sdb2   8:18   0 232.9G  0 part
      └─md127 9:127 0 232.8G  0 raid1
    
  2. To mount the root partition, use this command, replacing md127 with the appropriate partition on your server:
    Command Line
    mount /dev/md127 /mnt
    

#Perform Troubleshooting Tasks

Once the filesystem is mounted, the next step is to chroot into the mounted filesystem to operate as if you were working directly on your server’s root filesystem. This allows you to run commands as if the system was booted normally.

#Chroot into the Mounted Filesystem:

After mounting the root filesystem in Step 4, follow these commands to prepare for troubleshooting.

  1. Mount necessary filesystems for chroot.

    Before chrooting, you need to mount several additional directories to ensure that everything works inside the chroot environment:

    Command Line
    mount --bind /dev /mnt/dev
    mount --bind /proc /mnt/proc
    mount --bind /sys /mnt/sys
    
  2. Now, change the root directory to the mounted system:

    Command Line
    chroot /mnt
    

    Once inside the chroot environment, you can perform the following troubleshooting tasks:

#1. Backup Data

You can back up entire directories or critical configuration files to prevent data loss during troubleshooting. If you need to back up important data before performing repairs, use the scp command to copy files to another machine or external storage:

Command Line
scp /mnt/path_to_file user@remote:/path_to_backup/

Replace /mnt/path_to_file with the path to the file you want to back up, and replace user@remote:/path_to_backup/ with your remote server’s username, IP, and destination path.

#2. Examine System Logs

System logs can provide crucial information to diagnose the problem. You can access logs from within the chroot environment by running, where syslog is replaced with the relevant log file (e.g., dmesg, auth.log, or messages) for different logs:

Command Line
less /var/log/syslog

#3. Reinstall GRUB Boot-Loader

If the issue is related to the boot-loader, such as a corrupted GRUB installation, you can reinstall GRUB from within the chroot environment.

  1. Install GRUB on the appropriate device(s).

    For RAID or any multi-drive setup, install GRUB on each physical drive with the following command, replacing "/dev/sda" and "/dev/sdb" with the correct physical devices for your server. If you are not using RAID, only install GRUB on the primary boot drive. :

    Command Line
    grub-install /dev/sda
    grub-install /dev/sdb
    
  2. Update GRUB configuration.

    After installing GRUB, update the configuration to apply the changes:

    Command Line
    update-grub
    

#4. Exit Chroot Environment

Once you have completed your troubleshooting tasks, exit the chroot environment.

Command Line
exit

#5. Unmount filesystems

After exiting chroot, unmount the filesystems that were mounted for chroot with:

Command Line
umount /mnt/dev
umount /mnt/proc
umount /mnt/sys

Now you can continue with any other steps necessary or proceed to reboot the server once you've finished troubleshooting.

#Step 6: Exit Rescue Mode

Once you have completed your troubleshooting tasks, exit rescue mode.

  1. Return to the Cherry Servers client portal and select your server.
  2. Click on "Actions" in the top-right corner and select "Exit rescue mode". !
  3. Wait for a few minutes while your server reboots into its normal operating mode.

#Step 7: Verify

Once the server has rebooted, verify that the issue is resolved and the server functions normally. You can log in via SSH again to ensure everything is back to normal.

No results found for ""
Recent Searches
Navigate
Go
ESC
Exit
We use cookies to ensure seamless user experience for our website. Required cookies - technical, functional and analytical - are set automatically. Please accept the use of targeted cookies to ensure the best marketing experience for your user journey. You may revoke your consent at any time through our Cookie Policy.
build: 920a9a1ae.1622