NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.36k stars 13.59k forks source link

chrome/chromium doesn't launch correctly and breaks other running programs #162499

Closed 06kellyjac closed 2 years ago

06kellyjac commented 2 years ago

Describe the bug

A clear and concise description of what the bug is.

Steps To Reproduce

Steps to reproduce the behavior:

  1. run chrome
  2. Maximum number of clients reachedlibva error: /run/opengl-driver/lib/dri/nvidia_drv_video.so init failed
  3. try to change i3 workspace via clicking polybar or try run rofi
  4. get Maximum number of clients reached on the other stuff

Expected behavior

A clear and concise description of what you expected to happen.

Expected chrome to launch and run normally

Screenshots

If applicable, add screenshots to help explain your problem.

λ google-chrome-stable
Maximum number of clients reachedlibva error: /run/opengl-driver/lib/dri/nvidia_drv_video.so init failed
[29133:29284:0302/153044.393304:ERROR:object_proxy.cc(623)] Failed to call method: org.freedesktop.DBus.Properties.Get: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
[29133:29284:0302/153044.393720:ERROR:object_proxy.cc(623)] Failed to call method: org.freedesktop.UPower.GetDisplayDevice: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
[29133:29284:0302/153044.394223:ERROR:object_proxy.cc(623)] Failed to call method: org.freedesktop.UPower.EnumerateDevices: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
[29133:29186:0302/153047.476202:ERROR:chrome_browser_main_extra_parts_metrics.cc(227)] START: ReportBluetoothAvailability(). If you don't see the END: message, this is crbug.com/1216328.
[29133:29186:0302/153047.476216:ERROR:chrome_browser_main_extra_parts_metrics.cc(230)] END: ReportBluetoothAvailability()

error log from polybar clicking stuff only while chrome is up:

error: module/i3: Failed to connect to i3: errno 111 (Connection refused)
error: module/i3: Failed to connect to i3: errno 111 (Connection refused)
error: module/i3: Failed to connect to i3: errno 111 (Connection refused)
error: module/i3: Failed to connect to i3: errno 111 (Connection refused)
error: module/i3: Failed to connect to i3: errno 111 (Connection refused)

launching rofi with chrome up:

λ rofi
Maximum number of clients reached
(process:29375): X11Helper-WARNING **: 15:30:47.140: Failed to open display: :0

(process:29375): Rofi-WARNING **: 15:30:47.141: Connection has error

Additional context

Add any other context about the problem here.

I'm on an nvidia laptop using prime.sync, currently on my external monitor config

This should be all my graphics related config:

{ pkgs, config, lib, ... }:

{
  # <nixos-hardware/common/gpu/nvidia.nix>
  # <nixos-hardware/lenovo/thinkpad/x1-extreme/default.nix>

  services.xserver.dpi = 96;
  # Hardware encoding
  nixpkgs.config.packageOverrides = pkgs: {
    vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; };
  };
  # Optimus
  hardware = {
    # bumblebee.enable = true;
    opengl = {
      enable = true;
      driSupport32Bit = true; # steam fix
      extraPackages = with pkgs; [
        intel-media-driver # LIBVA_DRIVER_NAME=iHD
        vaapiIntel         # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium)
        vaapiVdpau
        libvdpau-va-gl
      ];
    };
    nvidia = {
      modesetting.enable = true;
      # package = nvidiaPackage;
      powerManagement.enable = false;
      # prime.sync.enable = true;
      prime = {
        offload.enable = true;
        # Bus ID of the Intel GPU.
        intelBusId = "PCI:0:2:0";
        # Bus ID of the NVIDIA GPU.
        nvidiaBusId = "PCI:1:0:0";
      };
    };
  };
  environment.variables = { MONITOR = "DP-0"; };
  environment.sessionVariables = { MONITOR = "DP-0"; };
  specialisation = {
    external-display.configuration = {
      system.nixos.tags = [ "external-display" ];
      hardware.nvidia.prime.offload.enable = lib.mkForce false;
      hardware.nvidia.powerManagement.enable = lib.mkForce false;

      environment.variables = { MONITOR = lib.mkForce "DP-1"; };
      environment.sessionVariables = { MONITOR = lib.mkForce "DP-1"; };
    };
  };
}
λ lsmod | grep "kms\|drm"
nvidia_drm             73728  15
nvidia_modeset       1163264  37 nvidia_drm
drm_kms_helper        307200  2 nvidia_drm,i915
syscopyarea            16384  1 drm_kms_helper
sysfillrect            16384  1 drm_kms_helper
sysimgblt              16384  1 drm_kms_helper
fb_sys_fops            16384  1 drm_kms_helper
drm                   643072  24 drm_kms_helper,nvidia,nvidia_drm,i915,ttm
i2c_core              102400  14 i2c_designware_platform,videodev,i2c_designware_core,drm_kms_helper,i2c_algo_bit,rmi_smbus,ee1004,nvidia,i2c_smbus,thinkpad_acpi,i2c_i801,i915,psmouse,drm
backlight              24576  5 video,drm_kms_helper,thinkpad_acpi,i915,drm
agpgart                49152  3 intel_gtt,ttm,drm

