8.7. Recovering a Broken System
| Chapter 8. Next Steps and Where to Go From Here |

## 8.7. Recovering a Broken System

Sometimes, things go wrong, and the system you've carefully installed is no longer bootable. Perhaps the boot loader configuration broke while trying out a change, or perhaps a new kernel you installed won't boot, or perhaps cosmic rays hit your disk and flipped a bit in `/sbin/init`. Regardless of the cause, you'll need to have a system to work from while you fix it, and rescue mode can be useful for this.

There are several options to rescue a broken Ubuntu system on i386:

- To access rescue mode, select `rescue` from the boot menu (if available) or append the boot parameter `rescue` or `systemd.unit=emergency.target` to the linux kernel boot entry of the boot loader.

  While booting the system enter the boot loader menu:

                                   GNU GRUB  version 2.02

       *Ubuntu
        Advanced options for Ubuntu

            Use the ↑ and ↓ keys to select which entry is highlighted.
            Press enter to boot the selected OS, 'e' to edit the commands
            before booting or 'c' for a command-line.

  Then type e to edit the boot loader configuration and entries, navigate to your prefered Linux kernel line and append either `rescue` or `systemd.unit=emergency.target`.

                                   GNU GRUB  version 2.02

                       insmod ext2
                       set root='hd0,gpt2'or Ubuntu
                       if [ x$feature_platform_search_hint = xy ]; then
                         search --no-floppy --fs-uuid --set=root --hint-bios=hd0,g\
       pt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  ea967ae0-7519-11eB-85b\
       d-5254008bdef4
                       else
                         search --no-floppy --fs-uuid --set=root ea967ae0-7519-11e\
       8-85bd-5254008bdef4
                       fi
                       echo        'Loading Linux 4.15.0-23-generic ...'
                       linux        /boot/vmlinuz-4.15.0-23-generic root=UUID=ea96\
       7ae0-7519-11eB-85bd-5254008bdef4 ro  maybe-ubiquity rescue

            Minimum Emacs-like screen editing is supported. TAB lists
            completions. Press Ctrl-x or F10 to boot, Ctrl-c or F2 for
            a command-line or ESC to discard edits and return to the GRUB menu.

  Then press either Ctrl-x or F10 to boot with the modified entry and the system will enter the rescue mode.

      ...
      [  OK  ] Started Update UTMP about System Runlevel Changes.
      You are in rescue mode. After logging in, type "journalctl -xb" to view
      system logs, "systemctl reboot" to reboot, "systemctl default" or "exit"
      to boot into default mode.
      Press Enter for maintenance
      (or press Control-D to continue):
      root@ubuntu:~#

- Alternatively the installer can be booted with the `rescue=true` boot parameter. You'll be shown the first few screens of the installer, with a note in the corner of the display to indicate that this is rescue mode, not a full installation. Don't worry, your system is not about to be overwritten! Rescue mode simply takes advantage of the hardware detection facilities available in the installer to ensure that your disks, network devices, and so on are available to you while repairing your system.

- A trivial option is to just boot the standard installation kernel and initrd without any additional kernel parameter, and select from the inital screen the Start shell entry.

                                   [!!] Configuring d-i

         This is the network console for the Debian installer. From here, you
         may start the Debian installer, or execute an interactive shell.

         To return to this menu, you will need to log in again.

         Network console option:

                            Start installer
                            Start installer (expert mode)
                            Start shell

  The functionality in the `debian-installer` shell is limited, however, it can still act as a rescue system to fix a broken installation. While not using the rescue mode, be careful to not accidentially repartition or format any disk which may cause data loss.

In either case, after you exit the shell, the system will reboot.

Finally, note that repairing broken systems can be difficult, and this manual does not attempt to go into all the things that might have gone wrong or how to fix them. If you have problems, consult an expert.

8.6. Compiling a New Kernel |  | Appendix A. Installation Howto