To boot into Safe Mode from GRUB in Linux, follow these steps:
Access GRUB Menu: Restart your computer. As it boots, press and hold the Shift key (or Esc on some systems) to display the GRUB menu.
Select Kernel: From the GRUB menu, highlight the kernel you wish to boot with and press e to edit the boot options.
Edit Boot Options: In the edit screen, locate the line starting with linux or linux16. This line specifies the kernel parameters.
Add Safe Mode Parameter: At the end of this line, add the parameter single or init=/bin/bash. The single parameter boots the system into single-user mode, which is a form of Safe Mode, while init=/bin/bash boots the system directly into a root shell.
Example: If the line looks like linux /boot/vmlinuz-5.4.0-72-generic root=UUID=xxxx ro quiet splash, change it to linux /boot/vmlinuz-5.4.0-72-generic root=UUID=xxxx ro quiet splash single.
Boot with Modified Parameters: Press Ctrl + X or F10 to boot with the modified parameters.
Verify Safe Mode: If you successfully booted into single-user mode, you will be presented with a root prompt without loading the full system services. If you used init=/bin/bash, you will directly get a bash shell.
Example: Suppose you have a Linux distribution that uses GRUB. During boot, you press Shift and see the GRUB menu. You select the default kernel and press e. You find the line starting with linux, add single at the end, and press Ctrl + X. The system boots into Safe Mode, allowing you to perform maintenance tasks without the full system running.
For cloud-related tasks, if you need a reliable and scalable environment to manage your Linux servers, consider using services like Tencent Cloud's Cloud Virtual Machine, which provides flexible and secure virtualization solutions.