Can not hotplug HDMI on Dell XPS nVidia Optimus [SOLVED]

Help for Current Versions of MX
When asking for help, use Quick System Info from MX Tools. It will be properly formatted using the following steps.
1. Click on Quick System Info in MX Tools
2. Right click in your post and paste.
Message
Author
d.j.yotta
Posts: 50
Joined: Fri Dec 06, 2019 1:39 am

Can not hotplug HDMI on Dell XPS nVidia Optimus [SOLVED]

#1 Post by d.j.yotta »

Hi all, thanks for all your contributions to such a stable and current OS!

I am working with a friend's Dell XPS laptop to help him get his nVidia GT525M working.

I will paste the usual stats tomorrow when I can get another chance to power it up.

In the mean time, I'd just like to get the ball rolling, so please bear with me...
  • The system was running LinuxMint for many years with no issue. Everything worked automatically.
  • For various reasons, LinuxMint upgrade was not possible (I think user error having had installed no longer supported 32bit LinuxMint but I don't know for sure)
  • The last version of LinuxMint that was working is unknown, but could be inferred (was EOL recently).
  • So, now where MX comes in...
  • My friend had heard me praise MX so got that installed (32bit :confused: for some reason).
  • But while it all worked fine, the one problem was that no display could be connected to HDMI.
  • He installed the nVidia drivers through the mx installer and system wouldn't boot into graphics after that.
This is when I was asked to help out.
  • I could switch to VT2 and login and uninstall the nVidia drivers using the mx installer. Reboot it all came up fine (ie, not broken - HDMI not working though)
  • I figured the 32bit install was probably the reason why the drivers borked.
  • I fresh installed 64bit MX 21.3, and installed the nVidia drivers using the mx installer and accepting defaults (YES to "is this an Optimus sytem?")
  • HDMI still not working.
  • I thought I would try LinuxMint 21, since we knew that (some version) worked earlier. But...
  • LinuxMint 21 MBR/GPT hybrid USB boot disk does not boot on this machine. I've gotten LM 21 live to boot only with Ventoy, but even then there is no display manager/login manager running/working. I think it's crashing and restarting repeatedly because every time I switch to VT2 it switches back to VT7 (or whichever) in a few seconds. I can stop this madness by logging in on VT2 and entering runlevel 3. However, I had no success in fixing the system from there. I could try again as I had no internet access at the time so couldn't do much. Without a graphical environment, troubleshooting/fixing is difficult. I can manually type in a config, or copy it over via usb if I know it will work. Otherwise I basically written off LinuxMint... (Please excuse my rant. I am pretty mad about their useless boot disk if you can't tell)
So I found this absolute gem: viewtopic.php?t=59687&hilit=optimus+hdmi&start=120 ([Solved] HDMI output to external monitor not working)

Following the solution there worked a treat.

To make the config stick, I have the following startup (login) script via MX autostart program menu (what arandr saved + optirun + exec arandr)

Code: Select all

#!/bin/sh
optirun intel-virtual-output;
xrandr --output VIRTUAL3 --off --output VIRTUAL2.....
exec arandr
I added the

Code: Select all

exec aranadr
because otherwise the layout didn't seem to take effect when HDMI connected before startup.

When HDMI is not already connected during startup, then, when it is connected, it is sufficient to load the saved layout through (the automatically opened on login) arandr is enough.
I do not need to apply the layout, only load it.

Once the HDMI cable is unplugged, then the HDMI will no longer be detected after plugging back in.

As a work around, log out and log in makes it come right.

