Thunderbolt hotplug Display doesn't work

Hello guys

I am running nixos on my macbook air (I think it’s a mid 2014), which I connect to my LG Widescreen Monitor with a thunderbolt cable.

The screen doesn’t work out of the box. When I want to use it, I need to start my Laptop, then restart the laptop again and wait about 3 seconds in the boot menu until I manually press Enter. On the first start, without any interaction in the boot menu or when I wait shorter/longer before pressing enter in the boot menu, the display wont be found by the system.

I guess this has to do with hotplugging of thunderbolt. Since the monitor itself goes into standby when I wait too long (and for some reason also if I don’t wait that 3 seconds and start faster). It is also impossible to unplug the monitor and plug it back in once the system is started.

My config looks like this:

#ALL Edit this configuration file to define what should be installed on
# your system.  Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).

{ config, pkgs, ... }:

{

  # For Package maintenance
  nix.useSandbox = true;

  imports =
    [ # Include the results of the hardware scan.
      <nixos-hardware/apple/macbook-air/6>
      ./hardware-configuration.nix
      ./mopidy.nix
    ];

  # garbage collect
  nix.gc.automatic = true;
  nix.gc.dates = "weekly";
  nix.gc.options = "--max-freed $((64 * 1024**3))";

  fileSystems."/mnt/nas" = {
    device = "//DNS-320/Volume_1";
    fsType = "cifs";
    options = [ "vers=1.0" "x-systemd.automount" "noauto" "hard" "intr" "noexec" "credentials=/etc/nixos/smd.cred" ];
  };

  # Hardware stuff
  sound.enable = true;
  hardware.pulseaudio = {
    # For steam
    support32Bit = true;
    package = pkgs.pulseaudioFull.override { jackaudioSupport = true; };
    enable = true;
    # necessary for mopidy to work
    extraConfig = ''
load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1
'';
  };
  # For steam
  hardware.opengl.driSupport32Bit = true;

  boot.extraModprobeConfig = ''
      options hid_apple fnmode=2
    '';

   boot.kernelPatches = [ {
     name = "thunderbolt";
     patch = null;
     extraConfig = ''
       THUNDERBOLT y
       HOTPLUG_PCI y
       HOTPLUG_PCI_ACPI y
     '';
  } ];
  services.acpid.enable = true;


  nixpkgs.config.packageOverrides = pkgs: {
    # linux = pkgs.linuxPackages.override {
    #   extraConfig = ''
    #     THUNDERBOLT y
    #     CONFIG_HOTPLUG_PCI y
    #     CONFIG_HOTPLUG_PCI_ACPI y
    #   '';
    # };
    qtile = pkgs.qtile.overrideAttrs (oldAttrs: { src = /home/sam/projects/qtile; });
  };

  # Use the systemd-boot EFI boot loader.
  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;

  # boot.loader.grub.efiSupport = true;
  # boot.loader.grub.efiInstallAsRemovable = true;
  # boot.loader.efi.efiSysMountPoint = "/boot/efi";
  # Define on which hard drive you want to install Grub.
  boot.loader.grub.device = "/dev/sda"; # or "nodev" for efi only

  # Since it will build Virtualbox manually, i don't really want to use it...
  # virtualisation.virtualbox.host = {
  #   enable = true;
  #   enableExtensionPack = true;
  # };

  virtualisation.libvirtd = {
    enable = true;
    onShutdown = "suspend";
    qemuRunAsRoot = false;
  };


  networking.hostName = "Waluigi"; # Define your hostname.
  networking.networkmanager.enable = true;
  # networking.wireless = {
  #   userControlled.enable = true;
  # };
  # networking.wireless.enable = true;  # Enables wireless support via wpa_supplicant.

  # Select internationalisation properties.
  i18n = {
    consoleFont = "Lat2-Terminus16";
    consoleKeyMap = "sg";
    defaultLocale = "en_US.UTF-8";
  };

  # Set your time zone.
  time.timeZone = "Europe/Zurich";

  nixpkgs.config.allowUnfree = true;
  # List packages installed in system profile. To search, run:
  # $ nix search wget
  environment.systemPackages = with pkgs; [
    # mgmt
    ## network
    wget
    curl
    sshfs
    nmap
    rsync

    ## process
    psmisc # things like killall
    htop

    ## Hardware
    lshw
    usbutils
    thunderbolt

    ## file
    xfce.thunar
    file
    zip
    unzip

    ## project
    git

    ## shell
    screen
    powerline-fonts

    ## virtualisation
    virtmanager

    ## backup
    borgbackup

    # editor / viewer
    neovim # Config manual in .config/nvim/
    # oni (packet must exist first)
    ## PDF viewer
    apvlv

    # xorg
    xorg.setxkbmap
    gtk3
    #wpgtk

    # musicstuff
    lxqt.pavucontrol-qt
    jack2Full
    # this is necessecary for midi! (and the jack startupscript)
    a2jmidid
    qjackctl
    #libjack2
    ardour
    audacity
    mixxx
    cadence
    ## tuner
    lingot
    rakarrack
    jack_capture
    guitarix

    ## plugins & instruments
    zynaddsubfx
    klick
    jack_rack
    zam-plugins
    x42-plugins
    yoshimi
    swh_lv2
    caps
    soundfont-fluid
    samplv1
    qsampler

    # random stuff
    ## mistype
    gti
    sl
  ];
  nixpkgs.overlays = [ (self: super: with self; {
      qtile = super.qtile.override {
        python27Packages = python36Packages;
      };
  }) ];

  # Some programs need SUID wrappers, can be configured further or are
  # started in user sessions.
  programs.bash.enableCompletion = true;
  # programs.mtr.enable = true;
  # programs.gnupg.agent = { enable = true; enableSSHSupport = true; };

  fonts.fonts = with pkgs; [
    powerline-fonts
  ];

  # List services that you want to enable:

  # Enable the OpenSSH daemon.
  # services.openssh.enable = true;

  # Open ports in the firewall.
  # networking.firewall.allowedTCPPorts = [ ... ];
  # networking.firewall.allowedUDPPorts = [ ... ];
  # Or disable the firewall altogether.
  networking.firewall.enable = true;

  # Enable CUPS to print documents.
  services.printing.enable = false;

  # Enable the X11 windowing system.
  services.xserver =
  {
    enable = true;
    desktopManager = {
      default = "none";
      xterm.enable = true;
    };
    windowManager.qtile.enable = true;
    displayManager.sddm.enable = true;
    layout = "ch";
    xkbOptions = "caps:none";
  };
  # This is necessary for wpgtk
  programs.dconf.enable = true;
  # services.xserver.xkbOptions = "eurosign:e";

  # Enable touchpad support.
  # services.xserver.libinput.enable = true;

  # Audio lock configs
  security.pam.loginLimits = [
    { domain = "@audio"; item = "memlock"; type = "-"; value = "unlimited"; }
    { domain = "@audio"; item = "rtprio"; type = "-"; value = "99"; }
    { domain = "@audio"; item = "nofile"; type = "soft"; value = "99999"; }
    { domain = "@audio"; item = "nofile"; type = "hard"; value = "99999"; }
  ];
  # Define a user account. Don't forget to set a password with ‘passwd’.
  users.extraUsers.sam = {
    isNormalUser = true;
    description = "Samuel Ruprecht";
    uid = 1000;
    hashedPassword = "$6$W1EiUVW6$SCZligh3CBEEehkQ60oasW4UkeI3P2DX52Nc1ZEGyP1zMNX6BfVl1OPHu/q.K9lwYH5jJmJmuDyeySoB0YkvU/";
    extraGroups = ["wheel" "networkmanager" "libvirtd" "audio"];
  };
  #users.users.sam.packages = [ pkgs.steam ];
 
  # Plugin directories
  environment.shellInit = ''
    export VST_PATH=/nix/var/nix/profiles/default/lib/vst:/var/run/current-system/sw/lib/vst:~/.vst
    export LXVST_PATH=/nix/var/nix/profiles/default/lib/lxvst:/var/run/current-system/sw/lib/lxvst:~/.lxvst
    export LADSPA_PATH=/nix/var/nix/profiles/default/lib/ladspa:/var/run/current-system/sw/lib/ladspa:~/.ladspa
    export LV2_PATH=/nix/var/nix/profiles/default/lib/lv2:/var/run/current-system/sw/lib/lv2:~/.lv2
    export DSSI_PATH=/nix/var/nix/profiles/default/lib/dssi:/var/run/current-system/sw/lib/dssi:~/.dssi
  '';

  # This value determines the NixOS release with which your system is to be
  # compatible, in order to avoid breaking some software such as database
  # servers. You should change this only after NixOS release notes say you
  # should.
  system.stateVersion = "18.09"; # Did you read the comment?

}

