Notifications
Clear all

A script to change Xorg config  

 of  16
  RSS

nu_ninja
(@nu_ninja)
Reputable Member
Joined: 3 years ago
 

@morv

I believe the script was written with nvidia in mind, so change 'nvidia' to 'amdgpu' in the xorg.conf.egpu file and that should work.

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

 
2012 13" MacBook Pro [3rd,2C,M] + RX 460 @ 10Gbps-TB1 (AKiTiO Thunder2) + macOS 10.14.4 [build link]  


ReplyQuote
Morv
 Morv
(@morv)
Eminent Member
Joined: 4 years ago
 

@nu_ninja I know that and set the driver accordingly, should've mentioned it probably. The GPU is also recognized and listed by lspci, also the amdgpu driver module is loaded even without the xorg.conf.egpu being renamed by the script.

I'm on kernel 4.19.2.

Edit: Ok, got it to work by moving the config to /etc/X11/xorg.conf.d/ where all the other configs are put. Now the displays are driven by the external gpu, will modify the script towards this Smile I have basically no relevant knowledge about all the configs, so maybe this is a thing the way Arch Linux is set up? Restarting the display manager is enough though! This reduces the amount of time a lot for switching between external and internal GPUs.

Edit2:
This is my change to the script, switched several times now, works surprisingly fine. Wouldn't have thought to get the eGPU running that fast. Thanks a lot for the starting point @Sebulon.

#!/bin/sh

if [ $(whoami) != "root" ]; then
 echo "You need to be root."
 exit
fi

if [ "${1}" = "egpu" ]; then
  if [ -h /etc/X11/xorg.conf.d/10-amdegpu.conf ] && \
     [ -f /etc/X11/xorg.conf.d/10-amdegpu.conf.egpu ] && \
     [ "$(readlink /etc/X11/xorg.conf.d/10-amdegpu.conf)" = "/etc/X11/xorg.conf.d/10-amdegpu.conf.egpu" ]; then
    echo -n "You are already set up. Would you like to relog now? (Y/n): "
    read ANSWER
    case ${ANSWER} in
      Y|y|Yes|yes)
        `systemctl restart sddm`
      ;;
      N|n|No|no)
        exit 0
      ;;
      *)
        echo "Unknown argument: ${ANSWER}."
        exit 1
      ;;
    esac
  else
    ln -s /etc/X11/xorg.conf.d/10-amdegpu.conf.egpu /etc/X11/xorg.conf.d/10-amdegpu.conf
    `systemctl restart sddm`
  fi
elif [ "${1}" = "internal" ]; then
  if [ -h /etc/X11/xorg.conf.d/10-amdegpu.conf ] && \
     [ -f /etc/X11/xorg.conf.d/10-amdegpu.conf.egpu ] && \
     [ "$(readlink /etc/X11/xorg.conf.d/10-amdegpu.conf)" = "/etc/X11/xorg.conf.d/10-amdegpu.conf.egpu" ]; then 
    rm -f /etc/X11/xorg.conf.d/10-amdegpu.conf
    `systemctl restart sddm`
  else
    echo -n "You are already set up. Would you like to relog now? (Y/n): "
    read ANSWER
    case ${ANSWER} in
      Y|y|Yes|yes)
        `systemctl restart sddm`
      ;;
      N|n|No|no)
        exit 0
      ;;
      *)
        echo "Unknown argument: ${ANSWER}."
        exit 1
      ;;
    esac
  fi
else
  echo "Unknown argument: ${1}."
  echo "Valid arguments are \"egpu\" or \"internal\"."
  exit 1
fi

To do: Create my signature with system and expected eGPU configuration information to give context to my posts. I have no builds.

.

itsage and nu_ninja liked
ReplyQuote
Sebulon
(@sebulon)
Trusted Member
Joined: 2 years ago
 

@Morv

I really dig your changes, I'm going to test them out and see what changes. About the authorizing part, I was just too lazy to do it every time so I've put this into udev:
/etc/udev/rules.d/99-local.rules

ACTION=="add", SUBSYSTEM=="thunderbolt", ATTR{authorized}=="0", ATTR{authorized}="1"

So it just authorizes everything that's plugged in, while I wait for the KDE team to fix Bolt into Plasma. Nice choice of desktop by the way 😉 Rocking KDE Neon myself.

Now, about the changes you made, can we have that conversation up on GitHub instead, and push the changes there, so it gets tracked, please? I'm not a fan of Git myself but this is a conversation worth having!

To do: Create my signature with system and expected eGPU configuration information to give context to my posts. I have no builds.

.

Morv and itsage liked
ReplyQuote
itsage
(@itsage)
Illustrious Member Admin
Joined: 4 years ago
 

Thank you all for making this process easier in Linux!

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

 
2021 15" ASUS TUF Dash F15 [11th,4C,H] + RTX 3080 @ 32Gbps-TB4 (AORUS Gaming Box) + Win10 2004 // my 3rd RTX 3080 build [build link]  


ReplyQuote
Sebulon
(@sebulon)
Trusted Member
Joined: 2 years ago
 

Huuuge update! The script now has a full fledged GUI frontend! Top post updated! 🙂

