Start the computer with UbuntuLiveCD or UbuntuLiveUsb, select Ubuntu for use, and enable the terminal. # Obtain the root permission sudo-I # view the partition information fdisk-l # mount the root partition (only the Swap and/partition methods are supported) mount/dev/sda5/mnt # mount proc/dev/sys, important mount -- bind/proc/mnt/procmount -- bin
Start the computer with Ubuntu LiveCD or Ubuntu LiveUsb, select Ubuntu for use, and enable the terminal.
# Obtain root permissions
Sudo-I
# Viewing partition information
Fdisk-l
# Mount the root partition (only Swap and/are supported)
Mount/dev/sda5/mnt
# Mount proc/dev/sys, important
Mount -- bind/proc/mnt/proc
Mount -- bind/dev/mnt/dev
Mount -- bind/sys/mnt/sys
# Chroot to/mnt Partition
Chroot/mnt
# Installing grub
Grub-install/dev/sda
# Execute this command if grub. cfg is lost or damaged
Update-grub
# Log out of chroot and restart the computer
Exit
Reboot
# If there are many partitions (especially the/boot partition is a separate partition), run the following command.
# Mount the system partition. This step varies from person to person, and the partition is mounted to the corresponding location.
Mount/dev/sda3/mnt
Mount/dev/sda1/mnt/boot
Mount/dev/sda5/mnt/home
# Mount proc/dev/sys
Mount -- bind/proc/mnt/proc
Mount -- bind/dev/mnt/dev
Mount -- bind/sys/mn/sys
Chroot/mnt/
Grub-install/dev/sda
Update-grub
Exit
Reboot