Score:0

Lenovo USB-C Dock with multiple monitors

cn flag

I would like to connect Ubuntu 22.04 to a ThinkPad USB-C Dock by Lenovo. Two lenovo monitors are connected via display ports, these monitors are working at the time of turning on the notebook (Lenovo too) while booting, however as soon as Ububtu starts the monitors are going to sleeping mode (power saving mode). The monitors are detected in the settings panel in Ubuntu, however the image is not being displayed. I turned on the monitors but after a few seconds with no image the monitors are going to power save (sleep) mode. Can you help? This is how it looks like

Score:1
pl flag

I had this too. I don't have a Lenovo branded USB C Dock, but a generic one. However I don't believe this is relevant, it can happen with any external monitor setup.

My goal was to have three external displays in use, with the laptop lid closed, so as not to use its display. You may want a different arrangement, and I think it should work, just giving you that information as it will give context to what you see below.

The key to this is 1) Use xorg, not wayland. 2) The ~/.config/monitors.xml file is the master key.

The two most frustrating parts of all are that a) this is that the monitors.xml seems to be woefully undocumented anywhere and b) the display device names change seemingly randomly on each boot.

So, attach all the monitors you require, get to the login screen and login to Ubuntu. Delete or backup your ~/.config/monitors.xml to start fresh. Restart the system.

Again, login to Ubuntu, where I assume your laptop panel will work, and the monitors may be in various states. Ignore the output on the external monitors for now.

In a terminal run xrandr just to check all the monitors show up. Here's mine, showing tons of potential output devices. Note I'm filtering out any line with a space at the start, so as to only show the devices, not the long lists of supported resolutions. That's just so you can see it here, and it's not ludicrously long to scroll through.

$ xrandr | grep -v "^\ "
Screen 0: minimum 320 x 200, current 3840 x 2160, maximum 16384 x 16384
eDP connected (normal left inverted right x axis y axis)
DisplayPort-0 disconnected (normal left inverted right x axis y axis)
DisplayPort-1 disconnected (normal left inverted right x axis y axis)
DisplayPort-2 disconnected (normal left inverted right x axis y axis)
DisplayPort-3 disconnected (normal left inverted right x axis y axis)
DisplayPort-4 disconnected (normal left inverted right x axis y axis)
DisplayPort-5 disconnected (normal left inverted right x axis y axis)
DisplayPort-6 disconnected (normal left inverted right x axis y axis)
DisplayPort-7 connected 1920x1080+1112+0 (normal left inverted right x axis y axis) 344mm x 195mm
DisplayPort-8 connected 1920x1080+0+1080 (normal left inverted right x axis y axis) 527mm x 296mm
DisplayPort-9 connected primary 1920x1080+1920+1080 (normal left inverted right x axis y axis) 530mm x 290mm

Right now, the bottom three "DisplayPort" items are in use. The top one "eDP" is the internal panel on the laptop, which is off, because, as mentioned, the lid is shut.

