May 4, 2017

Recovering from Black Screens in Linux

Windows gives you BSOD ( Blue Screen of Death)

It seems Linux gives you Black Screens. It is not crashing, but sometimes, you end up landing in such a state that all you get is a black screen and there is not much you can do about it.

Recently I got into such a situation. This is related to the NVIDIA drivers for Linux, but maybe you got it for some other situation.

In my case, I was fiddling around with the graphics card setting. The MIS GL62 laptop has lousy battery life - hardly lasts 2 hours. So, I was trying to figure out how to reduce the battery drain when not doing something graphics intensive. There is a mode in Nvidia called Prime which allows you to switch between Nvidia and Intel graphics, and I changed that to Intel - and viola ... the problem. 

The problem:
The problem is that sometimes the graphics drivers mess up badly that there is no display. The ctrl+tab+1 trick does not work - you do not end up getting the terminal to fix it.

So, what can you do in this case ? There is not fallback ! Or is there.

This requires a bit of jugglery. I will list out what I did in my case - you may need to do something different in Step 3.

Step 1: Get the boot menu 

Now, my laptop has only Linux in it. So, unlike my deskstop where I dual-boot I do not get a grub prompt for choosing which OS I want to boot into. As such , it just directly starts the Linux boot process and hangs up.

So, to get the Boot menu, you need to press the ESC key or Shift . I do not know exactly which ones, so I mashed both the keys.


Step 2: Get into recovery root shell.

Now, that you have the menu, use the down arrow to get to recovery option. Click that and you get another set of actions - go to the root .



Step 3: Fix the problem ( or make an attempt at it) 

Ok. Easier said than done. I tried a variety of stuff but ultimately I had to remove the Nvidia driver to get the X server to work. You need to remove all settings for which you use the purge option for apt ( debian systems ) to remove the driver. e.g. In my case:

sudo apt-get purge nvidia*

Now, reboot and the X server will pick up the default configuration, using the inbuilt drivers which support the Intel graphics chipset and boot you into the windows manager.

Once you can boot in, you can now reinstall the graphics drivers and continue your work.

Phew ! 

No comments:

Post a Comment