1
0
Fork
You've already forked egpu-switcher
0
🖥🐧 Setup script for eGPUs in Linux (X.Org)
  • Go 90.6%
  • Makefile 5.6%
  • Shell 3.8%
2025年01月26日 21:32:11 +01:00
.ci Add Continuous Integration ( #89 ) 2022年09月17日 22:06:17 +00:00
.github update github action for publishing aur package 2025年01月26日 21:32:11 +01:00
.pkg/aur Add Continuous Integration ( #89 ) 2022年09月17日 22:06:17 +00:00
cmd custom x11 config feature ( #123 ) 2025年01月26日 21:01:15 +01:00
internal custom x11 config feature ( #123 ) 2025年01月26日 21:01:15 +01:00
.gitignore Add Continuous Integration ( #89 ) 2022年09月17日 22:06:17 +00:00
FUNDING.yml add FUNDING.yml to repository 2020年06月17日 12:10:09 +02:00
go.mod bump go version to 1.23, update dependencies ( #124 ) 2025年01月26日 21:09:10 +01:00
go.sum bump go version to 1.23, update dependencies ( #124 ) 2025年01月26日 21:09:10 +01:00
LICENSE added license file 2019年02月16日 20:57:13 +01:00
main.go first commit with golang code 2022年07月16日 01:54:46 +02:00
Makefile Add Continuous Integration ( #89 ) 2022年09月17日 22:06:17 +00:00
README.md add docs for custom x11 config in readme 2025年01月26日 21:23:10 +01:00
TROUBLESHOOT.md Update and clean up README.md 2020年10月20日 23:39:24 +02:00

egpu-switcher

Distribution agnostic eGPU script that works with NVIDIA and AMD cards.

License Information

Description

The goal of this CLI is to lower the barrier for Linux users to use their eGPU on the Linux Desktop. With the egpu-switcher config command the user can choose their external GPU. On every bootup the service will check if the eGPU is connected and if so, make X.Org prefer it.

Note

No hotplugging is possible. Users still need to reboot their computer to connect / disconnect the eGPU.

Requirements

  • Running X.Org
  • Thunderbolt connection to eGPU is authorized
  • Necessary graphics drivers for eGPU are installed

Installation

Ubuntu (apt)

The PPA is no longer maintained for now (see #90)

Arch (aur)

paru -S egpu-switcher

Tip

🌳 Save time and energy by using the pre-compiled egpu-switcher-bin package

Manual

Installation and setup

Download binary from latest release

Copy binary to /opt, apply proper permissions, and link it in /usr/bin

sudo cp <downloaded-binary> /opt/egpu-switcher
sudo chmod 755 /opt/egpu-switcher
sudo ln -s /opt/egpu-switcher /usr/bin/egpu-switcher
sudo egpu-switcher enable

Uninstall

sudo egpu-switcher disable --hard
sudo rm /usr/bin/egpu-switcher
sudo rm /opt/egpu-switcher

Build

Prerequisites

Install the go toolchain

Installation and setup

git clone git@github.com:hertg/egpu-switcher.git
cd egpu-switcher
make build -s
sudo make install -s
sudo egpu-switcher enable

Uninstall

sudo egpu-switcher disable --hard
sudo make uninstall -s

Commands

Usage:
 egpu-switcher [command]
Available Commands:
 config Choose your external GPU
 disable Disable egpu-switcher from running at startup
 enable Enable egpu-switcher to run at startup
 help Help about any command
 switch Check if eGPU is present and configure X.org accordingly
 version Print version information
Flags:
 -h, --help help for egpu-switcher
 -v, --verbose verbose output
Use "egpu-switcher [command] --help" for more information about a command.

Configuration

The config file is created automatically and can be found at /etc/egpu-switcher/config.yaml. Below you can see an example of a configuration file, annotated with additional information.

egpu:# the 'driver' and 'id' configs are generated by 'egpu-switcher config'.# you probably shouldn't change this manually unless you understand why.driver:amdgpuid:1153611719250962689# OPTIONAL: do not load 'modesetting' in the egpu confignomodesetting:false# OPTIONAL: how many times 'egpu-switcher switch auto' should retry finding the egpu.# this can be helpful if the egpu takes some time to connect on your machine,# the following values are the default.detection:retries:6interval:500# milliseconds# OPTIONAL: if you want to execute a script after switching to egpu/internal.# the values must be absolute paths to a shell script, this script will# then be run with '/bin/sh $script'.# # it is required that the script is owned by root (uid 0) # and has a permission of -rwx------ (0700).hooks:internal:/home/michael/tmp/internal.shegpu:/home/michael/tmp/egpu.sh

Custom X11 config

Since version 0.20.0, a custom x11 config template can be configured by creating a file at /usr/share/egpu-switcher/x11-template.conf. The default template is shown below, you can use it as a starting point.

# autogenerated by egpu-switcher
{{if .Modesetting}}
Section "Module"
 Load "modesetting"
EndSection
{{end}}
Section "Device"
 Identifier "{{.Id}}"
 Driver "{{.Driver}}"
 BusID "{{.Bus}}"
 Option "AllowEmptyInitialConfiguration"
 Option "AllowExternalGpus" "True"
EndSection

Tip

For safety, and to stop egpu-switcher from printing warnings, the file should be owned by root:root and have a mode of 644.


Troubleshooting

If you run into problems, please have a look at TROUBLESHOOT.md before reporting any issues.