The only other thing that might maybe be related is I override pipewire to remove bluez

pipewire = prev.pipewire.override { bluezSupport = false; };

Notify maintainers

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
output here
06kellyjac commented 2 years ago

Update:

I was hesitant to ping you since you dont use chrome but I also have the issue with chromium @primeos

Also since this is pulled from the cache and my pipewire overlay isn't in any config files it's the non overridden pipewire

λ nix repl
Welcome to Nix 2.6.1. Type :? for help.

nix-repl> :lf .

nix-repl> inputs.nixpkgs.narHash
"sha256-ILKckkiG074t3a0pwaPLjio8zVWgowpEp7AUwI5HjHE="

nix-repl> inputs.nixpkgs.rev
"18bd82edcc752d6a0e6cce1401ba0c81353a03ca"

λ echo $NIX_PATH
/home/jk/.nix-defexpr/channels:nixpkgs=/nix/store/c2kq57hv8hlnv43x5yvf64drfix1bnhq-source:home-manager=/nix/store/1df131fdshngr3ydw2l98isy81rw2p4s-source:nixpkgs-master=/nix/store/wla7if4f3hf6csdilz9hf7jbj7n945ss-source:nur=/nix/store/i8wxlnmf6n8ikj9jvwb9zdw8k99gjn34-source

λ nix path-info /nix/store/c2kq57hv8hlnv43x5yvf64drfix1bnhq-source --json | jq
[
  {
    "path": "/nix/store/c2kq57hv8hlnv43x5yvf64drfix1bnhq-source",
    "narHash": "sha256-ILKckkiG074t3a0pwaPLjio8zVWgowpEp7AUwI5HjHE=",
    "narSize": 113198936,
    "references": [],
    "ca": "fixed:r:sha256:0wcc8y7c055hlx20m8x0ap6kqalfrfiw2addvlnvxlw69299rci0",
    "registrationTime": 1646226957
  }
]

λ nix-shell -p chromium
these 7 paths will be fetched (95.30 MiB download, 422.96 MiB unpacked):
  /nix/store/3qja81afrdx04rfpcapjzfpz7p2n210h-libpng-1.6.37
  /nix/store/8crlfv7s2xzjh7c1dhh8h57vap7y9csf-chromium-unwrapped-98.0.4758.102-sandbox
  /nix/store/aaj8frg5wrqfksphhnfkrwy0vgvch70i-chromium-unwrapped-98.0.4758.102
  /nix/store/b8fpbv6v4jmqa1n0c3h00kvbc9m53gnc-chromium-98.0.4758.102
  /nix/store/irscclymqrrb3zj7bi1h1mrj8r42jc00-pipewire-0.3.45-lib
  /nix/store/kdlavl97v7x65sx9hn3y2nwsdcm0b70g-libfreeaptx-0.1.1
  /nix/store/yjlpfxms4v35rhk0aj24rn5x5yqvdp9m-chromium-98.0.4758.102-sandbox
