Unable to start xorg/gdm on ubuntu 18.04 with nvidia drivers on 1060 gtx

Hi!

I’m running ubuntu 18.04 with 4.15.0-20-generic kernel on the same laptop as in this thread: https://devtalk.nvidia.com/default/topic/1033027/

I have tried installing 390 and 396 drivers through apt as well as manual install. In each case I can’t boot with runlevel 5 - it ends with black screen. If I’m booting with runlevel 3 and then starting X’s or gdm3 after login it ends with hanged terminal. All of these steps I can only perform under “nomodeset” because in opposite case black screen appears even before terminal prompt. I did signed installer’s generated keys for secure boot and enrolled it properly so the driver module is loaded correctly and I can see ASCII table by running nvidia-smi.

Here is the bugreport log: https://1drv.ms/u/s!Ar90OrCeEGhtqn5clvvJNIJ9NIwm
Please note that it contains logs for previous installs and uninstalls, so better to read it bottom-up.

See this:
https://devtalk.nvidia.com/default/topic/1032652/linux/can-not-login-x-window-ubuntu-16-04-4-lts/post/5253822/#5253822

  1. runlevel 3 does not support GUI. No matter why it hangs.

  2. Try booting with this in grub :

nomodeset grub_gfxmode=vesa

  1. Otherwise install ubuntu 18.04 in legacy as NVIDIA drivers have problems with UEFI. In my system it had problems in UEFI with even secureboot off.

I have Nvidia 1050Ti.

I uninstalled Ubuntu 18.04 which I installed in legacy mode from my system yesterday, but when I was running it, I had nvidia 390.48 installed in it via “additional drivers” section. Everything was working fine, the only problem was that it increased boot-up time by 100%.

I’ve already tried 390 and 396 from ppa. It’s booting into black screen without nomodeset. With nomodeset it’s outputs to tty1 following lines multiple times:

-- 
-- Unit nvidia-persistenced.service has finished shutting down.
мая 07 22:07:06 sergey-N95TP6 systemd[1]: Starting NVIDIA Persistence Daemon...
-- Subject: Unit nvidia-persistenced.service has begun start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit nvidia-persistenced.service has begun starting up.
мая 07 22:07:06 sergey-N95TP6 nvidia-persistenced[28587]: device 0000:01:00.0 - registered
мая 07 22:07:06 sergey-N95TP6 systemd[1]: Started NVIDIA Persistence Daemon.
-- Subject: Unit nvidia-persistenced.service has finished start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit nvidia-persistenced.service has finished starting up.
-- 
-- The start-up result is RESULT.

Also I’ve mentioned in boot log that nvidia-prime-boot.service was failed to start. Then I’ve tried to start it manually and got the following:

● nvidia-prime-boot.service - dGPU off during boot
   Loaded: loaded (/lib/systemd/system/nvidia-prime-boot.service; disabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Mon 2018-05-07 21:44:41 MSK; 7min ago
  Process: 13484 ExecStart=/bin/sh -c echo OFF > /sys/kernel/debug/vgaswitcheroo/switch (code=exited, status=2)
 Main PID: 13484 (code=exited, status=2)

мая 07 21:44:41 sergey-N95TP6 sh[13484]: /bin/sh: 1: cannot create /sys/kernel/debug/vgaswitcheroo/switch: Directory nonexistent
мая 07 21:44:41 sergey-N95TP6 systemd[1]: nvidia-prime-boot.service: Failed with result 'exit-code'.
мая 07 21:44:41 sergey-N95TP6 systemd[1]: Failed to start dGPU off during boot.

There was no /sys/kernel/debug/vgaswitcheroo/ directory and I can’t create it under root.

Thank you! No luck with grub parameters. I can’t install ubuntu in legacy mode because I’m running on NVMe PCI Drive and BOIS can’t boot from it.

Please remove the files
/etc/X11/xorg.conf
/usr/share/X11/xorg.conf.d/nvidia-drm-outputclass.conf

Remove the nomodeset parameter, run sudo prime-select nvidia and reboot.
If you’re running into a black screen again, try to switch to a vt, and run nvidia-bug-report.sh again and attach the .gz file to your post. Hovering the mouse over an existing post will reveal a paperclip icon.

Thank you! There was no xorg.conf, just a backup left after installer. nvidia-drm-outputclass.conf was not present in xorg.conf.d as well, only 10-nvidia.conf was there.
I can’t boot past grub without nomodeset even at runlevel 3 - just couple of blinking text lines and black screen at the end.
nvidia-bug-report.log.gz (84.3 KB)

The nvidia-bug-report is from a boot with nomodeset again, that’s useless.
Can’t you use ctrl+alt+f1 to switch to a vt when you’re running into the black screen issue?

I’ve tried ctrl+alt+[f1 through f12]. And I’ve tried connecting external monitor via hdmi. Nothing works. Also I can’t output to external monitor even with intel driver. In graphical interface I can see only “Unknown Display” and no options to detect any other.

➜  ~ xrandr --verbose     
xrandr: Failed to get size of gamma for output default
Screen 0: minimum 1920 x 1080, current 1920 x 1080, maximum 1920 x 1080
default connected 1920x1080+0+0 (0x2b1) normal (normal) 0mm x 0mm
	Identifier: 0x2b0
	Timestamp:  9350
	Subpixel:   unknown
	Clones:    
	CRTC:       0
	CRTCs:      0
	Transform:  1.000000 0.000000 0.000000
	            0.000000 1.000000 0.000000
	            0.000000 0.000000 1.000000
	           filter: 
	_MUTTER_PRESENTATION_OUTPUT: 0 
  1920x1080 (0x2b1) 159.667MHz *current
        h: width  1920 start    0 end    0 total 1920 skew    0 clock  83.16KHz
        v: height 1080 start    0 end    0 total 1080           clock  77.00Hz

Ok I’ve managed to boot without nomodeset. I did installed fedora for that. So here my logs on fedora 28. Please note that log contains several boot series, the one without nomodeset is the last.
nvidia-bug-report.log.gz (64.4 KB)

Dude read this please :

https://devtalk.nvidia.com/default/topic/1033119/linux/tutorial-install-nvidia-396-24-in-fedora-28-with-kernel-4-16-x-/

I have clearly mentioned here in this tutorial which I have written myself that only 396.x drivers work without patch with kernel 4.16.x and that you should use that only.

Also, just using nomodeset is not enough, you have to specify the drivers that will boot afterwards. “Vesa” drivers are very compatible, so you are supposed to use them.

COMMAND FOR THAT IS :

nomodeset grub_gfxmode=vesa

Please search atleast for topics posted in the same board.

Also, provide info like your pc config, kernel, driver version as not many would go through 110 page log to get that info to help you!!

I appreciate you for the guide. I did everything exactly line-by-line (even using binary installer is strictly discouraged for optimus systems as per generix comments). I’ve performed installation on fedora as in your guide since with ubuntu I was unable to boot in legacy mode.
… and yes, it didn’t worked - it ended with blinking dash after reboot.

With Fedora 28 I’ve managed to boot without nomodeset and install 390.48 drivers from rpm fusion.
The system booted, I’ve managed to login and start GUI, hovewer Fedora reported an error related to nvidia driver. Here is bug report.
nvidia-bug-report.log.gz (83.1 KB)

This is because unpatched 390.48 drivers does not support linux 4.16.x kernel.

If it doesn’t support the kernel then how will it boot up with it? F28 comes with linux 4.16.3 kernel!!!

To patch 390.48 read this (NOT RECOMMENDED, install 396 instead) :

https://devtalk.nvidia.com/default/topic/1030082/linux/kernel-4-16-rc1-breaks-latest-drivers-unknown-symbol-swiotlb_map_sg_attrs-

OR simply use 396 drivers.

Did you installed 396 drivers in F28? Did you followed all the steps including blacklisting nouveau drivers, removing its package and generating initramfs again as specified in the tutorial?

=> Looking at the log when you installed 390.48 with linux 4.16.x is pointless.

Install 396.24 and disable nouveau as specified in the guide otherwise nvidia drivers will not boot up in F28. You will be shown black screen with a blinking cursor on top left side of the window. All these steps are NOT required in Ubuntu 18.04 but are in F28.

If it doesn’t work, then kindly put up the log with 396 drivers as log made with 390 drivers is useless because of the reasons given on top of this post.

Well there are no 396.xx driver packages in rpmfusion yet, so the only option was to install 390.xx package which ended with properly functioning system at this moment. I’ve installed kernel updates 3 times already and everything working.
And yes, before that I did everything according to your guide, what I’ve already has stated in previous comment.

Use 396.x drivers from Nvidia site. They come as *.run file. Using 390.x is pointless. Install them using the tutorial.

Never use the .run installer unless you really know what you’re doing, especially on an Optimus tech laptop.
The 390 driver from rpmfusion is patched so it works with the 4.16 kernel. No further steps needed.
Though from your last log, driver/kernel come up fine but I don’t know if you’re running a wayland session now since all Xorg logs included are from a previous boot.

I’m on x11. Everything works fine and I was able to run some 3D games from Steam. So I think he issue is resolved now.

Good to hear. I have come to the conclusion that Ubuntu 18.04 seems to be severely flawed and broken when it comes to Optimus (see the rant thread in this forum about 18.04).