[Notes on pitfalls] The Linux system cannot be started, copy the backup file

Problem Description:

After installing the input method in the Linux system, after restarting, the system cannot be entered, and the resume in recovery mode cannot be started, so I decided to copy the needed things to the USB disk.


solution:

1. Restart ubuntu, then click Esc to enter the grub menu and select the second option Advanced options for Ubuntu

2. Enter the next interface and select recovery mode

3. Enter the Recovery Menu and select the root option.

 

   In Safe Mode/Repair Mode you have the following options:

TYPE ACTION DESCRIPTIONN
resume  Resume normal boot Continue the normal startup process for users who accidentally enter this menu. (continue to boot in normal mode)
clean  Try to make free space Try clearing unnecessary files from your hard drive and freeing up disk space. (clean package)
dpkg Repair broken packages Repair an installed package that is currently damaged. (Fix broken packages)
fsck Check all file systems Perform disk scan and repair, suitable for use after abnormal startup. (Hard disk inspection and repair of bad sectors/logical bad sectors)
grub update grub bootloader Update the GRUB boot program and remove unnecessary options. (Update grub boot)
network Enable networking Start directly in text mode and enable Internet connection support. (shell interface with network connection)
root Drop to root shell prompt Turn on the text mode operation interface, but the network part of the function needs to be activated by itself. (Shell interface of the top administrator)
system-summary System summary View system information/data.

 4. Use the fdisk -l command to check whether the U disk has been recognized and where the recognized U disk is, as shown in the figure below for sdb4

 5. Enter the command to mount the USB disk: mount /dev/sdb4 /mnt
     *Note that there is a space after sdb4

 6. Enter the command to copy the file, such as:

cp -r /home/spark/catkin_ws /mnt

cp -r: Copy all files under the file

Just enter and press Enter

CP instruction parameter description:

  • -a: This option is usually used when copying a directory. It preserves links, file attributes, and copies everything under the directory. Its effect is equal to the dpR parameter combination.
  • -d: Keep links when copying. The links mentioned here are equivalent to shortcuts in Windows systems.
  • -f: Overwrite existing target files without giving a prompt.
  • -i: Contrary to  the -f  option, a prompt is given before overwriting the target file, asking the user to confirm whether to overwrite. The target file will be overwritten when answering y.
  • -p: In addition to copying the contents of the file, the modification time and access permissions are also copied to the new file.
  • -r: If the given source file is a directory file, all subdirectories and files in the directory will be copied.
  • -l: Do not copy files, just generate link files.

 7. Because the file may be too large, you cannot directly see the copy process. In case it is not completely copied, enter the following command to view it.

sync

 If it jumps to the next command after the end, the copy is completed.

8. After the copy is completed, you need to exit the U disk

Enter the following command:

umount /mnt

Now that the file backup is complete, you can flash the machine. 

grateful:

How to copy files to USB flash drive in Linux system - take a look

Ubuntu black screen cannot enter the system [Recovery Mode first aid] - Take a look

I didn't take a screenshot of the picture at the time, so I borrowed it for reference.

Guess you like

Origin blog.csdn.net/weixin_44362628/article/details/126121282