So here is what works:
  • connected at boot up (I think it's login that counts)
  • connected after login, and applying the screen layout with the arandr instance that was opened by the login script
What does not work:
  • Switching to VT2 and back to VT7 - screen freezes - reboot fixes it
  • Any attempt to re-connect the display once it has already been connected
So basically a one-shot set up

I'm wondering if anyone can confirm whether or not it's possible to get hotplugging the HDMI cable working?

Also wondering if anyone can advise whether it's worth trying to get LinuxMint or Ubuntu live booted and try apply same/similar config there to see if that works?

As much as I'm not a fan of Ubuntu, at this point, I think my friend will want whatever works. Hopefully this can be MX Linux.

NOTE: I'll edit this post tomorrow to include the system stats, and the MX quick info, but for now:

System model: XPS 15 L502X
Bios version: A12 (latest)
Gfx: nVidia GT 525M, Intel integrated
OS: MXLinux 21.3 AHS 64 bit
Driver in use: nVidia

Code: Select all

System:    Kernel: 6.0.0-6mx-amd64 [6.0.12-1~mx21+1] x86_64 bits: 64 compiler: gcc v: 10.2.1 
           parameters: BOOT_IMAGE=/boot/vmlinuz-6.0.0-6mx-amd64 
           root=UUID=<filter> ro quiet splash 
           init=/lib/systemd/systemd 
           Desktop: Xfce 4.18.0 tk: Gtk 3.24.24 info: xfce4-panel wm: xfwm 4.18.0 vt: 7 
           dm: LightDM 1.26.0 Distro: MX-21.3_ahs_x64 Wildflower January 15  2023 
           base: Debian GNU/Linux 11 (bullseye) 
Machine:   Type: Portable System: Dell product: Dell System XPS L502X v: N/A serial: <filter> 
           Chassis: type: 8 v: 0.1 serial: <filter> 
           Mobo: Dell model: 0YR8NN v: A00 serial: <filter> UEFI-[Legacy]: Dell v: A12 
           date: 09/07/2012 
Battery:   ID-1: BAT0 charge: 6.2 Wh (100.0%) condition: 6.2/57.7 Wh (10.7%) volts: 12.4 min: 11.1 
           model: SIMPLO Dell type: Li-ion serial: <filter> status: Full 
CPU:       Info: Dual Core model: Intel Core i5-2410M bits: 64 type: MT MCP arch: Sandy Bridge 
           family: 6 model-id: 2A (42) stepping: 7 microcode: 2F cache: L2: 3 MiB 
           flags: avx lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 18357 
           Speed: 1713 MHz min/max: 800/2900 MHz Core speeds (MHz): 1: 2295 2: 2295 3: 2295 
           4: 2295 
           Vulnerabilities: Type: itlb_multihit status: KVM: VMX disabled 
           Type: l1tf mitigation: PTE Inversion; VMX: conditional cache flushes, SMT vulnerable 
           Type: mds mitigation: Clear CPU buffers; SMT vulnerable 
           Type: meltdown mitigation: PTI 
           Type: mmio_stale_data status: Unknown: No mitigations 
           Type: retbleed status: Not affected 
           Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via prctl 
           Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer sanitization 
           Type: spectre_v2 mitigation: Retpolines, IBPB: conditional, IBRS_FW, STIBP: 
           conditional, RSB filling, PBRSB-eIBRS: Not affected 
           Type: srbds status: Not affected 
           Type: tsx_async_abort status: Not affected 
Graphics:  Device-1: Intel 2nd Generation Core Processor Family Integrated Graphics vendor: Dell 
           driver: i915 v: kernel bus-ID: 00:02.0 chip-ID: 8086:0116 class-ID: 0300 
           Device-2: NVIDIA GF108M [GeForce GT 525M] vendor: Dell driver: nvidia v: 390.157 
           bus-ID: 01:00.0 chip-ID: 10de:0df5 class-ID: 0300 
           Device-3: Quanta Laptop_Integrated_Webcam_2HDM type: USB driver: uvcvideo 
           bus-ID: 1-1.4:3 chip-ID: 0408:2fb1 class-ID: 0e02 
           Display: x11 server: X.Org 1.20.14 compositor: xfwm4 v: 4.18.0 driver: loaded: intel 
           display-ID: :0.0 screens: 1 
           Screen-1: 0 s-res: 2390x768 s-dpi: 96 s-size: 632x203mm (24.9x8.0") 
           s-diag: 664mm (26.1") 
           Monitor-1: LVDS1 res: 1366x768 hz: 60 dpi: 102 size: 340x190mm (13.4x7.5") 
           diag: 389mm (15.3") 
           Monitor-2: VIRTUAL1 res: 1024x768 hz: 60 
           OpenGL: renderer: Mesa Intel HD Graphics 3000 (SNB GT2) v: 3.3 Mesa 22.0.5 
           compat-v: 3.1 direct render: Yes 
Audio:     Device-1: Intel 6 Series/C200 Series Family High Definition Audio vendor: Dell 
           driver: snd_hda_intel v: kernel bus-ID: 00:1b.0 chip-ID: 8086:1c20 class-ID: 0403 
           Device-2: NVIDIA GF108 High Definition Audio vendor: Dell driver: snd_hda_intel 
           v: kernel bus-ID: 01:00.1 chip-ID: 10de:0bea class-ID: 0403 
           Sound Server-1: ALSA v: k6.0.0-6mx-amd64 running: yes 
           Sound Server-2: PulseAudio v: 14.2 running: yes 
           Sound Server-3: PipeWire v: 0.3.19 running: yes 
Network:   Device-1: Intel Centrino Wireless-N 1030 [Rainbow Peak] driver: iwlwifi v: kernel 
           modules: wl port: 3000 bus-ID: 03:00.0 chip-ID: 8086:008a class-ID: 0280 
           IF: wlan0 state: up mac: <filter> 
           Device-2: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet vendor: Dell 
           driver: r8169 v: kernel port: 2000 bus-ID: 06:00.0 chip-ID: 10ec:8168 class-ID: 0200 
           IF: eth0 state: down mac: <filter> 
Bluetooth: Device-1: Intel Centrino Advanced-N 6230 Bluetooth adapter type: USB driver: btusb 
           v: 0.8 bus-ID: 4-1.5:3 chip-ID: 8086:0189 class-ID: e001 
           Report: hciconfig ID: hci0 rfk-id: 1 state: up address: <filter> bt-v: 2.0 lmp-v: 3.0 
           sub-v: fc00 hci-v: 3.0 rev: 1b07 
           Info: acl-mtu: 310:10 sco-mtu: 64:8 link-policy: rswitch hold sniff park 
           link-mode: slave accept service-classes: rendering, capturing, object transfer, audio 
Drives:    Local Storage: total: 465.76 GiB used: 18.92 GiB (4.1%) 
           SMART Message: Unable to run smartctl. Root privileges required. 
           ID-1: /dev/sda maj-min: 8:0 vendor: Samsung model: SSD 860 EVO 500GB size: 465.76 GiB 
           block-size: physical: 512 B logical: 512 B speed: 6.0 Gb/s type: SSD serial: <filter> 
           rev: 2B6Q scheme: MBR 
Partition: ID-1: / raw-size: 97.66 GiB size: 95.56 GiB (97.86%) used: 6.7 GiB (7.0%) fs: ext4 
           dev: /dev/sda1 maj-min: 8:1 
           ID-2: /home raw-size: 368.1 GiB size: 361.26 GiB (98.14%) used: 12.23 GiB (3.4%) 
           fs: ext4 dev: /dev/sda2 maj-min: 8:2 
Swap:      Alert: No swap data was found. 
Sensors:   System Temperatures: cpu: 63.0 C mobo: 38.0 C 
           Fan Speeds (RPM): N/A 
Repos:     Packages: note: see --pkg apt: 2009 lib: 999 flatpak: 0 
           No active apt repos in: /etc/apt/sources.list 
           Active apt repos in: /etc/apt/sources.list.d/debian-stable-updates.list 
           1: deb http://deb.debian.org/debian bullseye-updates main contrib non-free
           Active apt repos in: /etc/apt/sources.list.d/debian.list 
           1: deb http://deb.debian.org/debian bullseye main contrib non-free
           2: deb http://security.debian.org/debian-security bullseye-security main contrib non-free
           Active apt repos in: /etc/apt/sources.list.d/mx.list 
           1: deb http://mx.debian.nz/mx/repo/ bullseye main non-free
           2: deb http://mx.debian.nz/mx/repo/ bullseye ahs
Info:      Processes: 235 Uptime: 7m wakeups: 1 Memory: 7.66 GiB used: 2.01 GiB (26.2%) 
           Init: systemd v: 247 runlevel: 5 default: 5 tool: systemctl Compilers: gcc: 10.2.1 
           alt: 10 Client: shell wrapper v: 5.1.4-release inxi: 3.3.06 
Boot Mode: BIOS (legacy, CSM, MBR)
Last edited by d.j.yotta on Thu Jul 13, 2023 8:43 pm, edited 2 times in total.

User avatar
CharlesV
Global Moderator
Posts: 7789
Joined: Sun Jul 07, 2019 5:11 pm

Re: Can not hotplug HDMI on Dell XPS nVidia Optimus

#2 Post by CharlesV »

I can confirm hotplugging hdmi works on my nvidia system. (intel onboard video, nvidia card added.)
*QSI = Quick System Info from menu (Copy for Forum)
*MXPI = MX Package Installer
*Please check the solved checkbox on the post that solved it.
*Linux -This is the way!

d.j.yotta
Posts: 50
Joined: Fri Dec 06, 2019 1:39 am

Re: Can not hotplug HDMI on Dell XPS nVidia Optimus

#3 Post by d.j.yotta »

Thanks CharlesV.

Do you have Optimus system with Bumblebee? Did you do anything to get it working or does it just work out-of-the-box for you?

User avatar
CharlesV
Global Moderator
Posts: 7789
Joined: Sun Jul 07, 2019 5:11 pm

Re: Can not hotplug HDMI on Dell XPS nVidia Optimus

#4 Post by CharlesV »

d.j.yotta wrote: Thu Jul 13, 2023 4:50 pm Thanks CharlesV.

Do you have Optimus system with Bumblebee? Did you do anything to get it working or does it just work out-of-the-box for you?
I do not use bumblebee. I have an HP with intel on board and then I added an nvidia card, added the drivers for it. I brought the system up to test and provide me with the understanding of how to run BOTH controllers at the same time. (something that continues to be a problem for people. )

I also have two laptops with Intel and Nvidia on board (also not an issue with multiple video and hdmi hot plug - but I either have nvidiafb or nouveau on them. ) The dell laptop I have for testing is only Intel UHD Graphics 620 on board.
*QSI = Quick System Info from menu (Copy for Forum)
*MXPI = MX Package Installer
*Please check the solved checkbox on the post that solved it.
*Linux -This is the way!

User avatar
CharlesV
Global Moderator
Posts: 7789
Joined: Sun Jul 07, 2019 5:11 pm

Re: Can not hotplug HDMI on Dell XPS nVidia Optimus

#5 Post by CharlesV »

Two additional things I noticed from your QSI ...
1) you are using the 6.0.0 kernel which is known for some oddities. I would strongly suggest that you move to either 6.2 kernel (my favorite) or a 6.3 kernel. (6.1 will also be better than 6.0, but imo .. not as good as 6.2 )
and
2) Your not running a swap file and while some places / people will say you dont need one with enough ram ... there *are* some applications / utilities / processes that will run better if there is one. (You dont have to use it, just 'should' have one. AND your QSI shows 8gb ram with over a quarter of that used!) The good news is that you can add a swap file at any time and here’s how:
https://www.digitalocean.com/community/ ... -debian-11
*QSI = Quick System Info from menu (Copy for Forum)
*MXPI = MX Package Installer
*Please check the solved checkbox on the post that solved it.
*Linux -This is the way!

d.j.yotta
Posts: 50
Joined: Fri Dec 06, 2019 1:39 am

Re: Can not hotplug HDMI on Dell XPS nVidia Optimus

#6 Post by d.j.yotta »

OK, so here has what I tried:
  • purge nVidia drivers
  • full system upgrade
  • install linux-6.3.0 and headers
  • mv /etc/X11/xorg.conf.d/20-intel.conf to .bak similarly /usr/share/X11...
  • reboot (sanity check if free drivers work)
  • can not detect HDMI at all
  • installed nVidia driver
  • reboot - still no joy
  • restore bumblebee nvidia conf and 20-intel.conf as per the thread I linked above
  • reboot - all good (hotplug not working though)
2) Your not running a swap file and while some places / people will say you dont need one with enough ram ... there *are* some applications / utilities / processes that will run better if there is one. (You dont have to use it, just 'should' have one. AND your QSI shows 8gb ram with over a quarter of that used!) The good news is that you can add a swap file at any time and here’s how:
https://www.digitalocean.com/community/ ... -debian-11
Yeah, I didn't bother with setting up swap yet - will get a working system first. May need to switch distro if I can't get this working. It's working good enough for me, but my friend is not a linux guru so would rather it works without these quirks.

I guess log off/on is clear enough work around, but I can see it being a pain if you have you presentation all ready to go and then realise you have to log out and back in again to get the external display working...

d.j.yotta
Posts: 50
Joined: Fri Dec 06, 2019 1:39 am

Re: Can not hotplug HDMI on Dell XPS nVidia Optimus

#7 Post by d.j.yotta »

OK, so I just noticed that, although arandr couldn't reapply the layout after hotplugging, the Display app could (note that on the 6.0 kernel neither arandr nor Display app could get the monitor going again after hotplug).

So I've commented out all but

Code: Select all

optirun intel-virtual-output
in my autostart script, rebooted and confirm the following work:
  • connected at startup
  • hotplug - needs Display to be opened and monitors enabled (and virtual-1 disabled - not sure it matters, but it's clutter)
What is still not working nicely
  • Display app profiles doesn't seem to work. I can save them and it is saved somewhere because I can't save again with same name, but the profile does not show in the list of matching profiles
  • have to reorder the displays every time
I'm going to do some more experiments with some xrandr commands at startup so that the virtual display is disabled and hopefully less of a pain having to move the displays around to get them in the correct order.

d.j.yotta
Posts: 50
Joined: Fri Dec 06, 2019 1:39 am

Re: Can not hotplug HDMI on Dell XPS nVidia Optimus

#8 Post by d.j.yotta »

OK, so I discovered that the layout saved by arandr works just fine as long as the Display app is not open when it is run.

To recap, applying the solution in the MX Forum thread I linked above, on the 6.3 kernel woks.

The magic conf files:

Code: Select all

cat /etc/X11/xorg.conf.d/20-intel.conf
Section "Device"
    Identifier "intelgpu0"
    Driver "intel"
#    Option "VirtualHeads" "2"
EndSection

Code: Select all

cat /usr/share/X11/xorg.conf.d/20-intel.conf
Section "Device"
    Identifier "intelgpu0"
    Driver "intel"
#    Option "VirtualHeads" "2"
EndSection
And the bumblebee xorg conf (I left the default provided by the package commented out):

Code: Select all

cat /etc/bumblebee/xorg.conf.nvidia 
Section "ServerLayout"
    Identifier  "Layout0"
    Option      "AutoAddDevices" "true"
    Option      "AutoAddGPU" "false"
EndSection

Section "Device"
    Identifier  "DiscreteNvidia"
    Driver      "nvidia"
    VendorName  "NVIDIA Corporation"
    Option "ProbeAllGpus" "false"
    Option "NoLogo" "true"
    Option "AllowEmptyInitialConfiguration"
EndSection

Section "Screen"
    Identifier "Screen0"
    Device "DiscreteNVidia"
EndSection

#Section "ServerLayout"
#    Identifier  "Layout0"
#    Option      "AutoAddDevices" "false"
#    Option      "AutoAddGPU" "false"
#EndSection
#
#Section "Device"
#    Identifier  "DiscreteNvidia"
#    Driver      "nvidia"
#    VendorName  "NVIDIA Corporation"
#
##   If the X server does not automatically detect your VGA device,
##   you can manually set it here.
##   To get the BusID prop, run `lspci | egrep 'VGA|3D'` and input the data
##   as you see in the commented example.
##   This Setting may be needed in some platforms with more than one
##   nvidia card, which may confuse the proprietary driver (e.g.,
##   trying to take ownership of the wrong device). Also needed on Ubuntu 13.04.
##   BusID "PCI:01:00:0"
#
##   Setting ProbeAllGpus to false prevents the new proprietary driver
##   instance spawned to try to control the integrated graphics card,
##   which is already being managed outside bumblebee.
##   This option doesn't hurt and it is required on platforms running
##   more than one nvidia graphics card with the proprietary driver.
##   (E.g. Macbook Pro pre-2010 with nVidia 9400M + 9600M GT).
##   If this option is not set, the new Xorg may blacken the screen and
##   render it unusable (unless you have some way to run killall Xorg).
#    Option "ProbeAllGpus" "false"
#
#    Option "NoLogo" "true"
#    Option "UseEDID" "false"
#    Option "UseDisplayDevice" "none"
#    Option "HardDPMS" "false"
#EndSection

Here is my autostart (on login) script:

Code: Select all

!/bin/sh
# optirun definitely required
optirun intel-virtual-output
xrandr --output LVDS1 --primary --mode 1366x768 --pos 0x0 --rotate normal --output DP1 --off --output HDMI1 --off --output VGA1 --off --output VIRTUAL1 --below LVDS1 --off --output VIRTUAL2 --mode VIRTUAL2.679-1680x1050 --right-of LVDS1 --rotate normal --output VIRTUAL3 --off
# no need to open arandr since upgrade from 6.0 to 6.3 kernel
#exec arandr
After hotplugging, just run the script without arandr or Display app open.

I am confident I can make a menu entry so my friend can run the script at the click of a button, so this is good enough for me.

I'm going to mark this as solved now.
Last edited by d.j.yotta on Thu Jul 13, 2023 8:43 pm, edited 1 time in total.

User avatar
CharlesV
Global Moderator
Posts: 7789
Joined: Sun Jul 07, 2019 5:11 pm

Re: Can not hotplug HDMI on Dell XPS nVidia Optimus

#9 Post by CharlesV »

Good work!
*QSI = Quick System Info from menu (Copy for Forum)
*MXPI = MX Package Installer
*Please check the solved checkbox on the post that solved it.
*Linux -This is the way!

Post Reply

Return to “MX Help”