NixOS / nixos-hardware

A collection of NixOS modules covering hardware quirks.
Creative Commons Zero v1.0 Universal
2.03k stars 630 forks source link

Thunderbolt video in and out no longer working in Lenovo ThinkPad X1 Carbon Gen 11 #867

Closed naturallaw777 closed 8 months ago

naturallaw777 commented 8 months ago

I am using NixOS unstable.

My X1 ThinkPad worked great about a month ago with Thunderbolt video output and input.

Since the new unstable releases, the video output (connected a monitor to thunderbolt for display and/or connecting a webcam) stopped working.

I am on firmware: N3XET50W (1.25 )

I am on NixOS: 24.05.20240216.5863c27

Graphics: Intel® Graphics (RPL-U)

Processor: 13th Gen Intel® Core™ i7-1355U × 12

Any help would be appreciated!

Thanks!

I am adding you @stnley as I think you supplied the .nix for the gen11. Thanks so much.

stnley commented 8 months ago

I'm sorry to hear about that! I just updated my flake and am not noticing any issues.

NixOS: 24.05.20240218.b98a4e1

For the configuration, I followed instructions in the wiki and ran this command:

$ nix-shell -p pciutils --run "lspci -nn | grep VGA"
00:02.0 VGA compatible controller [0300]: Intel Corporation Raptor Lake-P [Iris Xe Graphics] [8086:a7a1] (rev 04)

It looks like we have the same hardware, but could you confirm the output of that on your machine?

naturallaw777 commented 8 months ago

Hi @stnley , thanks so much for the quick and kind reply!

Okay, I looked into what you said.

Update my configuration.nix in accordance to the wiki with the information from

nix-shell -p pciutils --run "lspci -nn | grep VGA"
00:02.0 VGA compatible controller [0300]: Intel Corporation Raptor Lake-P [Iris Xe Graphics] [8086:a7a1] (rev 04)

My configuration.nix now includes this:

boot.kernelParams = [ "i915.force_probe=a7a1"];

Then I updated to the newest flake: 24.05.20240218.b98a4e1

Also, I did not include my kernel version from the original post: Linux 6.7.5

