Thunderbolt hotplugging in Ubuntu Linux











up vote
4
down vote

favorite
4












I have a Dell Precision M3800 and an OWC Thunderbolt 2 Dock. 
They both work together beautifully and everything seems to just work. 
I haven't tried the FireWire yet, but the Ethernet, USB3, DisplayPort and sound work great out of the box.



My system isn't completely happy with just yanking out the Thunderbolt cable and has occasionally hung when I've removed the dock; other times it has been fine. I would like to find a safer way and was hoping there might a mechanism where I could tell my system I was going to unplug and to gracefully take down the interfaces first.



I've tried searching for packages and info on Thunderbolt support in Linux and have only found Greg KH's blog saying that it will just work, but not mentioning any tools.



I haven't found any Thunderbolt-related packages in the Ubuntu repos for my 15.10 install.



Are there tools or /proc or /sys nodes I could use for this?










share|improve this question
























  • firewire works perfectly and is able to run soundcards with very low latency
    – Amias
    Nov 25 at 22:32















up vote
4
down vote

favorite
4












I have a Dell Precision M3800 and an OWC Thunderbolt 2 Dock. 
They both work together beautifully and everything seems to just work. 
I haven't tried the FireWire yet, but the Ethernet, USB3, DisplayPort and sound work great out of the box.



My system isn't completely happy with just yanking out the Thunderbolt cable and has occasionally hung when I've removed the dock; other times it has been fine. I would like to find a safer way and was hoping there might a mechanism where I could tell my system I was going to unplug and to gracefully take down the interfaces first.



I've tried searching for packages and info on Thunderbolt support in Linux and have only found Greg KH's blog saying that it will just work, but not mentioning any tools.



I haven't found any Thunderbolt-related packages in the Ubuntu repos for my 15.10 install.



Are there tools or /proc or /sys nodes I could use for this?










share|improve this question
























  • firewire works perfectly and is able to run soundcards with very low latency
    – Amias
    Nov 25 at 22:32













up vote
4
down vote

favorite
4









up vote
4
down vote

favorite
4






4





I have a Dell Precision M3800 and an OWC Thunderbolt 2 Dock. 
They both work together beautifully and everything seems to just work. 
I haven't tried the FireWire yet, but the Ethernet, USB3, DisplayPort and sound work great out of the box.



My system isn't completely happy with just yanking out the Thunderbolt cable and has occasionally hung when I've removed the dock; other times it has been fine. I would like to find a safer way and was hoping there might a mechanism where I could tell my system I was going to unplug and to gracefully take down the interfaces first.



I've tried searching for packages and info on Thunderbolt support in Linux and have only found Greg KH's blog saying that it will just work, but not mentioning any tools.



I haven't found any Thunderbolt-related packages in the Ubuntu repos for my 15.10 install.



Are there tools or /proc or /sys nodes I could use for this?










share|improve this question















I have a Dell Precision M3800 and an OWC Thunderbolt 2 Dock. 
They both work together beautifully and everything seems to just work. 
I haven't tried the FireWire yet, but the Ethernet, USB3, DisplayPort and sound work great out of the box.



My system isn't completely happy with just yanking out the Thunderbolt cable and has occasionally hung when I've removed the dock; other times it has been fine. I would like to find a safer way and was hoping there might a mechanism where I could tell my system I was going to unplug and to gracefully take down the interfaces first.



I've tried searching for packages and info on Thunderbolt support in Linux and have only found Greg KH's blog saying that it will just work, but not mentioning any tools.



I haven't found any Thunderbolt-related packages in the Ubuntu repos for my 15.10 install.



Are there tools or /proc or /sys nodes I could use for this?







ubuntu docking-station thunderbolt hotplug






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 24 at 22:08









Scott

15.5k113789




15.5k113789










asked Feb 29 '16 at 18:01









Amias

20838




20838












  • firewire works perfectly and is able to run soundcards with very low latency
    – Amias
    Nov 25 at 22:32


















  • firewire works perfectly and is able to run soundcards with very low latency
    – Amias
    Nov 25 at 22:32
















firewire works perfectly and is able to run soundcards with very low latency
– Amias
Nov 25 at 22:32




firewire works perfectly and is able to run soundcards with very low latency
– Amias
Nov 25 at 22:32










3 Answers
3






active

oldest

votes

















up vote
3
down vote



accepted










Thunderbolt is basically a PCIe bus exposed in the form of a user-friendly, pluggable interface. As you can imagine, hot-plugging a PCIe card in any machine isn't something you can expect to consistently do without problems - unless extreme care has been taken by the manufacturers of the host and removable devices as well as the developers of the mainboard firmware, device firmware, OS kernel, and device drivers.



All that is to say, there's a huge surface area of potential bugs and issues that would prevent this hot-plug from working the way we'd want it to. My recommendation would be to use a debug kernel and try to break into the debugger when it freezes - if you can, then it's probably not a hardware or firmware issue. Instructions on doing that are probably a little beyond the scope of the question or my reply here, but resources are available online that make this a bit easier.



Now if you want a means by which you can manually eject the device prior to yanking it, you can try the following:



After identifying the device address in the system in the output of lspci command, where DDDD:BB:DD.F is the Domain:Bus:Device.Function of the thunderbolt peripheral in question:



