Linux eGPU in Ubuntu 18.04 works flawlessly
I have a Mid-2012 Macbook Pro with 16GB ram and 2TB SSD. The eGPU is an Aorus Gaming Box 1080. I am using it as a native GPU for my laptop, full internal screen acceleration, able to run Steam Proton games, Blender rendering and CUDA. Without any major hassles or setup steps.
What I did -
- Installed Ubuntu 18.04.
- Installed Nvidia 396 proprietary drivers.
- Ensured I had nvidia-prime installed.
- In the terminal ran prime-select nvidia.
- For first time boot added boot parameter "nvidia-drm.modeselect=1". Didn't have to do this for any later logins.
- GTX 1080 was recognised and used by system as native GPU. Internal screen is automatically accelerated. All apps use the eGPU by default.
- Connected eGPU to my UHD (4K?) TV via HDMI. TV screen was recognised instantly by the system and set to its max resolution.
Have since upgraded to Nvidia 410, without any issues.
No hotplugging. Since it is used as native GPU needs to be connected at login. If you want you can disconnect eGPU at login and system simply uses the iGPU.
What you would expect from a eGPU on a TB1 connection. Thankfully since the screen resolution is 1280x720, there are no performance bottlenecks. I have attached screenshots for Heaven benchmark using internal screen and UHD TV.
My experience with Ubuntu 18.04 has been so good that I no longer login to MacOS. Its only purpose is to serve as a means for my iphone/ipad backups. I don't see any need to use macos anymore. Apple makes us jump through two many hoops for simple things, OR pay tonnes of money.
I am planning to see if I can get Unreal Editor running in Proton on my setup. Will update if that works.
My laptop is due an upgrade. I am need to decide between the XPS 13 or 15 or Alienware 13r3. With Linux now an absolute viable replacement to windows and macos for my needs and my ability to run MacOS in Virtualbox, I don't think I will be getting a new macbook for some years now.
This is good stuff! Perhaps a link/guide to installing Ubuntu natively on Mac may round up this guide really well.
So if I read this correctly, you're able to boot with or without your eGPU plugged in? My setup with an AMD card wasn't quite as nice and this is something I'm still figuring out.
@mac_editor : For installing Ubuntu 18.04 I did the following,
- Download latest live CD from Ubuntu site
- Use Unetbootin to write the cd onto a USB drive
- I use refind on my macbook pro. They have an excellent guide for installing refind in macos. Refind automatically lists all bootable drives - internal and external.
- So connect usb, reboot and select the Ubuntu boot option in refind menu.
- To install Ubuntu without installing grub, since I have refind, I started the installer from the terminal using this command - "ubiquity --no-bootloader"
- Then follow the prompts of the installer and ensure to select to install proprietary drivers.
- Once the installer is done, reboot, remove USB drive and select the Ubuntu option from refind menu.
- In Ubuntu, open terminal use "sudo apt install nvidia-driver-xxx" to install latest nvidia drivers.
- After the install is done run the command "prime-select nvidia".
- Once this is done Reboot.
- On refind menu select "Ubuntu" option and press <tab>. Enter this at the end of the boot options "nvidia-drm.modeselect=1". This is one time. I have not had to use it again.
- Press enter after setting the boot option, boot into Ubuntu and enjoy!
This will work best in a Macbook or laptop with only iGPU and eGPU with Nvidia card. For other systems it could require more steps to configure the drivers.
@nu_ninja : I haven't looked into this carefully but I can see prime-select makes a custom boot image with the nvidia drivers as the main/sole drivers at boot. I believe this allows the "nvidia-settings" software to kick in and set everything up. For systems with a dGPU or AMD eGPU, this would mean figuring out how to generate custom boot image(s) that work similarly.
Btw, prime-select is a python script. If you are so inclined, you can check them out and see if they can be modified to help out with your configuration.
Also, if I don't connect the eGPU at boot and hot plug it after booting, it is still recognised and it works for CUDA and rendering. I only have issues getting Steam to use it and run games. I've found that in linux with the latest kernels installed, eGPU over thunderbolt is pretty much plug and play for using it for non-gaming tasks.
Thanks for the tip. I think I've got it working pretty well now. I pretty much copied the config file from the Arch wiki on prime and added a second server layout block with the iGPU as primary. Here's my full configuration file:
Section "ServerLayout" Identifier "layout" Screen 0 "intel" Inactive "amdgpu" EndSection Section "ServerLayout" Identifier "egpu" Screen 0 "amdgpu" Inactive "intel" EndSection Section "Device" Identifier "amdgpu" Driver "amdgpu" BusID "PCI:10:0:0" #BusID in decimal, convert from hex # Option "AllowEmptyInitialConfiguration" # Option "AllowExternalGpus" EndSection Section "Screen" Identifier "amdgpu" Device "amdgpu" EndSection Section "Device" Identifier "intel" Driver "intel" BusID "PCI:0:2:0" EndSection Section "Screen" Identifier "intel" Device "intel" EndSection
so logging in normally starts with the iGPU, but logging in through the console (Ctrl-Alt-F1) and running
startx -- -layout egpu
starts a session with the eGPU as primary. This fixed my problem of starting up with or without the eGPU connected.
I'd definitely like to see more eGPU on linux, it seems pretty plug and play with nvidia and not too bad with amd either once you figure it out, but more complex setups could prove otherwise.
Hi, my late 2016 MacBook pro 13,3 (15 inch w Touch Bar) is setup as tri-boot with macOS HS, win 10 and Ubuntu 18.10 with kernel 4.19. I have an eGPU Nvidia 1080ti with Akitio thunder 3 mod’ed. eGPU all setup to work under MacOS and win.
I’m now trying to set this up under Linux. I got the system recognize the box and egpu and next step will be to install CUDA to use it for GPU rendering, etc with 3D apps. However, I would like to also try to use the egpu as primary gpu under Linux and deactivate intel iGPU and Radeon 460 dGPU (also because amdgpu driver is not very stable as the card gets too hot and some times it shuts down producing kernel panic).
Would you mind elaborate a little more the steps in regard to drivers to use (open source vs proprietary) and how to configure Xorg and exactly what kernel parameters to add to /etc/default/grub in order to achieve what you achieved but with a dGPU in the mix? Thanks!
I'd use the nvidia proprietary drivers as that's what most people seem to have used so far on this forum. You can try an x config like the one from the sticky which should just use the egpu as the primary and only graphics device.
I see sebulon has given you similar advice in the other sticky thread. That'll do a similar thing but fully automated so I'd try that method first
I have not been able to resolve getting the driver working with the egpu - the external system is recognized by lspci but that is all. Has anyone posted details of what makes this work?
I'm using an old MacBook Pro 13 2011 with an Aorus gaming box 1080, via apple TB3-->TB1/2 adapter, as well. It works pretty great, when driving the internal display! Followed the instructions in the OP. Here's how I installed the nVidia drivers. I used: ubuntu-drivers devices to make sure the system was seeing my 1080 And then: sudo ubuntu-drivers autoinstall to install the nvidia driver Here's my benchmarks: Unigine Heaven 4.0: pts/unigine-heaven-1.6.4 [Resolution: 1280 x 800 - Mode: Fullscreen - Renderer: OpenGL] Test 1 of 1 Estimated Trial Run Count: 3 Estimated Time To Completion: 15 Minutes [12:28 EST] Started Run 1 @ 12:13:54 Started Run 2 @ 12:18:33 Started Run 3 @ 12:23:07 Resolution: 1280 x 800 - Mode: Fullscreen - Renderer: OpenGL: 102.786 103.542 104.161 Average: 103.50 Frames Per Second Deviation: 0.67%
has anyone tried this on Minx dual boot ?
wanting to upgrade my pc dual boot Minx OS but not sure if this will work ?
Using Ubuntu 19.10 [am running egpu from internal display] - after enabling thunderbolt, blacklist nouveau, install drivers, configure xorg file (basic steps) - I was also stuck because I would get screen to hang at boot. I had to do these additional steps [involved booting to terminal as well and removing xorg file if needing to boot into desktop temporarily]:
With the xorg file configured (adding the bus id , etc... AllowEmptyIntialConfiguration... AllowExternalGpus..." - you can find these templates on many forum posts)...
Once you save that file, and then reinstall Nvidia driver manually from website (you need at least 2 different versions of the file in order to make this work so as to install a different version) - and then let Nvidia recreate Xorg file for you - the template Nvidia software created was different and I was able to tweak it. Here was the output (added BusID and also made sure that eGPU videocard was listed under Screen):
Section "ServerLayout" Identifier "Default Layout" Screen 0 "Screen0" 0 0 InputDevice "Keyboard0" "CoreKeyboard" InputDevice "Mouse0" "CorePointer" EndSection Section "Module" Load "modesetting" Load "glx" EndSection Section "InputDevice" Identifier "Keyboard0" Driver "kbd" EndSection Section "InputDevice" Identifier "Mouse0" Driver "mouse" Option "Protocol" "auto" Option "Device" "/dev/psaux" Option "Emulate3Buttons" "no" Option "ZAxisMapping" "4 5" EndSection Section "Device" Identifier "Videocard0" Driver "nvidia" VendorName "NVIDIA Corporation" BusID "PCI:61:0:0" Option "AllowEmptyInitialConfiguration" Option "AllowExternalGpus" "True" Option "Coolbits" "4" EndSection Section "Device" Identifier "Videocard1" Driver "nvidia" VendorName "NVIDIA Corporation" BusID "PCI:1:0:0" EndSection Section "Screen" Identifier "Screen0" Device "Videocard0" DefaultDepth 24 SubSection "Display" Depth 24 EndSubSection EndSection
I have a Lenovo Thinkpad X1 Extreme 1st Gen Laptop dGPU (1050ti maxq) as well as eGPU (2080ti). Then it hung again after about a week of use, and I booted to terminal and installed driver again (remember that there are 2 drivers downloaded - so switched back to that other driver file for install) - had Nvidia recreate the Xorg file from previous Xorg file - and got this:
Section "ServerLayout" Identifier "Default Layout" Screen 0 "Screen0" 0 0 InputDevice "Keyboard0" "CoreKeyboard" InputDevice "Mouse0" "CorePointer" EndSection Section "Module" Load "modesetting" Load "glx" EndSection Section "InputDevice" Identifier "Keyboard0" Driver "kbd" EndSection Section "InputDevice" Identifier "Mouse0" Driver "mouse" Option "Protocol" "auto" Option "Device" "/dev/psaux" Option "Emulate3Buttons" "no" Option "ZAxisMapping" "4 5" EndSection Section "Monitor" Identifier "Monitor0" VendorName "Unknown" ModelName "Unknown" Option "DPMS" EndSection Section "Device" Identifier "Videocard0" Driver "nvidia" VendorName "NVIDIA Corporation" BusID "PCI:61:0:0" EndSection Section "Device" Identifier "Videocard1" Driver "nvidia" VendorName "NVIDIA Corporation" BusID "PCI:1:0:0" EndSection Section "Screen" Identifier "Screen0" Device "Videocard0" Monitor "Monitor0" DefaultDepth 24 Option "AllowEmptyInitialConfiguration" Option "AllowExternalGpus" "True" Option "Coolbits" "4" SubSection "Display" Depth 24 EndSubSection EndSection
Just to add to previous post - had to tweak Xorg file - but you will see where I tweaked if you follow those steps - and other thing I had to do was to tweak BIOS settings. I had to do more than just allow Thunderbolt connection. I had to switch to hybrid graphics, No boot time delay, Diagnostic boot - no Thunderbolt security, Pre Boot ACL (authorization with user intervention) - basically the timing of the boot sequence has to be exactly right...
So I didn't see anybody posting these things which is why I am doing so. It was not as easy for me as just using a basic xorg file.