如何启动 Ubuntu 22.04 进入救援/紧急模式
救援模式 紧急模式 GRUB
![](/data/attachment/album/202206/24/101647n4nru1ayaw4nrnue.jpg)


极客们好，将 Ubuntu 22.04（Jammy Jellyfish）启动到<ruby> 救援 <rt>  Rescue </rt></ruby>和<ruby> 紧急 <rt>  Emergency </rt></ruby>模式可以重置忘记的用户密码、修复文件系统错误，以及在启动过程中禁用或启用 systemd 服务。


在这篇文章中，我们将学习如何启动 Ubuntu 22.04 LTS 系统进入救援和应急模式。救援模式类似于单用户模式，所有的故障排除步骤都在这里进行。救援模式加载最小的环境并挂载根文件系统。


而在紧急模式下，我们得到的是单用户 Shell，而不启动任何系统服务。因此，当我们无法启动系统进入救援模式时，就需要紧急模式。


### 启动 Ubuntu 22.04 进入救援或单用户模式


前往你想启动到救援或单用户模式的目标系统。在启动时按下 `SHIFT + ESC` 键，进入 GRUB 引导加载器页面。


![Default-Grub-Screen-Ubuntu-22-04](/data/attachment/album/202206/24/101648dyyt1prdmp0mogli.png)


选择第一个选项 “Ubuntu”，并按 `e` 键进入编辑模式。


在以 `linux` 开头的一行末尾，删除字符串 `$vt_handoff` 并添加字符串 `systemd.unit=rescue.target`。


![rescue-target-ubuntu-22-04](/data/attachment/album/202206/24/101648ow71q91s3h3w1phh.png)


做完修改后，按 `Ctrl + X` 或 `F10` 在救援模式下启动。


![Troubleshooting-Commands-in-Rescue-Mode](/data/attachment/album/202206/24/101648cb8dtgu5tggdjzdx.png)


进入救援模式后，运行所有的故障排除命令，并运行 `systemctl reboot` 命令来重启系统。


### 另一种启动系统进入救援模式的方法


重新启动系统并按下 `ESC + Shift` 键，进入 GRUB 启动界面。


选择第二个选项 “<ruby> Ubuntu 高级选项 <rt>  Advanced Options for Ubuntu </rt></ruby>”->选择“<ruby> 恢复模式 <rt>  recovery mode </rt></ruby>”选项并点击回车->选择 <ruby> root（进入 root shell 提示符） <rt>  root (Drop to root shell prompt) </rt></ruby>。


下面是一个例子：


![Boot-Ubuntu-22-04-Rescue-Mode](/data/attachment/album/202206/24/101649btt8jfi0o0gv0zrz.gif)


当你有了 root Shell，运行命令来恢复和修复系统问题，最后使用 `systemctl reboot` 来重启系统。


### 引导 Ubuntu 22.04 进入紧急模式


要启动系统进入紧急模式，首先进入 GRUB 页面。


![Default-Grub-Screen-Ubuntu-22-04](/data/attachment/album/202206/24/101648dyyt1prdmp0mogli.png)


选择第一个选项 “Ubuntu” 并按 `e` 键进行编辑。寻找以 `linux` 开头的一行，移到该行的末尾，删除字符串 `$vt_handoff` 并添加字符串 `systemd.unit=emergency.target`。


![Emergency-Mode-Ubuntu-22-04](/data/attachment/album/202206/24/101649vf8zc63f1231f3lk.png)


按 `Ctrl + X` 或 `F10` 将系统启动到紧急模式。


![Command-in-Emergency-Mode-Ubuntu-22-04](/data/attachment/album/202206/24/101649yl9dv8ba5fk9g18b.png)


同样，在紧急模式下，你可以在这个模式下执行所有的故障排除，完成后，就用 `systemctl reboot` 命令重启系统。


这篇文章的内容就这些。文章内容丰富，不要犹豫，请在你的技术朋友中分享它。请在下面的评论区发表你的疑问和反馈。




---


via: <https://www.linuxtechi.com/boot-ubuntu-22-04-rescue-emergency-mode/>


作者：[Pradeep Kumar](https://www.linuxtechi.com/author/pradeep/) 选题：[lkxed](https://github.com/lkxed) 译者：[geekpi](https://github.com/geekpi) 校对：[wxy](https://github.com/wxy)


本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译，[Linux中国](https://linux.cn/) 荣誉推出


OK
Hello geeks, booting Ubuntu 22.04 (Jammy Jellyfish) into rescue and emergency mode helps to reset the forgotten user password, fix the file system errors and disabling or enabling systemd service during boot.

In this post, we will learn how to boot Ubuntu 22.04 LTS system into rescue and emergency mode. Rescue mode is similar to single user mode where are all troubleshooting steps are executed. Rescue mode loads the minimal environment and mount root file system.

Whereas in emergency mode, we get the single user shell without starting any system services. So emergency mode is required when we can’t boot the system into rescue mode.

## Boot Ubuntu 22.04 into Rescue or Single User Mode

Head to target system which you want to boot into rescue or single user mode. At the boot press ‘SHIFT & ESC’ key to enter into grub bootloader screen.

Choose the first option Ubuntu and press ‘e’ to enter edit mode.

Go the end of line which starts with linux and delete the string ‘$vt_handoff’ and add the string ‘systemd.unit=rescue.target’

After making the changes, either press Ctrl+x or F10 to boot in rescue mode,

Once you enter into rescue mode, run all troubleshooting commands and to reboot the system run ‘systemctl reboot’ command

## Alternate Way to Boot System into Rescue Mode

Reboot the system and press ‘ESC & Shift’ Key to go to grub boot screen.

Choose the 2nd option ‘Advanced Options for Ubuntu’ –> Choose recovery mode option and hit enter –> Choose Root (Drop to root shell prompt).

Example is show below

Once you have root shell, run commands to recover and fix the system issues and finally use ‘systemctl reboot’ to reboot the system.

## Boot Ubuntu 22.04 into Emergency Mode

To boot the system into emergency mode, first go to grub screen.

Select the first option as ‘Ubuntu’ and press ‘e’ to edit. Look for the line which starts with linux word, go to the end of that line, remove the string $vt_handoff and add the string ‘systemd.unit=emergency.target’

Press Ctrl+x or F10 to boot the system into emergency mode,

Similarly in rescue mode, you can perform all the troubleshooting in this mode and once done reboot the system with command ‘systemctl reboot’.

That’s all from this post. I found it informative and don’t hesitate to share this among your technical friends. Kindly post your queries and feedback in below comments section.

Read Also : [How to Set Custom $PATH Environment Variable in Linux](https://www.linuxtechi.com/set-custom-path-variable-in-linux/)