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.
Nice to see eGPU on Linux is getting easier to implement. We'd love to see a build guide when you have time.
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