05:00.0 PCI bridge: Intel Corporation DSL3510 Thunderbolt Port [Cactus Ridge] (rev 03)
06:00.0 PCI bridge: Intel Corporation DSL3510 Thunderbolt Port [Cactus Ridge] (rev 03)
06:03.0 PCI bridge: Intel Corporation DSL3510 Thunderbolt Port [Cactus Ridge] (rev 03)
06:04.0 PCI bridge: Intel Corporation DSL3510 Thunderbolt Port [Cactus Ridge] (rev 03)
06:05.0 PCI bridge: Intel Corporation DSL3510 Thunderbolt Port [Cactus Ridge] (rev 03)
06:06.0 PCI bridge: Intel Corporation DSL3510 Thunderbolt Port [Cactus Ridge] (rev 03)
07:00.0 System peripheral: Intel Corporation DSL3510 Thunderbolt Port [Cactus Ridge] (rev 03)
08:00.0 PCI bridge: Intel Corporation DSL3510 Thunderbolt Controller [Cactus Ridge]
09:00.0 PCI bridge: Intel Corporation DSL3510 Thunderbolt Controller [Cactus Ridge]


you can execute the following:



echo "1" | sudo tee /sys/bus/pci/devices/DDDD:BB:DD.F/remove > /dev/null


Which should trigger the unload routines in the kernel and the driver (and possibly even in the device firmware), after which you might be able to eject it more-safely. (A grep in a subshell can obviously take the place of the DDDD:BB:DD.F for ease-of-use in the future).



Upon replugging the device, it might become necessary to manually rescan:



echo "1" | sudo tee /sys/bus/pci/rescan > /dev/null


(Or it might not be needed.)



I haven't used Linux in a while as I'm almost exclusively FreeBSD and OS X these days, so please forgive me if I'm off the mark on anything here.






share|improve this answer





















  • thanks for the pointers , its seems my system shows its thunderbolt parts differently , not sure which is the thunderbolt ? amias@rome:~$ lspci 00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor PCI Express x16 Controller (rev 06) 00:1c.0 PCI bridge: Intel Corporation 8 Series/C220 Series Chipset 08:00.0 PCI bridge: Intel Corporation Device 157e 0a:00.0 System peripheral: Intel Corporation Device 157d 0b:00.0 PCI bridge: Intel Corporation Device 156d 0c:00.0 PCI bridge: Intel Corporation Device 156d
    – Amias
    Mar 1 '16 at 13:22












  • See the vendor deviceid database here: pci-ids.ucw.cz/read/PC/8086 - you have quite a few matching thunderbolt results.
    – Mahmoud Al-Qudsi
    Mar 1 '16 at 15:14






  • 1




    With Linux kernel 4.13 the situation around Thunderbolt (3) improved quite a bit. For instance the Lenovo Thunderbolt 3 Dock now comes back online after suspend/ resume on current Debian 10 Buster (Testing) in contrast to the behavior of Debian 9 Stretch with kernel 4.9. Unplug/ replug still has issues
    – AdamKalisz
    Oct 29 '17 at 20:50










  • I second that, the mainline 4.13 kernel provides really strong thunderbolt support for displays, not having great luck with other peripherals and wired network yet.
    – Brandon Bertelsen
    Nov 4 '17 at 17:01


















up vote
2
down vote













it seems that if you lspci -vt you get a tree diagram that makes it a lot easier to spot the thunderbolt controller.



heres my output



amias@rome:~$ lspci -vt

-[0000:00]-+-00.0 Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor DRAM Controller
+-01.0-[02-03]----00.0 NVIDIA Corporation GK107GLM [Quadro K1100M]
+-02.0 Intel Corporation 4th Gen Core Processor Integrated Graphics Controller
+-03.0 Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor HD Audio Controller
+-04.0 Intel Corporation Device 0c03
+-14.0 Intel Corporation 8 Series/C220 Series Chipset Family USB xHCI
+-16.0 Intel Corporation 8 Series/C220 Series Chipset Family MEI Controller #1
+-1a.0 Intel Corporation 8 Series/C220 Series Chipset Family USB EHCI #2
+-1b.0 Intel Corporation 8 Series/C220 Series Chipset High Definition Audio Controller
+-1c.0-[04]--
+-1c.2-[06]----00.0 Intel Corporation Wireless 7260
+-1c.3-[07]----00.0 Realtek Semiconductor Co., Ltd. RTS5249 PCI Express Card Reader
+-1c.4-[08-40]----00.0-[09-40]--+-00.0-[0a]----00.0 Intel Corporation Device 157d
| -01.0-[0b-40]----00.0-[0c-40]--+-00.0-[0d]----00.0 Fresco Logic FL1100 USB 3.0 Host Controller
| +-01.0-[0e]----00.0 Intel Corporation I210 Gigabit Network Connection
| +-02.0-[0f]----00.0 Fresco Logic FL1100 USB 3.0 Host Controller
| +-03.0-[10]----00.0 LSI Corporation FW643 [TrueFire] PCIe 1394b Controller
| +-04.0-[11]--
| -05.0-[12-40]--
+-1d.0 Intel Corporation 8 Series/C220 Series Chipset Family USB EHCI #1
+-1f.0 Intel Corporation HM87 Express LPC Controller
+-1f.2 Intel Corporation 8 Series/C220 Series Chipset Family 6-port SATA Controller 1 [AHCI mode]
+-1f.3 Intel Corporation 8 Series/C220 Series Chipset Family SMBus Controller
-1f.6 Intel Corporation 8 Series Chipset Family Thermal Management Controller


this allowed me to find 1c.4 which appears to be my thunderbolt controller.



I then used mahmoud's suggestion to hit the remove node , this did seem to disconnect my thunderbolt dock cleanly , however when i reinserted it locked hard. This would suggest that other drivers are not so happy with the hotplugging or i would need to reset the thunderbolt device.



