egpu-switcher: eGPU on Linux - Easy-to-use setup script (2024)

hertg

(@hertg)

Active Member

Joined: 5 years ago

Posts: 17

April 21, 2019 12:32 pm

Hello there,

I have created a script which automatically detects your (E)GPUs and creates the needed X-Server configuration files.
You won't have to mess around with finding the correct BUS-IDs and convert them from dec to hex or anything like that, the script takes care of it.

Just execute the setup command and choose which GPU is the internal, and which the external one.
After that, your computer will automatically detect on startup wheter your EGPU is connected or not, and decides which X-Server configuration it is going to use.

For further information, please refer to the README in my Github Repository.
You'll also find all the source code in there.

Installation
Connect your EGPU to your computer and make sure the Thunderbolt connection is authorized. Then execute the following commands.

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

No more steps needed, your computer will automatically select the correct X-Server configuration on startup.

Disclaimer
I am using this script with my Lenovo Thinkpad X1 Extreme (Hybrid graphics with a Nvidia GTX 1050 Ti). My EGPU is a GTX 1080 in a Mantiz MZ-02 VENUS enclosure.
This was only tested in Ubuntu 19.04, but it might work in other distros / versions too.
As i have no AMD GPU, this was only tested with Nvidia, but theoretically AMD GPUs could work too. Would be great if someone could test that and report back if it works. egpu-switcher: eGPU on Linux - Easy-to-use setup script (3) Update: @itsage successfully tested it, and it does work with AMD GPUs as well. There seem to be issues in using 5K+ displays, but those are unlikely to be directly related to the script.

Why yet another script

I was initially quite overwhelmed by the steps i had to take in order to make my EGPU work with Ubuntu. As i had no knowledge about X-Server and why i needed to tamper around with it. I created this project mainly to learn more about X-Server, GPUs in Linux and how to publish packages for Ubuntu.
I am in no means an expert, and there certainly are some bugs, but i've tried my best and hope that someone may find it useful.

If this script doesn't work for you
Please let me know or feel free to create a pull request.
Also, the whole setup process can be reverted by executing egpu-switcher cleanup or by removing the package completely with apt remove --purge egpu-switcher. This command will even restore your previous xorg.conf file, if you had one.

Please also refer to these other great projects if mine doesn't work for you:

  • https://egpu.io/forums/thunderbolt-linux-setup/a-script-to-change-xorg-config/
  • https://egpu.io/forums/thunderbolt-linux-setup/xorg-conf-generator-and-switcher/

Notebook: Lenovo ThinkPad X1 Extreme (GTX 1050 Max-Q Ti)
EGPU: Mantiz MZ-02 VENUS (GTX 1080)
OS: Arch (LightDM, dwm)


fake2die, lan mi, Dolphin and 10 people liked

ReplyQuote

itsage

(@itsage)

Founder Admin

Joined: 8 years ago

Builds: 159

Posts: 7762

April 21, 2019 1:33 pm

@hertg Welcome aboard and thank you for this simple-to-use script! I will try it on my Alienware 15R3 [Nvidia GTX 1070 dGPU] with an AMD eGPU and report back.

LinkedIn | Youtube | Instagram

external graphics card builds
best laptops for external GPU
eGPU enclosure buyer's guide


2017 21" iMac 4K (RP555) [7th,4C] + RX 6800 @ 32Gbps-TB3 (Netstor HL23T-Plus) + macOS 13 & Win11 22H2 [build link]


ReplyQuote

hertg

(@hertg)

Active Member

Joined: 5 years ago

Posts: 17

April 21, 2019 1:48 pm

@itsage
Thanks, looking forward to it!
I hope that "amdgpu" is the correct driver name to use in the xorg.conf, cause that's what i currently write into it, if the GPU has "AMD" in its name.

Notebook: Lenovo ThinkPad X1 Extreme (GTX 1050 Max-Q Ti)
EGPU: Mantiz MZ-02 VENUS (GTX 1080)
OS: Arch (LightDM, dwm)


ReplyQuote

mac_editor

(@mac_editor)

Famed Member Moderator

Joined: 7 years ago

Builds: 13

Posts: 3558

April 21, 2019 2:37 pm

Super-happy to see eGPU on Linux get easier and easier. Wish I had a bare metal Linux machine to experiment + a bunch of time.

"Desultory reading is delightful, but to be beneficial, our reading must be carefully directed." — Seneca

Author: kryptonitepurge-wranglertbt-flashpurge-nvdaset-eGPU
Insights Into macOS Video Editing Performance
Launching Apps on Specific (e)GPUs on macOS
Definitive macOS Thunderbolt eGFX Compatibility Registry

Master Threads:
2014 15-inch MacBook Pro 750M
2018 15-inch MacBook Pro


