Ubuntu22.04 Xorg Login Loop

I’m using Ubuntu22.04 with nvidia driver 525.125.06. I can log in if using Wayland desktop. However, when I switch to X11 for screen share, I’m stuck in a login loop, similar this issue. To be specific, after I type my password, it asks me again for the password instead of taking me to the desktop.

I’ve tried the methods that are proposed there. To be specific, I’ve tried:

  1. sudo prime-select nvidia
  2. add ‘nogpumanager’ kernel parameter
  3. set the following in /etc/X11/xorg.conf
Section "Device"
    Identifier     "intel"
    Driver         "modesetting"
    BusID          "PCI:0:2:0"
EndSection

However, after reboot, I’m still stuck in the login loop. Any ideas on how to solve the problem?
nvidia-bug-report.log.gz (446.5 KB)

Please revert any changes you made, then simply embed the nvidia driver into the initrd. It’s loading too late so the Xserver is already up. Also, the i915 driver doesn’t seem to be in the inird as well.

Can you illustrate how to embed the nvidia driver to the initrd? Should I follow the Early loading instruction? Can you provide a code or command?

I’ve tried one of your post and this link. They both fail. I’m still stuck at the login page.

I’ve also attached two logs. One for wayland, where I can successfully log in. The other is xorg, where I’m stuck at the login page.
nvidia-bug-report-wayland.log.gz (342.4 KB)
nvidia-bug-report-xorg.log.gz (380.3 KB)

It is also worth mentioning that it seems that the nvidia gpu is not recognized during booting. I’ve taken a photo of my screen before the login page shows up. It says No NVIDIA GPU found. Not sure whether it is related to my issue.

The driver now correctly loads but your nvidia gpu is an egpu which has to be explicitly enabled in xorg.conf

(WW) NVIDIA(GPU-0): This device is an external GPU, but external GPUs have not
(WW) NVIDIA(GPU-0):     been enabled with AllowExternalGpus. Disabling this device
     to prevent crashes from accidental removal.
(EE) NVIDIA(0): Failing initialization of X screen

Furthermore, you now created a nvidia-only xorg.conf so the internal display is disabled meaning a monitor would have to be hooked up to the nvidia gpu.

Any idea on how to enable that in xorg.conf?

Oh, I found that. I’ll include the link here for reference.

After enabling egpu in xorg.conf. Only the monitors that are directly connected to the nvidia gpu light up. My laptop screen connected to the intel graphics is black. Can you illustrate on how to hook my laptop screen to the nvidia gpu?

Thank you for your help. I’ve solved the issue. To help others, I’d like to summarize what should be done in case of using eGPU in xorg.

To enable an eGPU, we need to add Option "AllowExternalGpus" "True" to xorg.conf. Commonly, when we use an eGPU, it is plugged into a laptop, whose screen is usually connected to the laptop’s gpu, so the laptop screen may not be used when we are only specifying the eGPU in xorg.conf. Therefore, we should set modesetting. By following this link, you should be able to use all the screens.

However, when we unplug the eGPU and use the laptop, it no longer detects the eGPU, so the xorg.conf should be reconfigured. To use the internal gpu of the laptop, just an empty xorg.conf will work. To automate this process whenever we boot the computer, I recommend using egpu-switcher. In Ubuntu, we can simpliy run

sudo add-apt-repository ppa:hertg/egpu-switcher
sudo apt update
sudo apt install egpu-switcher
sudo egpu-switcher setup

It will setup everything for you. Note that to my knowledge, xorg does not support hot-plug and hot-unplug. It is better to shutdown the laptop before plugging or unplugging the eGPU.

In short, the simple solution to eGPU problem in xorg is just to install and setup egpu-switcher.

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