Mint 21 on Asus TUF 706 : Black screen before login, but restart from TTY works

On my ASUS TUF 706 (Ryzen 5 4600H with AMD iGPU + Nvidia GTX 1650 eGPU), I installed Linux Mint 21 (Kernel 5.15.0-46) and the Nvidia drivers (515.65.01)

After MANY failures and retries, I managed to get a “kinda” working setup :

  • If I switch to “prime-select intel” :
  • The system starts
  • The lightdm login screen appears. I log in.
  • X starts correctly
  • nvidia-settings works, but with minimal options (quite logical, as the Nvidia driver is installed but not used)
  • no optimus applet in system tray
  • perfs are, as expected, quite low

Here’s the log for this configuration :
nvidia-bug-report_AMD.log.gz (159,0 Ko)

  • If I switch to “prime-select on-demand”:
  • The system starts
  • The screen goes pitch black before login… : (
  • I enter TTY1 (ctrl+alt+F1)
  • I log in, then I enter “sudo service lightdm restart”
  • Lightdm login screen is displayed as expected. I log in.
  • X starts
  • the optimus applet shows the AMD logo, indicating I’m in “on-demand” mode
  • nvidia-settings works with more options (profiles and stuff…)
  • “glxinfo | grep vendor” says AMD GPU is used
  • “__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia glxinfo | grep vendor” says NVIDIA GPU is used
  • perfs get higher when using the nvidia card, as it should

I will try to include the log for this configuration in another message (forum restrictions…)

  • If I switch to “prime-select nvidia”:
  • The system starts
  • The screen goes pitch black before login… : (
  • I enter TTY1 (ctrl+alt+F1)
  • I log in, then I enter “sudo service lightdm restart”
  • Lightdm login screen is displayed as expected. I log in.
  • X starts
  • the optimus applet shows the NVIDIA logo, indicating I’m in “nvidia” performance mode
  • nvidia-settings works with all options (antialiasing, etc…)
  • “glxinfo | grep vendor” says nvidia GPU is used
  • perfs are good, as expected

I will try to include the log for this configuration in another message (forum restrictions…)

  • One other thing I tried :
  • In grub, I choose to start in recovery mode
  • The system starts and the recovery menu appears
  • I choose to continue in normal mode
  • The lightdm login screen appears. I log in.
  • X is displayed for less than a second, and the Mint startup sound begins playing, before the screen goes pitch black and the sound get cut before the end… game over :(

Any idea on how to fix this annoying login problem ? Thanks !

Here’s the log for the “on demand” configuration :
nvidia-bug-report_on_demand.log.gz (315,4 Ko)

Here’s the log for the “nvidia performance” configuration:
nvidia-bug-report_NVIDIA.log.gz (313,4 Ko)

I just tried this.

The new thing is, just before the screen goes black, there are 3 new lines displayed on screen (One for each item I added in modules, obviously…)

“NVRM: no NVIDIA GPU found”

After that, it’s all the same…

Looking at the logs again, your notebook is behaving quite odd: the nvidia gpu is only turned on after about 7 seconds, so that’s why the driver is loading so late.
Please check if there are any bios options controlling this or if a bios update is available.

[    7.690569] pcieport 0000:00:01.1: pciehp: Slot(0): Card present
[    7.690578] pcieport 0000:00:01.1: pciehp: Slot(0): Link Up
[    7.824739] pci 0000:01:00.0: [10de:1f9d] type 00 class 0x030000

The latest available bios for my laptop (FA706IHRB) is version 304 from 2022/05/13.
Its quite fancy compared to the old bioses I’m used to, with nice shiny graphics, but a very limited number of options, even in advanced mode… :(
Nothing concerning the GPU…
I can enable or disable various devices (Wireless, LAN, audio… but not GPU), prevent the use of some external USB devices, disable secure boot (was already disabled to install Mint), flash a new bios, enable or diable SVM and change boot order.
The only thing I found that could “slow down” startup is the Fastboot option, which was enabled. I tried disabling it, startup takes a little bit longer, but it didn’t fix the black screen problem. :(

On a side note, a funny thing I forgot to mention :

When in prime “nvidia performance” mode (and only in this mode), when I launch “sudo nvidia-bug-report.sh” from the terminal, during the report generation, SOMETHING happens that automatically launches lightdm, the login screen appears, and X starts normally if I log in.
BUT… on closer inspection, it’s as if I was in "Intel"mode. No optimus applet, minimal nvidia-settings, and “inxi -G” says I’m using the AMD GPU…
If I disconnect, I’m back at the terminal. If I type “sudo service lightdm restart”, I can log in into lightdm, X starts and this time, I’m in nvidia performance mode, as expected…

Weird…

Unfortunately, Xorg doesn’t support gpu hotplugging so you can only try to forge a systemd unit to delay Xserver startup until the nvidia gpu is turned on.

Ouch… This is getting too complicated for me :(

I tried this :

in /etc/lightdm/lightdm.conf.d

I created a file with :

[LightDM]
logind-check-graphical=true

Isn’t it what this is supposed to do ? Wait until the drivers are OK before starting lightdm ?

Anyway, it didn’t work…

But, while playing around with lightdm, I noticed this line in its configuration :

display-setup-script=/sbin/prime-offload

So I checked this script and noticed it crashed badly, in TTY or in a X console.
The problems seems to come from the xrandr version checking part. Not only it crashes, but also returns a wrong information in the log file (it says “Sorry we only support randr 1.4 or higher”… But Mint 21 comes with v1.5.1)
I commented this part out, and now the script runs smoothly all the way… (Well it works in X… of course, I get “can’t open display” in TTY… But it’s better than a crash !)

But it didn’t fix my problem either :°(

So…
I THINK I managed to create a small unit with this article https://opensource.com/article/20/5/manage-startup-systemd

For the moment, it only displays a message during the startup process, but… it’s here

The gpu-detect.sh script:

#!/usr/bin/bash
echo "###############################"
echo "###### GPU early detect #######"
echo "###############################"

the service unit file

# Service unit file to try early GPU detection

[Unit]
Description=Trying to detect nvidia GPU earlier

[Service]
Type=oneshot
ExecStart=/usr/local/bin/gpu-detect.sh

[Install]
WantedBy=multi-user.target

My problem now is : what should I add in my script to activate the nvidia card?
Sleep does not work, no matter the number of seconds I use…

So, I entered “Full Frankenstein” mode and began experimenting a bit deeper. (Thank god, Timeshift is around to fix my most horrible experimentations…)

After entering sudo sytemctl disable lightdm and rebooting, I got straight to a TTY display, which is quite logical…
I then checked with sudo lshw -C display : only one GPU is found (the AMD).

Now things begin to get funny :

If I type the same command again sudo lshw -C display, now TWO GPUs are found, the AMD and the nvidia !

The same things happens with nvidia-smi. On first launch, I get a “nvidia-smi has failed because it couldn’t communicate with the nvidia driver”. But if I launch it again just after that, I get the normal display of informations !

This also works with gpu-manager. I launch it, and if I launch nvidia-smi just after, it works fine.

So it seems all these programs managed to rescan / unstuck the nvidia card. If I manually start lightdm after that, everything works fine (graphic login screen, xserver starts, steam games use the nvidia card at full capacity…)

The question now is : what exactly happened ? And what should I add in my little unit script to fix my problem ?

I tried to launch gpu-manager from my script, but looking at the logs it seems it seems it’s getting executed in parallel of the “normal” gpu-manager.service, and it didn’t help to fix my problem…

OK. I finally found a solution !

I changed my “lightdm-forced.sh” script to :

#!/usr/bin/bash
echo "###############################"
echo "###### Force restart LightDM #######"
echo "###############################"

# We wait a second (needed !)
sleep 1
# Restart LightDM
service lightdm restart

I changed the service unit file to :

# Force restart LightDM

[Unit]
Description=Force LightDM restart to fix Nvidia GPU initialization 
After=display-manager.service

[Service]
Type=oneshot
ExecStart=/usr/local/bin/lightdm-forced.sh

Then sudo systemctl daemon-reload

On reboot, I still get the black screen, but my little script restarts lightdm after a second, and this time, everything works…

It’s quite an ugly solution and I’m pretty sure there must be a much more elegant way to to this, but… it works.

I’m just a little bit concerned about security issues with this restart technique, but my understanding of this matter is too basic…

If anyone knows a nicer way to do this, I’m open to suggestions !

Thanks !

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.