2019 13" MacBook Pro [8th,4C,U] + RX Vega 64 @ 32Gbps-TB3 (Mantiz Venus) + macOS 10.14.6 & Win10 [build link]


phila-delphia liked

ReplyQuote

hertg

(@hertg)

Active Member

Joined: 5 years ago

Posts: 17

April 21, 2019 9:07 pm

@itsage Great to hear that it (somewhat) works with AMD GPUs.
That's a very strange behaviour indeed. I never tested it with a 4k+ monitor, but it works for me with the monitors below.

Unfortunately, I don't think that i can do much about that issue in my script, since all it does is creating an xorg.conf file with the following contents:

Section "Module" Load "modesetting"EndSectionSection "Device" Identifier "Device0" Driver "<your-driver>" BusID "<your-bus-id>" Option "AllowEmptyInitialConfiguration" Option "AllowExternalGpus" "True"EndSection

For the integrated graphics: Did you disable the integrated graphics in the BIOS? Because that is what i had to do, in order to install Ubuntu 19.04. I then re-enabled it later after the installation was complete. If you connected your internal display directly to the dedicated GPU, i think you should still see the integrated graphics, but i might be wrong about that (?).

It's also kind of strange, why your Wireless Network Adapter shows up in the list, would you mind posting the output of the following command: lspci | grep -Ei "3d|vga"
Also try executing thelspcicommand without grep, and see if your integrated graphics shows up in this list.

Which nvidia drivers do you have installed currently? I am on nvidia-418.
I will post the results of my system below, maybe it helps you in finding a possible issue.

sudo apt list --installed *nvidia*

lspci | grep -Ei "3d|vga"

uname -a

Notebook: Lenovo ThinkPad X1 Extreme (GTX 1050 Max-Q Ti)
EGPU: Mantiz MZ-02 VENUS (GTX 1080)
OS: Arch (LightDM, dwm)


Madlink and itsage liked

ReplyQuote

nu_ninja

(@nu_ninja)

Reputable Member

Joined: 6 years ago

Builds: 4

Posts: 489

April 21, 2019 9:39 pm

Looks like the wifi card is on bus 61 which in hex is "3D"

Mid-2012 13" Macbook Pro (MacBookPro9,2) TB1 -> RX 460/560 (AKiTiO Node/Thunder2)
+ macOS 10.15+Win10 + Linux Mint 19.1


2022 14" Lenovo ThinkPad T14s Gen 3 (680M) [R6K,8C,U] + RX 580 @ 32Gbps-USB4v1 (AKiTiO Node) + Linux Fedora Silver Blue 36 & Win11 [build link]


hertg liked

ReplyQuote

OliverB

(@oliverb)

Noble Member

Joined: 6 years ago

Builds: 23

Posts: 1490

April 21, 2019 9:45 pm

@hertg
why are you using an nVidia eGPU? Common sense is that AMD is much better supported in Linux, isn't it?

2018 15" MBP & 2015 13" MBP connected to RTX2080Ti GTX1080Ti GTX1080 Vega56 RX580 R9-290 GTX680


2018 15" MacBook Pro (RP560X) [8th,6C,H] + RX 5700 XT @ 32Gbps-TB3 (ASUS XG Station Pro) + macOS 10.15.4 & Win10 1809 // Navi vs Radeon VII vs GTX 1080 Ti [build link]


ReplyQuote

hertg

(@hertg)

Active Member

Joined: 5 years ago

Posts: 17

April 21, 2019 9:52 pm

@oliverb
I made a switch from using a desktop to using a notebook + egpu, so the GTX 1080 is the one i had in my desktop previously.
Yes, as far as i know, AMD does publish their drivers open source, therefore it can be better integrated into Linux. I'm still hoping Nvidia might do the same someday.

Notebook: Lenovo ThinkPad X1 Extreme (GTX 1050 Max-Q Ti)
EGPU: Mantiz MZ-02 VENUS (GTX 1080)
OS: Arch (LightDM, dwm)


OliverB liked

ReplyQuote

egpu-switcher: eGPU on Linux - Easy-to-use setup script (2024)

References

Top Articles
Latest Posts
Article information

Author: Kareem Mueller DO

Last Updated:

Views: 6401

Rating: 4.6 / 5 (66 voted)

Reviews: 89% of readers found this page helpful

Author information

Name: Kareem Mueller DO

Birthday: 1997-01-04

Address: Apt. 156 12935 Runolfsdottir Mission, Greenfort, MN 74384-6749

Phone: +16704982844747

Job: Corporate Administration Planner

Hobby: Mountain biking, Jewelry making, Stone skipping, Lacemaking, Knife making, Scrapbooking, Letterboxing

Introduction: My name is Kareem Mueller DO, I am a vivacious, super, thoughtful, excited, handsome, beautiful, combative person who loves writing and wants to share my knowledge and understanding with you.