EGPU and Intel NUC XOrg conf issues (login loop and hanging)

I am trying to setup my Intel NUC and a GeForce 2080 RTX as an EGPU with Ubuntu 18.04. I used the ppa graphics repository to install the nvidia-driver-410 package. After that I ran:

sudo prime-select nvidia

After this I rebooted the machine. All was well.
I decided to then setup CUDA 10.0, so I downloaded the local installer and installed everything but the drivers (which I already installed).

After this when I try and login, I am taken back to the login screen.
I went into TTY mode and ran sudo nvidia-xconfig to generate. Xorg.conf file under /etc/X11.

After this I ran startx which fails with an error message that refers to no screens. Looking at the logs
I see a reference to AllowExteralGpus and that my EGPU won’t be used unless that option has been the turned on.

I tried adding that, but running startx with that option causes the machine to hang.
I tried adding the BusID based on lspci but that did not help either. Is there a way to test an Xorg.conf file ?

nvidia-smi shows that both the device and the correct drivers are installed. What am I missing ? Any help or insight would be super helpful. My machine has a clean install of Ubuntu 18.04. My EGPU setup works correctly when I boot into Windows, so I don’t suspect hardware problems.

I would appreciate some help.
Thanks.

nvidia-bug-report.log.gz (1.01 MB)

Please run nvidia-bug-report.sh as root and attach the resulting .gz file to your post. Hovering the mouse over an existing post of yours will reveal a paperclip icon.
https://devtalk.nvidia.com/default/topic/1043347/announcements/attaching-files-to-forum-topics-posts/

I uploaded the result of nvidia-bug-report.sh to the previous post. Thanks for taking a look.

Like you already noticed:

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

but since you’re using a PRIME setup (display output via the intel gpu) you can’t just create an xorg.conf. Please add

Option "AllowExternalGpus" "true"

inside the outputclass section of /usr/share/X11/xorg.conf.d/10-nvidia.conf

That worked !! Thank you.

You said using Prime meant that I am still using the Intel GPU as well.
Is there something I should be using instead ?

The intel gpu is only used for display since the monitor is connected to it so the picture has to be pushed over the thunderbolt connection. Otherwise you would have to connect a monitor to the nvidia gpu.

Thank you for the clarification. You have been super helpful.

One last question. If I did connect the display directly to the GPU, what changes would I have to make ?

Just set up /etc/X11/xorg.conf using nvidia-xconfig ?

None. Just switch the Monitors. You can of course also create an xorg.conf setting the nvidia gpu as single gpu but then the intel gpu won’t work anymore so X won’t start if you disconnect the egpu casing.