As you can see, I added the kernel Configs HOTPLUG_PCI and HOTPLUG_ACPI which don’t seem to solve the problem.

This is the Journalctl log which always appears:

Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0: NHI initialized, starting thunderbolt
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0: allocating TX ring 0 of size 10
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0: allocating RX ring 0 of size 10
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0: control channel created
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0: control channel starting...
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0: starting TX ring 0
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0: enabling interrupt at register 0x38200 bit 0 (0x0 -> 0x1)
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0: starting RX ring 0
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0: enabling interrupt at register 0x38200 bit 12 (0x1 -> 0x1001)
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0: current switch config:
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:  Switch: 8086:1547 (Revision: 3, TB Version: 1)
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:   Max Port Number: 12
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:   Config:
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:    Upstream Port Number: 5 Depth: 0 Route String: 0x0 Enabled: 1, PlugEventsDelay: 255ms
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:    unknown1: 0x0 unknown4: 0x0
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0: initializing Switch at 0x0 (depth: 0, up port: 5)
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0: 0: uid: 0x1000d1c0b4000
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:  Port 0: 8086:1547 (Revision: 3, TB Version: 1, Type: Port (0x1))
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:   Max hop id (in/out): 7/7
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:   Max counters: 8
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:   NFC Credits: 0x700000
Dec 25 23:09:40 Waluigi kernel: applesmc: key=561 fan=1 temp=33 index=33 acc=0 lux=2 kbd=1
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:  Port 1: 8086:1547 (Revision: 3, TB Version: 1, Type: Port (0x1))
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:   Max hop id (in/out): 15/15
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:   Max counters: 16
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:   NFC Credits: 0x3c00000
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:  Port 2: 8086:1547 (Revision: 3, TB Version: 1, Type: Port (0x1))
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:   Max hop id (in/out): 15/15
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:   Max counters: 16
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:   NFC Credits: 0x3c00000
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0: 0:3: disabled by eeprom
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0: 0:4: disabled by eeprom
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:  Port 5: 8086:1547 (Revision: 3, TB Version: 1, Type: NHI (0x2))
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:   Max hop id (in/out): 11/11
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:   Max counters: 16
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:   NFC Credits: 0x700000
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:  Port 6: 8086:1547 (Revision: 3, TB Version: 1, Type: PCIe (0x100101))
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:   Max hop id (in/out): 8/8
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:   Max counters: 2
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:   NFC Credits: 0x700000
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:  Port 7: 8086:1547 (Revision: 3, TB Version: 1, Type: PCIe (0x100101))
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:   Max hop id (in/out): 8/8
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:   Max counters: 2
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:   NFC Credits: 0x700000
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:  Port 8: 8086:1547 (Revision: 3, TB Version: 1, Type: PCIe (0x100101))
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:   Max hop id (in/out): 8/8
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:   Max counters: 2
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:   NFC Credits: 0x700000
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:  Port 9: 8086:1547 (Revision: 3, TB Version: 1, Type: PCIe (0x100101))
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:   Max hop id (in/out): 8/8
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:   Max counters: 2
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:   NFC Credits: 0x700000
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0: 0:a: disabled by eeprom
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:  Port 11: 8086:1547 (Revision: 3, TB Version: 1, Type: DP/HDMI (0xe0101))
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:   Max hop id (in/out): 9/9
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:   Max counters: 2
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:   NFC Credits: 0xf0000b
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:  Port 12: 8086:1547 (Revision: 3, TB Version: 1, Type: DP/HDMI (0xe0101))
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:   Max hop id (in/out): 9/9
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:   Max counters: 2
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:   NFC Credits: 0xf00000
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0: 0:1: is connected, link is up (state: 2)
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0: current switch config:
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:  Switch: 8086:156d (Revision: 0, TB Version: 2)
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:   Max Port Number: 12
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:   Config:
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:    Upstream Port Number: 3 Depth: 1 Route String: 0x1 Enabled: 1, PlugEventsDelay: 255ms
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0:    unknown1: 0x0 unknown4: 0x0
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0: initializing Switch at 0x1 (depth: 1, up port: 3)
Dec 25 23:09:40 Waluigi kernel: applesmc applesmc.768: hwmon_device_register() is deprecated. Please convert the driver to use hwmon_device_register_with_info().
Dec 25 23:09:40 Waluigi kernel: media: Linux media interface: v0.10
Dec 25 23:09:40 Waluigi kernel: snd_hda_intel 0000:00:03.0: bound 0000:00:02.0 (ops vgt_balloon_space [i915])
Dec 25 23:09:40 Waluigi kernel: thunderbolt 0000:07:00.0: 1: reading drom (length: 0x6e)