After all this, no such luck. :( There continues to be no output of video or video input.

naturallaw777 commented 8 months ago

Oh and I just ran this command also from the wiki nix-shell -p libva-utils --run vainfo

Here is the error messge:

Trying display: wayland
libva info: VA-API version 1.17.0
libva info: Trying to open /run/opengl-driver/lib/dri/iHD_drv_video.so
libva error: dlopen of /run/opengl-driver/lib/dri/iHD_drv_video.so failed: /nix/store/8xk4yl1r3n6kbyn05qhan7nbag7npymx-glibc-2.35-224/lib/libc.so.6: version `GLIBC_2.38' not found (required by /run/opengl-driver/lib/dri/iHD_drv_video.so)
libva info: Trying to open /usr/lib/dri/iHD_drv_video.so
libva info: Trying to open /usr/lib32/dri/iHD_drv_video.so
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Trying to open /usr/lib/i386-linux-gnu/dri/iHD_drv_video.so
libva info: va_openDriver() returns -1
libva info: Trying to open /run/opengl-driver/lib/dri/i965_drv_video.so
libva error: dlopen of /run/opengl-driver/lib/dri/i965_drv_video.so failed: /nix/store/8xk4yl1r3n6kbyn05qhan7nbag7npymx-glibc-2.35-224/lib/libc.so.6: version `GLIBC_2.38' not found (required by /run/opengl-driver/lib/dri/i965_drv_video.so)
libva info: Trying to open /usr/lib/dri/i965_drv_video.so
libva info: Trying to open /usr/lib32/dri/i965_drv_video.so
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Trying to open /usr/lib/i386-linux-gnu/dri/i965_drv_video.so
libva info: va_openDriver() returns -1
vaInitialize failed with error code -1 (unknown libva error),exit
stnley commented 8 months ago

Interesting. I was on a different kernel version than you, but I modified my config to include kernelPackages = pkgs.linuxPackages_latest and now I'm on Linux 6.7.5 too.

My configuration.nix now includes this:

You shouldn't need to add the kernel param to your config, that is what the hardware module does.

I noticed your output for the vainfo command is slightly different from mine.

❯  nix-shell -p libva-utils --run vainfo
Trying display: wayland
libva info: VA-API version 1.20.0
libva info: Trying to open /run/opengl-driver/lib/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_20
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.20 (libva 2.20.1)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 23.3.5 ()
vainfo: Supported profile and entrypoints
...

I'm not positive if that means you still have some out of date packages. Perhaps you could put together a minimal config which doesn't work?

naturallaw777 commented 8 months ago

Thank you this is totally helpful! I will look into this today and get back with my findings. Much appreciated!!

Abdillah commented 8 months ago

This also occurred in Thinkpad X13 with Thunderbolt 4. Two weeks ago it is fine, but after rebuilding into new unstable (likely), I can't use monitor connected to my USB-C. I'm still trying to figure which commit causing this issue, by rollbacking into stable. I will share my further result.

naturallaw777 commented 8 months ago

Okay...

I got it working, but I really don't know what it was.

Listed are the several things I did and then it started working.

  1. I ran this command to make sure the driver is working nix-shell -p libva-utils --run vainfo, which outputs no errors.
    Trying display: wayland
    libva info: VA-API version 1.20.0
    libva info: Trying to open /run/opengl-driver/lib/dri/iHD_drv_video.so
    libva info: Found init function __vaDriverInit_1_20
    libva info: va_openDriver() returns 0
    vainfo: VA-API version: 1.20 (libva 2.20.1)
    vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 23.3.5 ()
    vainfo: Supported profile and entrypoints
      VAProfileNone                   : VAEntrypointVideoProc
      VAProfileNone                   : VAEntrypointStats

Also, note that your nix-channel needs to be updated to the latest version EVEN if your NixOS is a flake setup via the command nix-channel --update.

  1. Once you know the VA-API driver is working (Intel iHD for this laptop) it should work. However, it was still not working for me.

  2. Then, I had to be more drastic: I swapped out the NVME for another new install of NixOS on a different NVME and booded the laptop up. I then deleted the hardware-configuration.nix in /etc/nixos then ran nixos-generate-config rebooted and the display output was working.

  3. Then, I put the original NixOS install NVME back into the laptop and the display output was working after it booted up.

Now, I don't know what was the fix in this process.

Hopefully, this will help someone.

Thanks for the help in here.

naturallaw777 commented 8 months ago

I will wait to close this @Abdillah. We will wait to hear back from you on your findings.

stnley commented 8 months ago

@naturallaw777 Very odd behavior, but glad you got it working after all that!

Also, note that your nix-channel needs to be updated to the latest version EVEN if your NixOS is a flake setup via the command nix-channel --update

This seems like the reason there appeared to be old packages when you previously checked vainfo. I don't have any channels on my system maybe this could be why I haven't experienced the issue.

naturallaw777 commented 8 months ago

@stnley Yes, this is interesting. My system is a flake setup. I noticed that if I removed all the channels (root and user) (standard nix install), I could not get nix-shell to run. Thus, I had to setup a nix-channel in root EVEN though I am only in a flake system. After this, nix-shell worked.

And yes, then I had to run nix-channel --update to get the newest release. Then I could run nix-shell -p libva-utils --run vainfo and it had the latest packages. Then I could confirm I had the newest drivers installed and that they are working.

That is what was confusing me because is seems the nix-shell feature can be completely independent from a NixOS flake install. I thought they were interwoven with each other.

Abdillah commented 8 months ago

It is strange, I can't make thunderbolt works again even after revert Nixpkgs up to 2 weeks prior to this. The stranger thing is when plug into monitor in my home, it works. It just won't work anymore when plugged unto office's monitor. It worked before..

I think, this issue can be closed, I will file another issue if found something after investigating more. Thanks @naturallaw777

naturallaw777 commented 8 months ago

Sure thing @Abdillah! Check the usb-c/thunderbolt cable at work and see if it has gone bad or maybe the monitor at work needs a firmware update?

Will close the ticket now.

Samuel-Bowden commented 6 months ago

I've had the same issue using a Lenovo Yoga Pro 7 14IRH8 using NixOS unstable, and have fixed it by disconnecting the battery within the UEFI firmware settings as suggested by this answer on superuser. This was potentially what fixed the issue in https://github.com/NixOS/nixos-hardware/issues/867#issuecomment-1960691932, if the battery was disconnected when changing the SSD back and forth.

Abdillah commented 6 months ago

I see, thank you for the info.

Now after some time it just works again. That might be why.