You should see something vaugely similar. Note the resolution (all my monitors are 1080p) of 1920x1080 and the x and y offset (the distance across and down that each monitor is from 0,0 in the top left.

So:

  • DisplayPort-7 is at the top, half way across.
  • DisplayPort-8 is beneath to 7, to the left (zero across offset, 1080 down offset)
  • DisplayPort-9 is to the right of 8 and also below 7 (1920 offset across, to the right of 8, and 1080 offset down, below 7)

Here's what that looks like in GNOME settings.

GNOME Settings Display options

Confusingly 2 is DisplayPort-7, 3 is DisplayPort-8 and 4 is DisplayPort-9. I suspect 1 will be eDP if I open the lid of my laptop, but I'm not about to mess this up by doing that! :D

Ok, next step, open GNOME Settings. Navigate to Display. Here's what my fully setup one looks like.

GNOME Settings Display options showing all monitors

Don't re-arrange anything at the top yet. Let's get the resolutions and refresh rates first.

So, for each monitor, click through to it and set the resolution and refresh rate accordingly. For example:

Single monitor refresh rate

I found this set of panels to completely freak out if the displays were set at different refresh rates. GNOME would complain that I was in impossible situations.

Get them all consistent in terms of resolution and refresh rate. Don't worry about arranging them right now. I found that re-arranging them would frequently lead the monitors to just switch off with "no signal.

Ok, now open a text editor and edit your ~/.config/monitors.xml. Perhaps take a backup of it first, and put to one side, in case you mess it up.

It's an xml file with the format below. Note this is an example of one "configuration". The file may have more than one. Mine has two configuration sections. This is the first one, which shows what happens if I only have the laptop display active, like when I am away from my desk.

Key things to note: <x> and <y> are the horizontal and vertical offset from 0,0 I mentioned above. The section is where you can put the resolution and refresh rate. Thesection is a simpleyes` if it's the monitor where the panel / launcher should be. Simply omit that section entirely if it's not.

<monitors version="2">
  <configuration>
    <logicalmonitor>
      <x>0</x>
      <y>0</y>
      <scale>1</scale>
      <primary>yes</primary>
      <monitor>
        <monitorspec>
          <connector>eDP</connector>
          <vendor>SDC</vendor>
          <product>0x4167</product>
          <serial>0x00000000</serial>
        </monitorspec>
        <mode>
          <width>1920</width>
          <height>1200</height>
          <rate>60.001</rate>
        </mode>
      </monitor>
    </logicalmonitor>
  </configuration>
</monitors>

Ok, so that's for one display. What about multiple displays?

Below is my next (and last) configuration section - it's long, sorry.

Note there are three <logicalmonitor> sections. That's my three displays you saw above. Each has their <x> and <y> offset, the name as it appears in xrandr as <connector> and the <width>, <height>, <rate> for resolution and refresh rate. Only one of them has <primary> set. Note that the order doesn't matter. DisplayPort-9 is in the bottom right on my desk, but it's the first one listed.

  <configuration>
    <logicalmonitor>
      <x>1920</x>
      <y>1080</y>
      <scale>1</scale>
      <primary>yes</primary>
      <monitor>
        <monitorspec>
          <connector>DisplayPort-9</connector>
          <vendor>SYN</vendor>
          <product>Non-PnP</product>
          <serial>0x00bc614e</serial>
        </monitorspec>
        <mode>
          <width>1920</width>
          <height>1080</height>
          <rate>60.000</rate>
        </mode>
      </monitor>
    </logicalmonitor>
    <logicalmonitor>
      <x>1112</x>
      <y>0</y>
      <scale>1</scale>
      <monitor>
        <monitorspec>
          <connector>DisplayPort-7</connector>
          <vendor>RTK</vendor>
          <product>Wimaxit FHD</product>
          <serial>demoset-1</serial>
        </monitorspec>
        <mode>
          <width>1920</width>
          <height>1080</height>
          <rate>60.000</rate>
        </mode>
      </monitor>
    </logicalmonitor>
    <logicalmonitor>
      <x>0</x>
      <y>1080</y>
      <scale>1</scale>
      <monitor>
        <monitorspec>
          <connector>DisplayPort-8</connector>
          <vendor>DEL</vendor>
          <product>DELL SE2416H</product>
          <serial>TP7H70AR1YVL</serial>
        </monitorspec>
        <mode>
          <width>1920</width>
          <height>1080</height>
          <rate>60.000</rate>
        </mode>
      </monitor>
    </logicalmonitor>
  </configuration>

Get this file right. Save it, make a backup of it, then restart your session. It should be as simple as ALT+F2, R, Enter. But you may want to logout/in to be sure.

I appreciate in 2023 it's a massive pain and very much not "Year of the Linux Desktop" to be editing XML files to get your displays right, but this was the only way I could do it. I hope it helps.

Diego Sanchez Cavalieri avatar
cn flag
Hello popey, thanks so much for the explanation and details.
Diego Sanchez Cavalieri avatar
cn flag
Once deleted the monitors.xml the file did not appear again on the ~/.config/ I logged out and even restarted the laptop, but nothing. Then connected back the USB-C dock and same issue, the monitors are going to sleep status and the image is not coming up. The monitor.xml was not again created on the folder. Thanks again.
pl flag
The file is in a different location if it's a wayland session. Have you signed into an xorg session?
Diego Sanchez Cavalieri avatar
cn flag
I have got the monitors.xml back. I have setup it up following your guide, but still the issue remains, the monitors are going to sleep mode and cant use them, despite of see them configued.I have added an image link on the problem text.
Diego Sanchez Cavalieri avatar
cn flag
I have searched the whole computer and just found monitors.xml in this location and nowhere else.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.