This is some additional Log when it DOESN’T work (in 2 parts):

This is part 1 showing that the monitor goes into standby.

Dec 25 23:03:27 Waluigi kernel: thunderbolt 0000:07:00.0: resetting error on 0:1.
Dec 25 23:03:27 Waluigi kernel: thunderbolt 0000:07:00.0: 0:1: unplugged
...
Dec 25 23:03:27 Waluigi kernel: thunderbolt 0000:07:00.0: resetting error on 0:2.
Dec 25 23:03:27 Waluigi kernel: thunderbolt 0000:07:00.0: 0:2: got unplug event for disconnected port, ignoring
...
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: resetting error on 0:1.
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 0:1: hotplug: scanning
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 0:1: is connected, link is up (state: 2)
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: current switch config:
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0:  Switch: 8086:156d (Revision: 0, TB Version: 2)
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0:   Max Port Number: 12
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0:   Config:
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0:    Upstream Port Number: 0 Depth: 0 Route String: 0x0 Enabled: 0, PlugEventsDelay: 10ms
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0:    unknown1: 0x0 unknown4: 0x0
...
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: resetting error on 0:2.
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: initializing Switch at 0x1 (depth: 1, up port: 3)
...
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: resetting error on 1:b.
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: resetting error on 1:4.
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: resetting error on 1:a.
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: resetting error on 1:c.
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 1: reading drom (length: 0x6e)
...

