2

My thinkpad w520 will not boot with the default Grub menu if I am using Nvidia drivers and the Nvidia card (it's an Optimus system with two video cards). However, it boots in recovery mode, and goes on to work well.

The culprit is

gfxmode $linux_gfx_mode

If I remove this line with the Grub entry, it boots fine. (This line is not present in the recovery menu option).

Is there a sane way for me to edit the grub menu to get rid of it? Must I fiddle with scripts in /etc/default/grub.d ?

Tim Richardson
  • 2,294
  • 3
  • 25
  • 43

3 Answers3

3

gfxmode was probably not really the problem. There were some kernel parameters that made the experience much better. It proved to be impossible to get this laptop working with Windows 10 (using the Nvidia card always), but it does work with Linux!

So on 16.04 (but with the 4.8 kernel) and Nvidia driver v 367, this is how you can get three monitors working (via a docking station) which is only possible with Optimus. Yes ... nvidia in discrete mode will only drive two outputs; not three. If you only need one external monitor and the laptop panel, you can either use optimus or discrete Nvidia. Discrete nvidia just works, no need for any config.

  1. the machine will hang on boot unless you modify the grub cmd line entry to specify nox2apic /etc/default/grub...

    GRUB_CMDLINE_LINUX_DEFAULT="agp=off quiet splash nox2apic"

There are additional suggestions in the history of the w520 but with this kernel, only this change is needed.

  1. There are hints about adding a file to /usr/share/X11/xorg.conf.d to set up nvidia brightness. This suggestion stopped optimus from working. I don't know how, but they have a nasty effect when X is starting. The symptom of this problem is that xrandr --listproviders needs to show both the nvidia card and the intel card. The brightness tweaks to xorg.conf seemed harmless, but they actually somehow stopped the intel card and nvidia card working together. xrandr --listprovider would only list one provider, Nvidia, and it is therefore impossible for X to render anything on the laptop panel. To my amazement, removing the brightness conf fixed this very annoying problem.

In any case, the brightness keys are working for me in optimus-nvidia mode, and changing brightness via the screen control panel works too.

  1. lightdm refuses to allow me to use the laptop panel. The mouse pointer moves there, but I can't drag any windows, and there is no background (it's black). However, install xfce but keeping lightdm works. Note that if you want on-screen brightness control, you need to install the xfce power management plugin from synaptic or whatever package manager, and then add it to the panel. Clicking the battery icon gives a display changer.

Note: I follow the arch wiki instructions here:

https://wiki.archlinux.org/index.php/NVIDIA_Optimus#LightDM

and added the short script make some xrandr changes. I did this mainly to try to understand why I had only one provider, before I worked out that the nvidia brightness changes was the problem. Possibly I don't need the script, but I'm so pleased that it's all working I don't want to change a thing.

However, changing from nvidia to intel requires a reboot: merely logging out doesn't work.

Tim Richardson
  • 2,294
  • 3
  • 25
  • 43
  • Adding nox2apic fixed Xubuntu 18.04 from not booting on my Lenovo X220T... Now to try and figure out why. Thanks. – nmz787 Oct 03 '18 at 08:58
  • The same for me, doing the 1. suggestion proposed by the author seems fixed Ubuntu 16.04 from stuck at the purple screen during startup/booting, on my thinkpad x220i. Though I don't understand the mechanism behind.. – Ingch Apr 12 '19 at 08:13
  • In the end, it was not the 1. suggestion worked for me... Finally I found it was the problem of gfxmode, using another answer did solve the problem for me finally, please resort to: https://askubuntu.com/questions/120096/ubuntu-hangs-at-purple-screen/121928#comment1881925_121928 – Ingch Apr 19 '19 at 14:46
0

I had same culprit when installing Ubuntu desktop 22.04.1 LTS from a USB flash disk on an old intel server board inside a 1U mount rack so it doesn't have graphic card other than a built-in VGA port

I solved the problem this way:

  • Login to the server via Ctrl+Alt+F3

  • sudo nano /etc/grub.d/10_linux

  • Press Ctrl and '/' buttons then type 219 in the input field then hit Enter

  • Replace $linux_gfx_mode with \"\" so the corresponding line looks like this

        echo "    gfxmode \"\"" | sed "s/^/$submenu_indentation/"
    
  • Save the edited file

  • sudo update-grub

  • sudo reboot

  • Just wait n see it will be boot fine in normal mode

Maybe this is not the perfect way because I'm a completely newbie in the linux world but at least this way has made me sleep well last night and wake up happily this morning.

0

I had a similar problem on a very different machine, a Supermicro X8SIL Xeon X3440 server. Commenting out the gfxmode line allowed the machine to boot, but having a larger grub menu is convenient. Because it's a server, I don't care how much it prints at boot time, and I don't ever expect to run X, Wayland, Mir, Unity, or anything else requiring a graphics driver on it. Instead of messing with the scripts in /etc/grub.d (/etc/default/grub.d is empty) I just removed splash modeset from /etc/default/grub.conf. This is what I'm currently using:

GRUB_DEFAULT=0
#GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=false
GRUB_TIMEOUT=3
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_CMDLINE_LINUX=""

I suspect modeset is the true problem.