5 Tips to Fix Linux Booting Issues

As for many systems, you can use it every day but it can happen that for some reason, your system doesn't boot and you need to know how you can do in these situations. Some Linux distributions don't offer a safe mode and automatic repair tools but you can see recovery mode which provides some options that keep your files and can repair the problem. There is also another possibility by using a Linux live CD or USB which will help to use tools or commands.

1) Repair Grub2

Ubuntu and many other Linux distributions use the GRUB2 boot loader. If GRUB2 breaks for example if you have installed Windows after installing your Ubuntu or overwrite your MBR, you won’t be able to boot into your Linux system. As GRUB 2's ability to fix boot problems has greatly improved over the original GRUB bootloader. I will show you how to repair your GRUB 2 boot issues and specific instructions on how to use the GRUB 2 terminal.

You should use a liveCD. When you will boot in the live mode, then open the terminal and type the command below:

# 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

Now you can restart your system. If the operation is not resolved, boot in liveCD mode and install boot repair packages as below

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

When the boot repair will start, you will follow the step below

Use the recommended repair. The operation can take several minutes so be patient. Follow the given steps. After this, you can restart your system.

2) Reset a login password forgotten

It can happen that after the boot process, you can't log into your system because you have forgotten your password or maybe you have changed your keyboard language and the input doesn't match the characters you know. The only possibility is to reset your password.

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

# mount -o remount,rw /

The command above mounts the root partition in read/write mode. Now change your password

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

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

# touch /.autorelabel

Now you can normally reboot your system and enter the new password

3) Unable to log in: fail to start session

It can happen on the reboot that the screen of your system goes black and soon after that the login screen comes back. This problem can appear because your graphic environment encountered some problems during a package installation or an upgrade. Or it is probably because there is little space on your machine or an issue with LightDM or Xauthority.

To resolve the issue, type the Ctl-Alt-F1 and got the terminal login. Now enter the command below:

# dpkg-reconfigure lightdm

4) View logs system boot messages

The journal is implemented with the jourlnad daemon, which handles all of the messages produced by the kernel, initrd, services, etc. It can help you to see all the errors messages related to the system boot and you can try to resolve it. To see boot-related messages from the current boot, use the -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 (buildd@lcy01-
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 see the journal from the previous boot, use the -1 relative pointer with the -b flag

# journalctl -b -1

You can have some issues due to applications. Journald makes easy to take advantage of the advanced features of the journal and to do extensive analysis and relational debugging of different application components.

5) Boot Error on Console

Sometimes it happens on reboot the system gets panic or some error message like "init not found" is displayed, preventing from proper booting, then as a first step you can try pass init=/bin/bash (Grub boot loader) or linux init=/bin/bash (if Lilo boot loader). This will launch you straight into a Bash shell prompt. Then you can remount "/" file system and check /var/log/messages for any error. You can use the below command to remount "/" as read/write. Kernel panic could be because of a bad cpu or motherboard or bad memory.

# mount -o remount,rw /

If the above steps does not work, then next option is to

1) Boot from the Linux First CD (boot CD).

2) Type "boot rescue" at Linux boot prompt.

3) After the bash shell prompt show up, type "chroot /mnt/sysimage".

a)  Check for any disk error

# fsck -y /dev/sda2

or

# fsck.ext3 /dev/sda2

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

b) If you use Grub boot loader, type "/sbin/grub-install --root-directory=/boot". If you use Lilo bootloader, type "cd /etc; lilo".

Conclusion

LiveCDs such as Ubuntu or Knoppix do the job of rescue booting just fine, but there are smaller, faster rescue boot disks out there. In such situations, knowing how to edit individual GRUB stanzas, use the GRUB command line but you need to be able to identify the problem. By using these techniques, you can recover from various boot problems and boot into your normal installation.

About Bobbin Zachariah

Founder of LinOxide, passionate lover of Linux and technology writer. Started his career in Linux / Opensource from 2000. Love traveling, blogging and listening music. Reach Bobbin Zachariah about me page and google plus page.

Author Archive Page

Have anything to say?

Your email address will not be published. Required fields are marked *

All comments are subject to moderation.