But then it gets added again in the same second. Sepcial are the last lines saying hotplug: no switch found:

Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 1: uid: 0x1e000000000000
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0:  Port 0: 8086:156d (Revision: 0, TB Version: 1, Type: Port (0x1))
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0:   Max hop id (in/out): 7/7
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0:   Max counters: 8
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0:   NFC Credits: 0x700000
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0:  Port 1: 8086:156d (Revision: 0, TB Version: 1, Type: Port (0x1))
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0:   Max hop id (in/out): 15/15
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0:   Max counters: 16
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0:   NFC Credits: 0x3c00000
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0:  Port 2: 8086:156d (Revision: 0, TB Version: 1, Type: Port (0x1))
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0:   Max hop id (in/out): 15/15
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0:   Max counters: 16
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0:   NFC Credits: 0x3c00000
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0:  Port 3: 8086:156d (Revision: 0, TB Version: 1, Type: Port (0x1))
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0:   Max hop id (in/out): 15/15
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0:   Max counters: 16
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0:   NFC Credits: 0x3c00000
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0:  Port 4: 8086:156d (Revision: 0, TB Version: 1, Type: Port (0x1))
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0:   Max hop id (in/out): 15/15
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0:   Max counters: 16
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0:   NFC Credits: 0x3c00000
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 1:5: disabled by eeprom
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0:  Port 6: 8086:156d (Revision: 0, TB Version: 1, Type: PCIe (0x100102))
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0:   Max hop id (in/out): 8/8
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0:   Max counters: 2
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0:   NFC Credits: 0x700000
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0:  Port 7: 8086:156d (Revision: 0, TB Version: 1, Type: PCIe (0x100101))
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0:   Max hop id (in/out): 8/8
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0:   Max counters: 2
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0:   NFC Credits: 0x700000
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0:  Port 8: 8086:156d (Revision: 0, TB Version: 1, Type: PCIe (0x100101))
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0:   Max hop id (in/out): 8/8
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0:   Max counters: 2
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0:   NFC Credits: 0x700000
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 1:9: disabled by eeprom
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0:  Port 10: 8086:156d (Revision: 0, TB Version: 1, Type: DP/HDMI (0xe0102))
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0:   Max hop id (in/out): 9/9
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0:   Max counters: 2
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0:   NFC Credits: 0x700000
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 1:b: disabled by eeprom
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 1:c: disabled by eeprom
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 1:1: is unplugged (state: 7)
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 1: hotplug: activating pcie devices
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 0:6 <-> 1:6 (PCI): activating
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: activating path from 0:6 to 1:6
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 1:3: Writing hop 1, index 8
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 1:3:  Hop through port 6 to hop 8 (enabled)
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 1:3:   Weight: 1 Priority: 3 Credits: 16 Drop: 0
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 1:3:    Counter enabled: 0 Counter index: 2047
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 1:3:   Flow Control (In/Eg): 1/0 Shared Buffer (In/Eg): 0/0
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 1:3:   Unknown1: 0x0 Unknown2: 0x0 Unknown3: 0x0
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 0:6: Writing hop 0, index 8
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 0:6:  Hop through port 1 to hop 8 (enabled)
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 0:6:   Weight: 1 Priority: 3 Credits: 7 Drop: 0
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 0:6:    Counter enabled: 0 Counter index: 2047
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 0:6:   Flow Control (In/Eg): 1/1 Shared Buffer (In/Eg): 0/0
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 0:6:   Unknown1: 0x0 Unknown2: 0x0 Unknown3: 0x0
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: path activation complete
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: activating path from 1:6 to 0:6
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 0:1: Writing hop 1, index 8
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 0:1:  Hop through port 6 to hop 8 (enabled)
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 0:1:   Weight: 1 Priority: 3 Credits: 16 Drop: 0
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 0:1:    Counter enabled: 0 Counter index: 2047
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 0:1:   Flow Control (In/Eg): 1/0 Shared Buffer (In/Eg): 0/0
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 0:1:   Unknown1: 0x0 Unknown2: 0x0 Unknown3: 0x0
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 1:6: Writing hop 0, index 8
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 1:6:  Hop through port 3 to hop 8 (enabled)
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 1:6:   Weight: 1 Priority: 3 Credits: 7 Drop: 0
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 1:6:    Counter enabled: 0 Counter index: 2047
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 1:6:   Flow Control (In/Eg): 1/1 Shared Buffer (In/Eg): 0/0
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 1:6:   Unknown1: 0x0 Unknown2: 0x0 Unknown3: 0x0
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: path activation complete
Dec 25 23:03:28 Waluigi kernel: pciehp 0000:06:03.0:pcie204: Slot(3): Card present
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 0:2: hotplug: scanning
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 0:2: hotplug: no switch found
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 1:b: hotplug: scanning
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 1:b: hotplug: no switch found
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 1:4: hotplug: scanning
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 1:4: hotplug: no switch found
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 1:a: hotplug: scanning
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 1:a: hotplug: no switch found
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 1:c: hotplug: scanning
Dec 25 23:03:28 Waluigi kernel: thunderbolt 0000:07:00.0: 1:c: hotplug: no switch found
Dec 25 23:03:28 Waluigi kernel: pciehp 0000:06:03.0:pcie204: Slot(3): Link Up
Dec 25 23:03:28 Waluigi kernel: pciehp 0000:06:03.0:pcie204: Slot(3): Link Up event ignored; already powering on

