1

|

My PC wont boot every second time I try to boot ubuntu. But I seem to have found a fix, which is editing setparams by pressing 'e' in grub.

I edit the

"gfxmode #linux_gfx_mode" 

to

"gfxmode nomodeset"

and can then boot ubuntu as normal. So I wanted to make this change permanent. I tried changing grub command in the /etc/default/grub with

GRUB_CMDLINE_LINUX_DEFAULT="nomodeset"

This is added to the linux boot command in setparams in the grub, but makes my computer hang up instead and does not change the line with

"gfxmode #linux_gfx_mode"

How do I make change the gfxmode permanent so my computer can boot properly every time?

4 Answers4

2

It seems that /boot/grub/grub.cfg is generated from files in /etc/grub.d

I managed to make the change permanent by replacing in this file /etc/grub.d/10_linux the line:

echo "  gfxmode \$linux_gfx_mode" | sed "s/^/$submenu_indentation/"

with this:

echo "  gfxmode nomodeset" | sed "s/^/$submenu_indentation/"

Afterwards I ran:

sudo update-grub

to generate the new grub.cfg

galoget
  • 2,963
1

If I understood the question, you have to modify the file /etc/default/grub (do it as root) and then give the command:

sudo update-grub

This command makes the change effective

PaoloC
  • 11
  • I already did it. What I mean is, that when I change the line gfxmode in grub, it works, but not when I add it to GRUB_CMDLINE_LINUX_DEFAULT. Do you know why? – user3061876 Jan 01 '18 at 17:17
  • I would modify in the same way the line: GRUB_CMDLINE_LINUX="" This line are for the general parameters, taken also by the recovery mode. If you are launching a recovery mode you need to modify that. Also remember to update grub – PaoloC Jan 01 '18 at 17:30
  • This still just adds it to the Linux command line in the grub parameters. It does not give any other result than what I tried – user3061876 Jan 01 '18 at 20:10
  • It only works when I edit the "gfx mode" line. Nowhere else. Is there a way to change it permanently? – user3061876 Jan 01 '18 at 20:11
0

After reading the script in /etc/grub.d/10_linux, I have found a better answer than the currently accepted one. Simply add this line to your /etc/default/grub file, and then run sudo update-grub:

GRUB_GFXPAYLOAD_LINUX="nomodeset"

This variable is what ultimately controls the code path mentioned in the other answer, and appears to be the correct way to modify this setting. Additionally, you may want to change

GRUB_CMDLINE_LINUX_DEFAULT="splash quiet"

to this instead

GRUB_CMDLINE_LINUX_DEFAULT="nosplash nomodeset"
BLuFeNiX
  • 101
0

I have edited /boot/grub/grub.cfg and modified "gfxmode #linux_gfx_mode" to "gfxmode nomodeset" in the bootparameters for ubuntu. I know this may not be the correct way to do it, but it seems to be the only way. I will have to do this every time I update grub.

Is there another way to make it permanent, please leave a better suggestion.