To do: Create my signature with system and expected eGPU configuration information to give context to my posts. I have no builds.

.

itsage liked
ReplyQuote
itsage
(@itsage)
Illustrious Member Admin
Joined: 4 years ago
 
Posted by: Sebulon

Huuuge update! The script now has a full fledged GUI frontend! Top post updated! 🙂

Thank you very much! I will give it a try soon and report back.

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

 
2021 15" ASUS TUF Dash F15 [11th,4C,H] + RTX 3080 @ 32Gbps-TB4 (AORUS Gaming Box) + Win10 2004 // my 3rd RTX 3080 build [build link]  


ReplyQuote
mzo
 mzo
(@mzo)
Active Member
Joined: 4 years ago
 

@Sebulon

Great stuff, thank you.

I'm sort of stuck at  " BUS_ID=$(nvidia-xconfig --query-gpu-info | grep -i -A 3 '1080ti' | awk '/PCI BusID/{print$4}')" as  nvidia-xconfig returns that cannot provide GPU info. There I understood that the Nvidia drivers are not working. The eGPU is recognized OK and can get the bus id from " lswh -c video " but it appears that the open-source Nouveau drivers that come with Ubuntu are preventing the proprietary Nvidia drivers that I installed from " ppa:graphics-drivers/ppa " from working (although they appear installed OK). I read somewhere that Nouveau drivers need to be blacklisted to prevent this kind of problems. Do You have any advices about this? Shall I download the drivers directly from Nvidia and go through manual installation? How do I block the pre-installed Nouveau and prevent them from creating conflicts?

Thanks again

To do: Create my signature with system and expected eGPU configuration information to give context to my posts. I have no builds.

.

ReplyQuote
Sebulon
(@sebulon)
Trusted Member
Joined: 2 years ago
 

Hey @mzo!

Can you just run the command:

# nvidia-xconfig --query-gpu-info

And paste the output here, please?

To do: Create my signature with system and expected eGPU configuration information to give context to my posts. I have no builds.

.

ReplyQuote
mzo
 mzo
(@mzo)
Active Member
Joined: 4 years ago
 

Hi @Sebulon,

The output is: "ERROR: Unable to query GPU information"

 

To do: Create my signature with system and expected eGPU configuration information to give context to my posts. I have no builds.

.

ReplyQuote
Sebulon
(@sebulon)
Trusted Member
Joined: 2 years ago
 
Posted by: mzo

Hi @Sebulon,

The output is: "ERROR: Unable to query GPU information"

Hi @mzo!

I was able to reproduce your issue and have a solution _that works for me_! I'm not sure if the mainline kernel is actually needed, maybe just purging everything related to nvidia is enough, but this is how I did it.

Note here that the order _is_ important! Install the mainline kernel first, then make sure to purge everything related to "nvidia", then install the latest driver again.

wget  http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.19/linux-headers-4.19.0-041900_4.19.0-041900.201810221809_all.deb 
wget  http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.19/linux-headers-4.19.0-041900-generic_4.19.0-041900.201810221809_amd64.deb 
wget  http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.19/linux-image-unsigned-4.19.0-041900-generic_4.19.0-041900.201810221809_amd64.deb 
wget  http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.19/linux-modules-4.19.0-041900-generic_4.19.0-041900.201810221809_amd64.deb 
sudo dpkg -i linux-headers-4.19.0-041900_4.19.0-041900.201810221809_all.deb
sudo dpkg -i linux-headers-4.19.0-041900-generic_4.19.0-041900.201810221809_amd64.deb
sudo dpkg -i linux-modules-4.19.0-041900-generic_4.19.0-041900.201810221809_amd64.deb
sudo dpkg -i linux-image-unsigned-4.19.0-041900-generic_4.19.0-041900.201810221809_amd64.deb
rm -f linux-headers-4.19.0-041900_4.19.0-041900.201810221809_all.deb
rm -f linux-headers-4.19.0-041900-generic_4.19.0-041900.201810221809_amd64.deb
rm -f linux-modules-4.19.0-041900-generic_4.19.0-041900.201810221809_amd64.deb
rm -f linux-image-unsigned-4.19.0-041900-generic_4.19.0-041900.201810221809_amd64.deb
dpkg --list | awk '/nvidia/{print$2}' | xargs sudo apt-get purge -y
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update
sudo apt-get install -y nvidia-driver-410
reboot

And to uninstall everything, if you're not satisfied:

sudo dpkg -P linux-image-unsigned-4.19.0-041900-generic
sudo dpkg -P linux-modules-4.19.0-041900-generic
sudo dpkg -P linux-headers-4.19.0-041900-generic
sudo dpkg -P linux-headers-4.19.0-041900
dpkg --list | awk '/nvidia/{print$2}' | xargs sudo apt-get purge -y
sudo add-apt-repository --remove ppa:graphics-drivers/ppa
reboot

I'm not sure if the mainline kernel is actually neccessary, but as I said, this works for me. Hope this solves the issue with "nvidia-xconfig" for you as well.

To do: Create my signature with system and expected eGPU configuration information to give context to my posts. I have no builds.

.

ReplyQuote
 of  16