Does anybody know why this problem occurs and how I can fix it? is there some kind of “switch” i must install/enable/configure so that the display can be initialized after hotplug?

And one other thing: The monitor has some USB ports, which work with hotplugging. Its really only the display that doesn’t work. Xrandr also only shows 1 source, as if the monitor wasn’t connected at all.

Thanks in advance if anybody takes the time and I would gladly upload more/more specific log or command outputs!

Hello @Melkor333,

My apologies for reviving such an old post but I guess I am hitting the same issue you had a few years ago.

I am also configuring my desktop environment without using a desktop manager.
I am currently using XMonad, my full configuration is available at GitHub - gautaz/phoenix: Because I want my Nix workspaces to rise from their ashes.

Display hotplug also fails with my current configuration but works when using the NixOS install ISO with both Gnome or KDE.
autorandr does not help as the additional displays do not appear in /sys/class/drm when I am hotplugging them through my USB-C dock.

So I guess Gnome and KDE people both found a (different?) way to ensure that display hotplugging is working but I have no idea how they did it.

Did you find a solution to your issue in the meantime?

Uh this is very long ago! I can’t even remember what the problem was :grimacing: That could’ve been the reason why I switched to Manjaro Linux for some time…

I currently use XMonad on a Thinkpad T14s Gen1 with a Docking Station and everything works - except that the kernel 6.0/6.1 has some regressions and external monitors via usb-c don’t work at all (it’s an AMD kernel module problem).

