Just a remark. I had so many of the same issues.
There was a chance for any of these things to happen after making a display configuration change, suspending/resuming, undocking etc:
- Nothing (displays work fine)
- One display stays black
- All displays including laptop internal display freeze, which is recoverable only by physically disconnecting the displays from the dock
- Displays flicker on and off rapidly before every one goes dark including the laptop's internal display, requiring a hard reset.
Sometimes the USB hub would just disconnect, ethernet would stop working, etc. Sometimes everything would just freeze.
Recently, I replaced (by warranty) to a new dock. I finally tested it, and now I have had the following behavior with a Lenovo P1 Gen 2 (Quadro T2000), a Thunderbolt 3 Workstation Dock Gen 2 (firmware sub-version 64) and nVidia drivers 455 over Ubuntu 20.04 with kernel 5.4.85-050485-generic:
I can not log-in at all unless I had the Dock connected, for some strange reason. After entering the password, with the laptop undocked, Ubuntu would freeze - the session would not start. (The mouse still moved, but the UI was no longer responsive).
In Windows, everything worked fine.
Kernel 5.4.58 had the same issues. Oddly, in kernel 5.4.56 I could log in, but still had all the issues you mentioned above.
Changing the drivers to Nouveau meant I could log-in, but only one external monitor worked (I have 2).
All of this with Kernel DMA Disabled and running at "No Security" to make everything simpler.
What I ended up doing was:
Changed to nVidia drivers 418 (I lose the smart power management, so battery time is terrible).
Thunderbolt 3 Security at "User Authorization" (for now).
Now, everything works (so far). Suspending works, resuming works, shutting off works (all of these would sometimes freeze).
It's pretty sad that this is the state of Lenovo's state of the art laptops and docks, on Ubuntu which they are supposedly certified for.
We are now sadly considering moving our entire engineering department to Macs in our next upgrade cycle.