Learn 5 simple tips to solve boot problems in Linux

For many systems, you can use it every day, but for some reason your Linux won’t boot, so you need to know how to do it in these situations. Some Linux distributions do not provide safe mode and automatic repair tools, but you can see the recovery mode, which provides options to keep files and fix problems. There is another possibility to use Linux live CD or USB, which will help use tools or commands.

table of Contents

  • 1) Repair Grub2
  • 2) Reset Forgotten Login Password
  • 3) Unable to log in: unable to start session
  • 4) View the log system startup message
  • 5) Console startup error
  • in conclusion

1) Repair Grub2

Ubuntu and many other Linux distributions use the GRUB2 boot loader. If GRUB2 fails (for example, if you installed Windows or overwritten the MBR after installing Ubuntu), you will not be able to boot into the Linux system. Due to GRUB 2’s ability to repair boot problems, it greatly exceeds the original GRUB bootloader. I will show you how to fix GRUB 2 boot issues and specific instructions on how to use the GRUB 2 terminal.

You should use liveCD. When you start in live mode, open a terminal and enter the following command:

# update-grub2
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.10.0-19-generic
Found initrd image: /boot/initrd.img-4.10.0-19-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
done

You can now restart the system. If the operation is still not resolved, boot in liveCD mode and install the boot fix pack as shown below

# apt-add-repository ppa:yannubuntu/boot-repair && apt-get update
# apt-get install -y boot-repair && boot-repair

After the boot repair starts, you will follow these steps

Use recommended repairs. This operation may take several minutes, so please be patient. Please follow the given steps. After that, you can restart the system.

2) Reset Forgotten Login Password

It may happen after the boot process that you cannot log in to the system because you forgot your password or you changed the keyboard language and the characters you entered did not match what you know. The only way is to reset the password.

To reset the password, start in recovery mode and access the terminal. Enter the command below:

# mount -o remount,rw /

The above command mounts the root partition in read / write mode. Change password now

# passwd username
Enter new UNIX password: 
Retype new UNIX password:

If you have SELinux, enter the following command below to update its parameters

# touch /.autorelabel

Now you can usually restart the system and enter a new password

3) Unable to log in: unable to start session

When restarting, the system screen may go black, and then the login screen returns quickly. This issue occurs because your graphics environment encountered some problems during the package installation or upgrade process. Or it may be because of insufficient space on your computer or a problem with LightDM or Xauthority.

To resolve this issue, type Ctl-Alt-F1 And get terminal login. Now enter the following command:

# dpkg-reconfigure lightdm

4) View the log system startup message

This log is implemented by the jourlnad daemon, which processes all messages generated by the kernel, initrd, services, etc. It helps you to see all error messages related to system startup and you can try to resolve it. To view boot-related messages in the current boot, use -b switch:

# journalctl -b
-- Logs begin at Mon 2017-06-26 16:27:12 WAT, end at Mon 2017-06-26 19:18:50 WAT
Jun 26 16:27:12 ubuntu-pc kernel: Linux version 4.10.0-19-generic ([email protected]
Jun 26 16:27:12 ubuntu-pc kernel: Command line: BOOT_IMAGE=/boot/vmlinuz-4.10.0-
Jun 26 16:27:12 ubuntu-pc kernel: KERNEL supported cpus:
Jun 26 16:27:12 ubuntu-pc kernel: Intel GenuineIntel
Jun 26 16:27:12 ubuntu-pc kernel: AMD AuthenticAMD
Jun 26 16:27:12 ubuntu-pc kernel: Centaur CentaurHauls
Jun 26 16:27:12 ubuntu-pc kernel: Disabled fast string operations

To view the log of the last boot, use -1 Relative pointer -b flag

# journalctl -b -1

Due to the application, you may encounter some problems. Journald makes it easy for you to take advantage of the advanced features of journaling and perform extensive analysis and relationship debugging of different application components.

5) Console startup error

Sometimes it happens on restart, the system has an emergency or something like “No initialization found“” Will be displayed, preventing normal startup, and then in the first step you can try passing init = / bin / bash (Grub boot loader) or linux init = / bin / bash (if using the Lilo boot loader). This will launch you directly to a Bash shell prompt. You can then remount the “/” file system and check for any errors in / var / log / messages. You can use the following command to remount “/” in “read / write” mode. Insufficient CPU or motherboard or memory.

# mount -o remount,rw /

If the above steps don’t work, the next option is

1) Boot from the Linux First CD.

2) Enter “boot rescue” at the Linux boot prompt.

3) After the bash shell prompt is displayed, type “chroot / mnt / sysimage”.

a) Check for any disk errors

# fsck -y /dev/sda2

Either

# fsck.ext3 /dev/sda2

Check “fdisk -l / dev / hda” to check how many partitions you have

b) If using the Grub boot loader, type “/ sbin / grub-install –root-directory = / boot”. If using the Lilo bootloader, type “cd / etc; lilo”.

in conclusion

LiveCDs such as Ubuntu or Knoppix are good for emergency boot, but there are smaller, faster emergency boot disks out there. In this case, to know how to edit a single GRUB section, use the GRUB command line, but you need to be able to determine the problem. By using these techniques, you can recover from a variety of startup issues and boot into a regular installation.

Sidebar