FWIW check out linux hardware to be sure the kernel modules are the right ones and if you have AMD, make sure you test with a kernel older than 6.0 (e.g. 5.15 - which funnily has broken Networking for my laptop. A real pitty since the 5.19 kernel isn’t in the Repos anymore!). The regression should be fixed with the upcoming 6.2 but since there are various amd-specific usb-c bugs (no monitors, freezes, etc.) I wouldn’t trust it.

From what I understand - if the display isn’t visible in sys/class/drm then it should be a problem with the usb-c connection/kernel module and not with the Xserver/window manager…

2 Likes

Thanks @Melkor333 for the followup after all these years :thumbsup:.

My current hardware is a Framework laptop (gen2) which relies on an i915 intel graphics card.
If this is related to a hardware/kernel issue, I will probably have to ask help from the Framework guys. My other laptop (lenovo) is also installed with NixOS/Gnome and hot plugging the same hardware seems to work well (USB-C dock with a switch between to workstations).

Anyway, if anyone has an idea about the best way to diagnose this type of issues, I guess I am not the only one interested :slightly_smiling_face:.

Have a nice day !

I use GNOME on a Framework gen 2 and a thunderbolt docking station and hot plug works. Perhaps try GNOME first before digging in?

Hello @ryantm, thanks for your suggestion.

In fact, I already know that it works with Gnome.
That is why I was wondering in a previous reply how Gnome or KDE developers ensured this behaviour:

So I guess Gnome and KDE people both found a (different?) way to ensure that display hotplugging is working but I have no idea how they did it.

Anyway, thanks for confirming that this also works on your framework laptop with Gnome.
If you happen to know how Gnome is ensuring a successful thunderbolt dock hotplug or have any insight on this matter, I am eager to read your further replies.

1 Like