Either way , it was worse than just pulling it out.



I guess for now i just need to ensure everything is saved before undocking. I would welcome further suggestions if there are any.






share|improve this answer




























    up vote
    1
    down vote













    You can try suspending your system to RAM and then pull out the cable. This seems to be the only way I can unplug my Lenovo Thunderbolt 3 dock without rebooting.






    share|improve this answer





















      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "3"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1046928%2fthunderbolt-hotplugging-in-ubuntu-linux%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      3
      down vote



      accepted










      Thunderbolt is basically a PCIe bus exposed in the form of a user-friendly, pluggable interface. As you can imagine, hot-plugging a PCIe card in any machine isn't something you can expect to consistently do without problems - unless extreme care has been taken by the manufacturers of the host and removable devices as well as the developers of the mainboard firmware, device firmware, OS kernel, and device drivers.



      All that is to say, there's a huge surface area of potential bugs and issues that would prevent this hot-plug from working the way we'd want it to. My recommendation would be to use a debug kernel and try to break into the debugger when it freezes - if you can, then it's probably not a hardware or firmware issue. Instructions on doing that are probably a little beyond the scope of the question or my reply here, but resources are available online that make this a bit easier.



      Now if you want a means by which you can manually eject the device prior to yanking it, you can try the following:



      After identifying the device address in the system in the output of lspci command, where DDDD:BB:DD.F is the Domain:Bus:Device.Function of the thunderbolt peripheral in question:



      05:00.0 PCI bridge: Intel Corporation DSL3510 Thunderbolt Port [Cactus Ridge] (rev 03)
      06:00.0 PCI bridge: Intel Corporation DSL3510 Thunderbolt Port [Cactus Ridge] (rev 03)
      06:03.0 PCI bridge: Intel Corporation DSL3510 Thunderbolt Port [Cactus Ridge] (rev 03)
      06:04.0 PCI bridge: Intel Corporation DSL3510 Thunderbolt Port [Cactus Ridge] (rev 03)
      06:05.0 PCI bridge: Intel Corporation DSL3510 Thunderbolt Port [Cactus Ridge] (rev 03)
      06:06.0 PCI bridge: Intel Corporation DSL3510 Thunderbolt Port [Cactus Ridge] (rev 03)
      07:00.0 System peripheral: Intel Corporation DSL3510 Thunderbolt Port [Cactus Ridge] (rev 03)
      08:00.0 PCI bridge: Intel Corporation DSL3510 Thunderbolt Controller [Cactus Ridge]
      09:00.0 PCI bridge: Intel Corporation DSL3510 Thunderbolt Controller [Cactus Ridge]


      you can execute the following:



      echo "1" | sudo tee /sys/bus/pci/devices/DDDD:BB:DD.F/remove > /dev/null


      Which should trigger the unload routines in the kernel and the driver (and possibly even in the device firmware), after which you might be able to eject it more-safely. (A grep in a subshell can obviously take the place of the DDDD:BB:DD.F for ease-of-use in the future).



      Upon replugging the device, it might become necessary to manually rescan:



      echo "1" | sudo tee /sys/bus/pci/rescan > /dev/null


      (Or it might not be needed.)



      I haven't used Linux in a while as I'm almost exclusively FreeBSD and OS X these days, so please forgive me if I'm off the mark on anything here.






      share|improve this answer





















      • thanks for the pointers , its seems my system shows its thunderbolt parts differently , not sure which is the thunderbolt ? amias@rome:~$ lspci 00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor PCI Express x16 Controller (rev 06) 00:1c.0 PCI bridge: Intel Corporation 8 Series/C220 Series Chipset 08:00.0 PCI bridge: Intel Corporation Device 157e 0a:00.0 System peripheral: Intel Corporation Device 157d 0b:00.0 PCI bridge: Intel Corporation Device 156d 0c:00.0 PCI bridge: Intel Corporation Device 156d
        – Amias
        Mar 1 '16 at 13:22












      • See the vendor deviceid database here: pci-ids.ucw.cz/read/PC/8086 - you have quite a few matching thunderbolt results.
        – Mahmoud Al-Qudsi
        Mar 1 '16 at 15:14






      • 1




        With Linux kernel 4.13 the situation around Thunderbolt (3) improved quite a bit. For instance the Lenovo Thunderbolt 3 Dock now comes back online after suspend/ resume on current Debian 10 Buster (Testing) in contrast to the behavior of Debian 9 Stretch with kernel 4.9. Unplug/ replug still has issues
        – AdamKalisz
        Oct 29 '17 at 20:50










      • I second that, the mainline 4.13 kernel provides really strong thunderbolt support for displays, not having great luck with other peripherals and wired network yet.
        – Brandon Bertelsen
        Nov 4 '17 at 17:01















      up vote
      3
      down vote



      accepted










      Thunderbolt is basically a PCIe bus exposed in the form of a user-friendly, pluggable interface. As you can imagine, hot-plugging a PCIe card in any machine isn't something you can expect to consistently do without problems - unless extreme care has been taken by the manufacturers of the host and removable devices as well as the developers of the mainboard firmware, device firmware, OS kernel, and device drivers.



      All that is to say, there's a huge surface area of potential bugs and issues that would prevent this hot-plug from working the way we'd want it to. My recommendation would be to use a debug kernel and try to break into the debugger when it freezes - if you can, then it's probably not a hardware or firmware issue. Instructions on doing that are probably a little beyond the scope of the question or my reply here, but resources are available online that make this a bit easier.



      Now if you want a means by which you can manually eject the device prior to yanking it, you can try the following:



      After identifying the device address in the system in the output of lspci command, where DDDD:BB:DD.F is the Domain:Bus:Device.Function of the thunderbolt peripheral in question:



      05:00.0 PCI bridge: Intel Corporation DSL3510 Thunderbolt Port [Cactus Ridge] (rev 03)
      06:00.0 PCI bridge: Intel Corporation DSL3510 Thunderbolt Port [Cactus Ridge] (rev 03)
      06:03.0 PCI bridge: Intel Corporation DSL3510 Thunderbolt Port [Cactus Ridge] (rev 03)
      06:04.0 PCI bridge: Intel Corporation DSL3510 Thunderbolt Port [Cactus Ridge] (rev 03)
      06:05.0 PCI bridge: Intel Corporation DSL3510 Thunderbolt Port [Cactus Ridge] (rev 03)
      06:06.0 PCI bridge: Intel Corporation DSL3510 Thunderbolt Port [Cactus Ridge] (rev 03)
      07:00.0 System peripheral: Intel Corporation DSL3510 Thunderbolt Port [Cactus Ridge] (rev 03)
      08:00.0 PCI bridge: Intel Corporation DSL3510 Thunderbolt Controller [Cactus Ridge]
      09:00.0 PCI bridge: Intel Corporation DSL3510 Thunderbolt Controller [Cactus Ridge]


      you can execute the following:



      echo "1" | sudo tee /sys/bus/pci/devices/DDDD:BB:DD.F/remove > /dev/null


      Which should trigger the unload routines in the kernel and the driver (and possibly even in the device firmware), after which you might be able to eject it more-safely. (A grep in a subshell can obviously take the place of the DDDD:BB:DD.F for ease-of-use in the future).



      Upon replugging the device, it might become necessary to manually rescan:



      echo "1" | sudo tee /sys/bus/pci/rescan > /dev/null


      (Or it might not be needed.)



      I haven't used Linux in a while as I'm almost exclusively FreeBSD and OS X these days, so please forgive me if I'm off the mark on anything here.






      share|improve this answer





















      • thanks for the pointers , its seems my system shows its thunderbolt parts differently , not sure which is the thunderbolt ? amias@rome:~$ lspci 00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor PCI Express x16 Controller (rev 06) 00:1c.0 PCI bridge: Intel Corporation 8 Series/C220 Series Chipset 08:00.0 PCI bridge: Intel Corporation Device 157e 0a:00.0 System peripheral: Intel Corporation Device 157d 0b:00.0 PCI bridge: Intel Corporation Device 156d 0c:00.0 PCI bridge: Intel Corporation Device 156d
        – Amias
        Mar 1 '16 at 13:22












      • See the vendor deviceid database here: pci-ids.ucw.cz/read/PC/8086 - you have quite a few matching thunderbolt results.
        – Mahmoud Al-Qudsi
        Mar 1 '16 at 15:14






      • 1




        With Linux kernel 4.13 the situation around Thunderbolt (3) improved quite a bit. For instance the Lenovo Thunderbolt 3 Dock now comes back online after suspend/ resume on current Debian 10 Buster (Testing) in contrast to the behavior of Debian 9 Stretch with kernel 4.9. Unplug/ replug still has issues
        – AdamKalisz
        Oct 29 '17 at 20:50










      • I second that, the mainline 4.13 kernel provides really strong thunderbolt support for displays, not having great luck with other peripherals and wired network yet.
        – Brandon Bertelsen
        Nov 4 '17 at 17:01













      up vote
      3
      down vote



      accepted







      up vote
      3
      down vote



      accepted






      Thunderbolt is basically a PCIe bus exposed in the form of a user-friendly, pluggable interface. As you can imagine, hot-plugging a PCIe card in any machine isn't something you can expect to consistently do without problems - unless extreme care has been taken by the manufacturers of the host and removable devices as well as the developers of the mainboard firmware, device firmware, OS kernel, and device drivers.



      All that is to say, there's a huge surface area of potential bugs and issues that would prevent this hot-plug from working the way we'd want it to. My recommendation would be to use a debug kernel and try to break into the debugger when it freezes - if you can, then it's probably not a hardware or firmware issue. Instructions on doing that are probably a little beyond the scope of the question or my reply here, but resources are available online that make this a bit easier.



      Now if you want a means by which you can manually eject the device prior to yanking it, you can try the following:



      After identifying the device address in the system in the output of lspci command, where DDDD:BB:DD.F is the Domain:Bus:Device.Function of the thunderbolt peripheral in question:



      05:00.0 PCI bridge: Intel Corporation DSL3510 Thunderbolt Port [Cactus Ridge] (rev 03)
      06:00.0 PCI bridge: Intel Corporation DSL3510 Thunderbolt Port [Cactus Ridge] (rev 03)
      06:03.0 PCI bridge: Intel Corporation DSL3510 Thunderbolt Port [Cactus Ridge] (rev 03)
      06:04.0 PCI bridge: Intel Corporation DSL3510 Thunderbolt Port [Cactus Ridge] (rev 03)
      06:05.0 PCI bridge: Intel Corporation DSL3510 Thunderbolt Port [Cactus Ridge] (rev 03)
      06:06.0 PCI bridge: Intel Corporation DSL3510 Thunderbolt Port [Cactus Ridge] (rev 03)
      07:00.0 System peripheral: Intel Corporation DSL3510 Thunderbolt Port [Cactus Ridge] (rev 03)
      08:00.0 PCI bridge: Intel Corporation DSL3510 Thunderbolt Controller [Cactus Ridge]
      09:00.0 PCI bridge: Intel Corporation DSL3510 Thunderbolt Controller [Cactus Ridge]


      you can execute the following:



      echo "1" | sudo tee /sys/bus/pci/devices/DDDD:BB:DD.F/remove > /dev/null


      Which should trigger the unload routines in the kernel and the driver (and possibly even in the device firmware), after which you might be able to eject it more-safely. (A grep in a subshell can obviously take the place of the DDDD:BB:DD.F for ease-of-use in the future).



      Upon replugging the device, it might become necessary to manually rescan:



      echo "1" | sudo tee /sys/bus/pci/rescan > /dev/null


      (Or it might not be needed.)



      I haven't used Linux in a while as I'm almost exclusively FreeBSD and OS X these days, so please forgive me if I'm off the mark on anything here.






      share|improve this answer












      Thunderbolt is basically a PCIe bus exposed in the form of a user-friendly, pluggable interface. As you can imagine, hot-plugging a PCIe card in any machine isn't something you can expect to consistently do without problems - unless extreme care has been taken by the manufacturers of the host and removable devices as well as the developers of the mainboard firmware, device firmware, OS kernel, and device drivers.



      All that is to say, there's a huge surface area of potential bugs and issues that would prevent this hot-plug from working the way we'd want it to. My recommendation would be to use a debug kernel and try to break into the debugger when it freezes - if you can, then it's probably not a hardware or firmware issue. Instructions on doing that are probably a little beyond the scope of the question or my reply here, but resources are available online that make this a bit easier.



      Now if you want a means by which you can manually eject the device prior to yanking it, you can try the following:



      After identifying the device address in the system in the output of lspci command, where DDDD:BB:DD.F is the Domain:Bus:Device.Function of the thunderbolt peripheral in question:



      05:00.0 PCI bridge: Intel Corporation DSL3510 Thunderbolt Port [Cactus Ridge] (rev 03)
      06:00.0 PCI bridge: Intel Corporation DSL3510 Thunderbolt Port [Cactus Ridge] (rev 03)
      06:03.0 PCI bridge: Intel Corporation DSL3510 Thunderbolt Port [Cactus Ridge] (rev 03)
      06:04.0 PCI bridge: Intel Corporation DSL3510 Thunderbolt Port [Cactus Ridge] (rev 03)
      06:05.0 PCI bridge: Intel Corporation DSL3510 Thunderbolt Port [Cactus Ridge] (rev 03)
      06:06.0 PCI bridge: Intel Corporation DSL3510 Thunderbolt Port [Cactus Ridge] (rev 03)
      07:00.0 System peripheral: Intel Corporation DSL3510 Thunderbolt Port [Cactus Ridge] (rev 03)
      08:00.0 PCI bridge: Intel Corporation DSL3510 Thunderbolt Controller [Cactus Ridge]
      09:00.0 PCI bridge: Intel Corporation DSL3510 Thunderbolt Controller [Cactus Ridge]


      you can execute the following:



      echo "1" | sudo tee /sys/bus/pci/devices/DDDD:BB:DD.F/remove > /dev/null


      Which should trigger the unload routines in the kernel and the driver (and possibly even in the device firmware), after which you might be able to eject it more-safely. (A grep in a subshell can obviously take the place of the DDDD:BB:DD.F for ease-of-use in the future).



      Upon replugging the device, it might become necessary to manually rescan:



      echo "1" | sudo tee /sys/bus/pci/rescan > /dev/null


      (Or it might not be needed.)



      I haven't used Linux in a while as I'm almost exclusively FreeBSD and OS X these days, so please forgive me if I'm off the mark on anything here.







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Feb 29 '16 at 18:45









      Mahmoud Al-Qudsi

      2,65032138




      2,65032138












      • thanks for the pointers , its seems my system shows its thunderbolt parts differently , not sure which is the thunderbolt ? amias@rome:~$ lspci 00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor PCI Express x16 Controller (rev 06) 00:1c.0 PCI bridge: Intel Corporation 8 Series/C220 Series Chipset 08:00.0 PCI bridge: Intel Corporation Device 157e 0a:00.0 System peripheral: Intel Corporation Device 157d 0b:00.0 PCI bridge: Intel Corporation Device 156d 0c:00.0 PCI bridge: Intel Corporation Device 156d
        – Amias
        Mar 1 '16 at 13:22












      • See the vendor deviceid database here: pci-ids.ucw.cz/read/PC/8086 - you have quite a few matching thunderbolt results.
        – Mahmoud Al-Qudsi
        Mar 1 '16 at 15:14






      • 1




        With Linux kernel 4.13 the situation around Thunderbolt (3) improved quite a bit. For instance the Lenovo Thunderbolt 3 Dock now comes back online after suspend/ resume on current Debian 10 Buster (Testing) in contrast to the behavior of Debian 9 Stretch with kernel 4.9. Unplug/ replug still has issues
        – AdamKalisz
        Oct 29 '17 at 20:50










      • I second that, the mainline 4.13 kernel provides really strong thunderbolt support for displays, not having great luck with other peripherals and wired network yet.
        – Brandon Bertelsen
        Nov 4 '17 at 17:01


















      • thanks for the pointers , its seems my system shows its thunderbolt parts differently , not sure which is the thunderbolt ? amias@rome:~$ lspci 00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor PCI Express x16 Controller (rev 06) 00:1c.0 PCI bridge: Intel Corporation 8 Series/C220 Series Chipset 08:00.0 PCI bridge: Intel Corporation Device 157e 0a:00.0 System peripheral: Intel Corporation Device 157d 0b:00.0 PCI bridge: Intel Corporation Device 156d 0c:00.0 PCI bridge: Intel Corporation Device 156d
        – Amias
        Mar 1 '16 at 13:22












      • See the vendor deviceid database here: pci-ids.ucw.cz/read/PC/8086 - you have quite a few matching thunderbolt results.
        – Mahmoud Al-Qudsi
        Mar 1 '16 at 15:14






      • 1




        With Linux kernel 4.13 the situation around Thunderbolt (3) improved quite a bit. For instance the Lenovo Thunderbolt 3 Dock now comes back online after suspend/ resume on current Debian 10 Buster (Testing) in contrast to the behavior of Debian 9 Stretch with kernel 4.9. Unplug/ replug still has issues
        – AdamKalisz
        Oct 29 '17 at 20:50










      • I second that, the mainline 4.13 kernel provides really strong thunderbolt support for displays, not having great luck with other peripherals and wired network yet.
        – Brandon Bertelsen
        Nov 4 '17 at 17:01
















      thanks for the pointers , its seems my system shows its thunderbolt parts differently , not sure which is the thunderbolt ? amias@rome:~$ lspci 00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor PCI Express x16 Controller (rev 06) 00:1c.0 PCI bridge: Intel Corporation 8 Series/C220 Series Chipset 08:00.0 PCI bridge: Intel Corporation Device 157e 0a:00.0 System peripheral: Intel Corporation Device 157d 0b:00.0 PCI bridge: Intel Corporation Device 156d 0c:00.0 PCI bridge: Intel Corporation Device 156d
      – Amias
      Mar 1 '16 at 13:22






      thanks for the pointers , its seems my system shows its thunderbolt parts differently , not sure which is the thunderbolt ? amias@rome:~$ lspci 00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor PCI Express x16 Controller (rev 06) 00:1c.0 PCI bridge: Intel Corporation 8 Series/C220 Series Chipset 08:00.0 PCI bridge: Intel Corporation Device 157e 0a:00.0 System peripheral: Intel Corporation Device 157d 0b:00.0 PCI bridge: Intel Corporation Device 156d 0c:00.0 PCI bridge: Intel Corporation Device 156d
      – Amias
      Mar 1 '16 at 13:22














      See the vendor deviceid database here: pci-ids.ucw.cz/read/PC/8086 - you have quite a few matching thunderbolt results.
      – Mahmoud Al-Qudsi
      Mar 1 '16 at 15:14




      See the vendor deviceid database here: pci-ids.ucw.cz/read/PC/8086 - you have quite a few matching thunderbolt results.
      – Mahmoud Al-Qudsi
      Mar 1 '16 at 15:14




      1




      1




      With Linux kernel 4.13 the situation around Thunderbolt (3) improved quite a bit. For instance the Lenovo Thunderbolt 3 Dock now comes back online after suspend/ resume on current Debian 10 Buster (Testing) in contrast to the behavior of Debian 9 Stretch with kernel 4.9. Unplug/ replug still has issues
      – AdamKalisz
      Oct 29 '17 at 20:50




      With Linux kernel 4.13 the situation around Thunderbolt (3) improved quite a bit. For instance the Lenovo Thunderbolt 3 Dock now comes back online after suspend/ resume on current Debian 10 Buster (Testing) in contrast to the behavior of Debian 9 Stretch with kernel 4.9. Unplug/ replug still has issues
      – AdamKalisz
      Oct 29 '17 at 20:50












      I second that, the mainline 4.13 kernel provides really strong thunderbolt support for displays, not having great luck with other peripherals and wired network yet.
      – Brandon Bertelsen
      Nov 4 '17 at 17:01




      I second that, the mainline 4.13 kernel provides really strong thunderbolt support for displays, not having great luck with other peripherals and wired network yet.
      – Brandon Bertelsen
      Nov 4 '17 at 17:01












      up vote
      2
      down vote













      it seems that if you lspci -vt you get a tree diagram that makes it a lot easier to spot the thunderbolt controller.



      heres my output



      amias@rome:~$ lspci -vt

      -[0000:00]-+-00.0 Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor DRAM Controller
      +-01.0-[02-03]----00.0 NVIDIA Corporation GK107GLM [Quadro K1100M]
      +-02.0 Intel Corporation 4th Gen Core Processor Integrated Graphics Controller
      +-03.0 Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor HD Audio Controller
      +-04.0 Intel Corporation Device 0c03
      +-14.0 Intel Corporation 8 Series/C220 Series Chipset Family USB xHCI
      +-16.0 Intel Corporation 8 Series/C220 Series Chipset Family MEI Controller #1
      +-1a.0 Intel Corporation 8 Series/C220 Series Chipset Family USB EHCI #2
      +-1b.0 Intel Corporation 8 Series/C220 Series Chipset High Definition Audio Controller
      +-1c.0-[04]--
      +-1c.2-[06]----00.0 Intel Corporation Wireless 7260
      +-1c.3-[07]----00.0 Realtek Semiconductor Co., Ltd. RTS5249 PCI Express Card Reader
      +-1c.4-[08-40]----00.0-[09-40]--+-00.0-[0a]----00.0 Intel Corporation Device 157d
      | -01.0-[0b-40]----00.0-[0c-40]--+-00.0-[0d]----00.0 Fresco Logic FL1100 USB 3.0 Host Controller
      | +-01.0-[0e]----00.0 Intel Corporation I210 Gigabit Network Connection
      | +-02.0-[0f]----00.0 Fresco Logic FL1100 USB 3.0 Host Controller
      | +-03.0-[10]----00.0 LSI Corporation FW643 [TrueFire] PCIe 1394b Controller
      | +-04.0-[11]--
      | -05.0-[12-40]--
      +-1d.0 Intel Corporation 8 Series/C220 Series Chipset Family USB EHCI #1
      +-1f.0 Intel Corporation HM87 Express LPC Controller
      +-1f.2 Intel Corporation 8 Series/C220 Series Chipset Family 6-port SATA Controller 1 [AHCI mode]
      +-1f.3 Intel Corporation 8 Series/C220 Series Chipset Family SMBus Controller
      -1f.6 Intel Corporation 8 Series Chipset Family Thermal Management Controller


      this allowed me to find 1c.4 which appears to be my thunderbolt controller.



      I then used mahmoud's suggestion to hit the remove node , this did seem to disconnect my thunderbolt dock cleanly , however when i reinserted it locked hard. This would suggest that other drivers are not so happy with the hotplugging or i would need to reset the thunderbolt device.



      Either way , it was worse than just pulling it out.



      I guess for now i just need to ensure everything is saved before undocking. I would welcome further suggestions if there are any.






      share|improve this answer

























        up vote
        2
        down vote













        it seems that if you lspci -vt you get a tree diagram that makes it a lot easier to spot the thunderbolt controller.



        heres my output



        amias@rome:~$ lspci -vt

        -[0000:00]-+-00.0 Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor DRAM Controller
        +-01.0-[02-03]----00.0 NVIDIA Corporation GK107GLM [Quadro K1100M]
        +-02.0 Intel Corporation 4th Gen Core Processor Integrated Graphics Controller
        +-03.0 Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor HD Audio Controller
        +-04.0 Intel Corporation Device 0c03
        +-14.0 Intel Corporation 8 Series/C220 Series Chipset Family USB xHCI
        +-16.0 Intel Corporation 8 Series/C220 Series Chipset Family MEI Controller #1
        +-1a.0 Intel Corporation 8 Series/C220 Series Chipset Family USB EHCI #2
        +-1b.0 Intel Corporation 8 Series/C220 Series Chipset High Definition Audio Controller
        +-1c.0-[04]--
        +-1c.2-[06]----00.0 Intel Corporation Wireless 7260
        +-1c.3-[07]----00.0 Realtek Semiconductor Co., Ltd. RTS5249 PCI Express Card Reader
        +-1c.4-[08-40]----00.0-[09-40]--+-00.0-[0a]----00.0 Intel Corporation Device 157d
        | -01.0-[0b-40]----00.0-[0c-40]--+-00.0-[0d]----00.0 Fresco Logic FL1100 USB 3.0 Host Controller
        | +-01.0-[0e]----00.0 Intel Corporation I210 Gigabit Network Connection
        | +-02.0-[0f]----00.0 Fresco Logic FL1100 USB 3.0 Host Controller
        | +-03.0-[10]----00.0 LSI Corporation FW643 [TrueFire] PCIe 1394b Controller
        | +-04.0-[11]--
        | -05.0-[12-40]--
        +-1d.0 Intel Corporation 8 Series/C220 Series Chipset Family USB EHCI #1
        +-1f.0 Intel Corporation HM87 Express LPC Controller
        +-1f.2 Intel Corporation 8 Series/C220 Series Chipset Family 6-port SATA Controller 1 [AHCI mode]
        +-1f.3 Intel Corporation 8 Series/C220 Series Chipset Family SMBus Controller
        -1f.6 Intel Corporation 8 Series Chipset Family Thermal Management Controller


        this allowed me to find 1c.4 which appears to be my thunderbolt controller.



        I then used mahmoud's suggestion to hit the remove node , this did seem to disconnect my thunderbolt dock cleanly , however when i reinserted it locked hard. This would suggest that other drivers are not so happy with the hotplugging or i would need to reset the thunderbolt device.



        Either way , it was worse than just pulling it out.



        I guess for now i just need to ensure everything is saved before undocking. I would welcome further suggestions if there are any.






        share|improve this answer























          up vote
          2
          down vote










          up vote
          2
          down vote









          it seems that if you lspci -vt you get a tree diagram that makes it a lot easier to spot the thunderbolt controller.



          heres my output



          amias@rome:~$ lspci -vt

          -[0000:00]-+-00.0 Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor DRAM Controller
          +-01.0-[02-03]----00.0 NVIDIA Corporation GK107GLM [Quadro K1100M]
          +-02.0 Intel Corporation 4th Gen Core Processor Integrated Graphics Controller
          +-03.0 Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor HD Audio Controller
          +-04.0 Intel Corporation Device 0c03
          +-14.0 Intel Corporation 8 Series/C220 Series Chipset Family USB xHCI
          +-16.0 Intel Corporation 8 Series/C220 Series Chipset Family MEI Controller #1
          +-1a.0 Intel Corporation 8 Series/C220 Series Chipset Family USB EHCI #2
          +-1b.0 Intel Corporation 8 Series/C220 Series Chipset High Definition Audio Controller
          +-1c.0-[04]--
          +-1c.2-[06]----00.0 Intel Corporation Wireless 7260
          +-1c.3-[07]----00.0 Realtek Semiconductor Co., Ltd. RTS5249 PCI Express Card Reader
          +-1c.4-[08-40]----00.0-[09-40]--+-00.0-[0a]----00.0 Intel Corporation Device 157d
          | -01.0-[0b-40]----00.0-[0c-40]--+-00.0-[0d]----00.0 Fresco Logic FL1100 USB 3.0 Host Controller
          | +-01.0-[0e]----00.0 Intel Corporation I210 Gigabit Network Connection
          | +-02.0-[0f]----00.0 Fresco Logic FL1100 USB 3.0 Host Controller
          | +-03.0-[10]----00.0 LSI Corporation FW643 [TrueFire] PCIe 1394b Controller
          | +-04.0-[11]--
          | -05.0-[12-40]--
          +-1d.0 Intel Corporation 8 Series/C220 Series Chipset Family USB EHCI #1
          +-1f.0 Intel Corporation HM87 Express LPC Controller
          +-1f.2 Intel Corporation 8 Series/C220 Series Chipset Family 6-port SATA Controller 1 [AHCI mode]
          +-1f.3 Intel Corporation 8 Series/C220 Series Chipset Family SMBus Controller
          -1f.6 Intel Corporation 8 Series Chipset Family Thermal Management Controller


          this allowed me to find 1c.4 which appears to be my thunderbolt controller.



          I then used mahmoud's suggestion to hit the remove node , this did seem to disconnect my thunderbolt dock cleanly , however when i reinserted it locked hard. This would suggest that other drivers are not so happy with the hotplugging or i would need to reset the thunderbolt device.



          Either way , it was worse than just pulling it out.



          I guess for now i just need to ensure everything is saved before undocking. I would welcome further suggestions if there are any.






          share|improve this answer












          it seems that if you lspci -vt you get a tree diagram that makes it a lot easier to spot the thunderbolt controller.



          heres my output



          amias@rome:~$ lspci -vt

          -[0000:00]-+-00.0 Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor DRAM Controller
          +-01.0-[02-03]----00.0 NVIDIA Corporation GK107GLM [Quadro K1100M]
          +-02.0 Intel Corporation 4th Gen Core Processor Integrated Graphics Controller
          +-03.0 Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor HD Audio Controller
          +-04.0 Intel Corporation Device 0c03
          +-14.0 Intel Corporation 8 Series/C220 Series Chipset Family USB xHCI
          +-16.0 Intel Corporation 8 Series/C220 Series Chipset Family MEI Controller #1
          +-1a.0 Intel Corporation 8 Series/C220 Series Chipset Family USB EHCI #2
          +-1b.0 Intel Corporation 8 Series/C220 Series Chipset High Definition Audio Controller
          +-1c.0-[04]--
          +-1c.2-[06]----00.0 Intel Corporation Wireless 7260
          +-1c.3-[07]----00.0 Realtek Semiconductor Co., Ltd. RTS5249 PCI Express Card Reader
          +-1c.4-[08-40]----00.0-[09-40]--+-00.0-[0a]----00.0 Intel Corporation Device 157d
          | -01.0-[0b-40]----00.0-[0c-40]--+-00.0-[0d]----00.0 Fresco Logic FL1100 USB 3.0 Host Controller
          | +-01.0-[0e]----00.0 Intel Corporation I210 Gigabit Network Connection
          | +-02.0-[0f]----00.0 Fresco Logic FL1100 USB 3.0 Host Controller
          | +-03.0-[10]----00.0 LSI Corporation FW643 [TrueFire] PCIe 1394b Controller
          | +-04.0-[11]--
          | -05.0-[12-40]--
          +-1d.0 Intel Corporation 8 Series/C220 Series Chipset Family USB EHCI #1
          +-1f.0 Intel Corporation HM87 Express LPC Controller
          +-1f.2 Intel Corporation 8 Series/C220 Series Chipset Family 6-port SATA Controller 1 [AHCI mode]
          +-1f.3 Intel Corporation 8 Series/C220 Series Chipset Family SMBus Controller
          -1f.6 Intel Corporation 8 Series Chipset Family Thermal Management Controller


          this allowed me to find 1c.4 which appears to be my thunderbolt controller.



          I then used mahmoud's suggestion to hit the remove node , this did seem to disconnect my thunderbolt dock cleanly , however when i reinserted it locked hard. This would suggest that other drivers are not so happy with the hotplugging or i would need to reset the thunderbolt device.



          Either way , it was worse than just pulling it out.



          I guess for now i just need to ensure everything is saved before undocking. I would welcome further suggestions if there are any.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 3 '16 at 10:01









          Amias

          20838




          20838






















              up vote
              1
              down vote













              You can try suspending your system to RAM and then pull out the cable. This seems to be the only way I can unplug my Lenovo Thunderbolt 3 dock without rebooting.






              share|improve this answer

























                up vote
                1
                down vote













                You can try suspending your system to RAM and then pull out the cable. This seems to be the only way I can unplug my Lenovo Thunderbolt 3 dock without rebooting.






                share|improve this answer























                  up vote
                  1
                  down vote










                  up vote
                  1
                  down vote









                  You can try suspending your system to RAM and then pull out the cable. This seems to be the only way I can unplug my Lenovo Thunderbolt 3 dock without rebooting.






                  share|improve this answer












                  You can try suspending your system to RAM and then pull out the cable. This seems to be the only way I can unplug my Lenovo Thunderbolt 3 dock without rebooting.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 24 at 21:05









                  tolvanea

                  112




                  112






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Super User!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1046928%2fthunderbolt-hotplugging-in-ubuntu-linux%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

                      Alcedinidae

                      RAC Tourist Trophy