copying path '/nix/store/8crlfv7s2xzjh7c1dhh8h57vap7y9csf-chromium-unwrapped-98.0.4758.102-sandbox' from 'https://cache.nixos.org'...
copying path '/nix/store/kdlavl97v7x65sx9hn3y2nwsdcm0b70g-libfreeaptx-0.1.1' from 'https://cache.nixos.org'...
copying path '/nix/store/3qja81afrdx04rfpcapjzfpz7p2n210h-libpng-1.6.37' from 'https://cache.nixos.org'...
copying path '/nix/store/irscclymqrrb3zj7bi1h1mrj8r42jc00-pipewire-0.3.45-lib' from 'https://cache.nixos.org'...
copying path '/nix/store/yjlpfxms4v35rhk0aj24rn5x5yqvdp9m-chromium-98.0.4758.102-sandbox' from 'https://cache.nixos.org'...
copying path '/nix/store/aaj8frg5wrqfksphhnfkrwy0vgvch70i-chromium-unwrapped-98.0.4758.102' from 'https://cache.nixos.org'...
copying path '/nix/store/b8fpbv6v4jmqa1n0c3h00kvbc9m53gnc-chromium-98.0.4758.102' from 'https://cache.nixos.org'...

[nix-shell:~]$ chromium
Maximum number of clients reachedlibva error: /run/opengl-driver/lib/dri/nvidia_drv_video.so init failed
[59988:60140:0302/160030.530195:ERROR:object_proxy.cc(623)] Failed to call method: org.freedesktop.DBus.Properties.Get: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
[59988:60140:0302/160030.531092:ERROR:object_proxy.cc(623)] Failed to call method: org.freedesktop.UPower.GetDisplayDevice: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
[59988:60140:0302/160030.532047:ERROR:object_proxy.cc(623)] Failed to call method: org.freedesktop.UPower.EnumerateDevices: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files

a log with --enable-logging=stderr --v=1

error.log

primeos commented 2 years ago

I was hesitant to ping you since you dont use chrome but I also have the issue with chromium @primeos

No problem, you can always ping me (it's even useful for me to know about these issues). I just often lack time to help :o And in this case I cannot reproduce it (everything's working fine on my setup - but I'm e.g. using Wayland without XWayland) so I'm afraid you're on your own.

Maximum number of clients reached

That could come from PulseAudio (directly or via services.pipewire.pulse.enable). I'm not sure though but it seems familiar. Not sure about the other errors, maybe it's even a bigger resource exhaustion problem.

Are you by any chance running a hardened Linux kernel or using a special audio configuration?

bbigras commented 2 years ago

I'm having the same problem.

06kellyjac commented 2 years ago

No problem, you can always ping me (it's even useful for me to know about these issues).

Thanks. I'm just on normal linux kernel and my pipewire config is pretty standard off the wiki

{ ... }:
{
  # rtkit is optional but recommended
  security.rtkit.enable = true;
  services.pipewire = {
    enable = true;
    alsa.enable = true;
    alsa.support32Bit = true;
    pulse.enable = true;
  };
}

I can try swap back to normal pulse at some point and see how it goes


since there's a couple mentions of pipewire pulse I'll poke the pipewire meta thread #102547

bbigras commented 2 years ago

I'll try without pipewire pulse.

I see the error message when I run vainfo but it's fine when I use sudo.

bbigras commented 2 years ago

I have the same problem with only pulseaudio.

bbigras commented 2 years ago

I can launch Chrome when I stop importing nixos-hardware.nixosModules.common-cpu-intel.

common-cpu-intel includes libvdpau-va-gl. Not sure if it's the cause. I wonder if I could blacklist it. EDIT: I guess not, it's probably a lib, not a driver.

bbigras commented 2 years ago

@06kellyjac do you also use nixos-hardware.nixosModules.common-cpu-intel?

This might be the cause: https://github.com/NixOS/nixos-hardware/commit/1da3ba110c8940146588c9adf52811e70f449eb1

VDPAU_DRIVER=nvidia google-chrome-stable works.

06kellyjac commented 2 years ago

yep I do, and i'm intel + nvidia, I'll try that right after this meeting. If it doesn't work it'll probably kill my call :sweat_smile:

Update: VDPAU_DRIVER=nvidia google-chrome-stable worked just fine

bbigras commented 2 years ago

hehe. I'm filling an issue on nixos-hardware but meanwhile I think we just need to set VDPAU_DRIVER=nvidia.

06kellyjac commented 2 years ago

thanks for getting to the bottom of this :tada:

primeos commented 2 years ago

Cool, I'll close this issue in favor of https://github.com/NixOS/nixos-hardware/issues/388 then. Feel free to re-open it in case some Nixpkgs changes would be required.