NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.45k stars 13.65k forks source link

QGis fails to start with an exception #341351

Open ldesousa opened 1 week ago

ldesousa commented 1 week ago

Describe the bug

QGis does not start, reporting an exception in the command line. Both from the main and from "unstable".

Steps To Reproduce

$ nix profile install nixpkgs#qgis

$ qgis

(process:54090): Gtk-WARNING **: 10:00:16.481: Locale not supported by C library.
    Using the fallback 'C' locale.
Gtk-Message: 10:00:16.482: Failed to load module "xapp-gtk3-module"
Gtk-Message: 10:00:16.539: Failed to load module "canberra-gtk-module"
Gtk-Message: 10:00:16.540: Failed to load module "canberra-gtk-module"
Warning: qglx_findConfig: Failed to finding matching FBConfig for QSurfaceFormat(version 4.3, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize 0, redBufferSize 1, greenBufferSize 1, blueBufferSize 1, alphaBufferSize -1, stencilBufferSize 0, samples 1, swapBehavior QSurfaceFormat::SingleBuffer, swapInterval 1, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::CompatibilityProfile)
Warning: qglx_findConfig: Failed to finding matching FBConfig for QSurfaceFormat(version 4.3, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize 0, redBufferSize 1, greenBufferSize 1, blueBufferSize 1, alphaBufferSize -1, stencilBufferSize 0, samples 1, swapBehavior QSurfaceFormat::SingleBuffer, swapInterval 1, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::CompatibilityProfile)
Fatal: Could not initialize GLX
QGIS died on signal -1Could not attach to process.  If your uid matches the uid of the target
process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try
again as the root user.  For more details, see /etc/sysctl.d/10-ptrace.conf
ptrace: Operation not permitted.
No thread selected
No stack.
gdb returned 256
Aborted (core dumped)

$ nix profile remove qgis
removing 'flake:nixpkgs#legacyPackages.x86_64-linux.qgis'

$ nix profile install nixpkgs/nixpkgs-unstable#qgis

$ qgis

(process:54631): Gtk-WARNING **: 10:01:07.774: Locale not supported by C library.
    Using the fallback 'C' locale.
Gtk-Message: 10:01:07.775: Failed to load module "xapp-gtk3-module"
Gtk-Message: 10:01:07.817: Failed to load module "canberra-gtk-module"
Gtk-Message: 10:01:07.818: Failed to load module "canberra-gtk-module"
Warning: qglx_findConfig: Failed to finding matching FBConfig for QSurfaceFormat(version 4.3, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize 0, redBufferSize 1, greenBufferSize 1, blueBufferSize 1, alphaBufferSize -1, stencilBufferSize 0, samples 1, swapBehavior QSurfaceFormat::SingleBuffer, swapInterval 1, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::CompatibilityProfile)
Warning: qglx_findConfig: Failed to finding matching FBConfig for QSurfaceFormat(version 4.3, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize 0, redBufferSize 1, greenBufferSize 1, blueBufferSize 1, alphaBufferSize -1, stencilBufferSize 0, samples 1, swapBehavior QSurfaceFormat::SingleBuffer, swapInterval 1, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::CompatibilityProfile)
Fatal: Could not initialize GLX
QGIS died on signal -1Could not attach to process.  If your uid matches the uid of the target
process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try
again as the root user.  For more details, see /etc/sysctl.d/10-ptrace.conf
ptrace: Operation not permitted.
No thread selected
No stack.
gdb returned 256
Aborted (core dumped)

Expected behavior

The programme should start without exceptions.

Additional context

Nix 2.24.5 on Ubuntu 24.04.

$ nix --version
nix (Nix) 2.24.5

$ uname -a
Linux Symbolic 6.8.0-44-generic #44-Ubuntu SMP PREEMPT_DYNAMIC Tue Aug 13 13:35:26 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

Notify maintainers

@imincik @l0b0 @nialov @sikmir @willcohen @lsix

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"
these 13 paths will be fetched (2.17 MiB download, 17.12 MiB unpacked):
  /nix/store/7jk4jrd99ngnm9iczcf63mfxqba0ak2y-diffutils-3.10
  /nix/store/ar0h9xsf4mlhajdnj2gw13fgrhaikhq9-ed-1.20.2
  /nix/store/fv56zpi80jpakbfmv16r60xvyqwzff6r-file-5.45
  /nix/store/fnq94lw19pnwdl9p8zhfrad4jmlgxlbr-findutils-4.10.0
  /nix/store/9hifsxkcrkvvb712ghnr3gy5g1aiym2d-gawk-5.2.2
  /nix/store/q6x5ag0rns4swggcyvcgd1x5i488ws6c-gnu-config-2024-01-01
  /nix/store/axrdky652lsmif6m5i8b55q91v4ly4gy-gnumake-4.4.1
  /nix/store/gjlh1zvckhz0qv795lnzgw2zciklbzj2-gnused-4.9
  /nix/store/6f0a5rlnjd0fq36msy5fk00yjkwqlgk2-nix-info
  /nix/store/7wg4bz2sika3wd7541rndbnwcq6k9h8v-patch-2.7.6
  /nix/store/k97fic16vmpf9z6vjx5dgd6rxcvv5wwh-patchelf-0.15.0
  /nix/store/91d27rjqlhkzx7mhzxrir1jcr40nyc7p-stdenv-linux
  /nix/store/9l3havpzc3w1xggd19l5c395az4yh449-update-autotools-gnu-config-scripts-hook
copying path '/nix/store/q6x5ag0rns4swggcyvcgd1x5i488ws6c-gnu-config-2024-01-01' from 'https://cache.nixos.org'...
copying path '/nix/store/7jk4jrd99ngnm9iczcf63mfxqba0ak2y-diffutils-3.10' from 'https://cache.nixos.org'...
copying path '/nix/store/ar0h9xsf4mlhajdnj2gw13fgrhaikhq9-ed-1.20.2' from 'https://cache.nixos.org'...
copying path '/nix/store/fv56zpi80jpakbfmv16r60xvyqwzff6r-file-5.45' from 'https://cache.nixos.org'...
copying path '/nix/store/fnq94lw19pnwdl9p8zhfrad4jmlgxlbr-findutils-4.10.0' from 'https://cache.nixos.org'...
copying path '/nix/store/9hifsxkcrkvvb712ghnr3gy5g1aiym2d-gawk-5.2.2' from 'https://cache.nixos.org'...
copying path '/nix/store/axrdky652lsmif6m5i8b55q91v4ly4gy-gnumake-4.4.1' from 'https://cache.nixos.org'...
copying path '/nix/store/gjlh1zvckhz0qv795lnzgw2zciklbzj2-gnused-4.9' from 'https://cache.nixos.org'...
copying path '/nix/store/k97fic16vmpf9z6vjx5dgd6rxcvv5wwh-patchelf-0.15.0' from 'https://cache.nixos.org'...
copying path '/nix/store/9l3havpzc3w1xggd19l5c395az4yh449-update-autotools-gnu-config-scripts-hook' from 'https://cache.nixos.org'...
copying path '/nix/store/7wg4bz2sika3wd7541rndbnwcq6k9h8v-patch-2.7.6' from 'https://cache.nixos.org'...
copying path '/nix/store/6f0a5rlnjd0fq36msy5fk00yjkwqlgk2-nix-info' from 'https://cache.nixos.org'...
copying path '/nix/store/91d27rjqlhkzx7mhzxrir1jcr40nyc7p-stdenv-linux' from 'https://cache.nixos.org'...
 - system: `"x86_64-linux"`
 - host os: `Linux 6.8.0-44-generic, Ubuntu, 24.04.1 LTS (Noble Numbat), nobuild`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.24.5`
 - nixpkgs: `/nix/store/88wskw5ssly5xdqy9wi8ax03diqpibmc-source`

Add a :+1: reaction to issues you find important.

tpwrules commented 6 days ago

Using nixGL fixes this for me.

imincik commented 4 days ago

Yes, this looks look like a GPU drivers problem. As said above nixGL should fix that. https://geospatial-nix.today/ has built in support for nixGL (enable openGL in OTHER tab).

ldesousa commented 3 days ago

I got the following set-up from geospatial-nix:

  geopkgs = inputs.geonix.packages.${pkgs.system};

in {
  packages = [
    geopkgs.gdal-minimal
  ];

  applications.qgis = {
    enable = true;
    package = geopkgs.qgis;
    withGrass = false;
    pythonPackages = p: [  ];
    plugins = p: [  ];
  };

  nixgl.enable = true;

}

When I start the shell some kind of massive compilation starts, it goes on for several hours until it exhausts RAM and crashes. I have 16 GB on chip plus 8 GB in swap.

Is there any alternative?

imincik commented 3 days ago

When I start the shell some kind of massive compilation starts, it goes on for several hours until it exhausts RAM and crashes. I have 16 GB on chip plus 8 GB in swap.

There should be no compilation. Everything should be downloaded from geospatial-nix binary cache. Did you accept it during the first start of geospatial-nix environment (Nix is asking few Yes/No questions) ?

imincik commented 2 days ago

Can we close this issue now ?

ldesousa commented 2 days ago

There should be no compilation. Everything should be downloaded from geospatial-nix binary cache. Did you accept it during the first start of geospatial-nix environment (Nix is asking few Yes/No questions) ?

I did not get any question from Nix. Is there any flag or parameter I could use to prevent compilation?

imincik commented 1 day ago

You can try to remove ~/local/share/nix/trusted-settings.json file and run nix command again.

Also, you can try to use --accept-flake-config flag.

ldesousa commented 1 day ago

You can try to remove ~/local/share/nix/trusted-settings.json file and run nix command again.

Also, you can try to use --accept-flake-config flag.

I just tried both things, but Nix still goes into compilations (see below). Is there any way to limit the number of cores and the RAM the compiler uses?

$ rm ./.local/share/nix/trusted-settings.json
$ nix profile install github:imincik/my-geospatial-nix-flake#qgis --accept-flake-config
warning: ignoring untrusted substituter 'https://geonix.cachix.org', you are not a trusted user.
Run `man nix.conf` for more information on the `substituters` configuration option.
warning: ignoring the client-specified setting 'trusted-public-keys', because it is a restricted setting and you are not a trusted user
[2/0/3 built] building qgis-unwrapped-3.38.2 (buildPhase): [592/9784] Building CXX object src/providers/pdal/CMakeFiles/pdal_wrench.dir/__/__/__/external/pda
imincik commented 1 day ago

warning: ignoring untrusted substituter 'https://geonix.cachix.org', you are not a trusted user. warning: ignoring the client-specified setting 'trusted-public-keys', because it is a restricted setting and you are not a trusted user

That's the issue. You are not trusted Nix user. Let me check how to fix it on Ubuntu.

imincik commented 1 day ago

@ldesousa

warning: ignoring untrusted substituter 'https://geonix.cachix.org', you are not a trusted user. warning: ignoring the client-specified setting 'trusted-public-keys', because it is a restricted setting and you are not a trusted user

That's the issue. You are not trusted Nix user. Let me check how to fix it on Ubuntu.

Add yourself as user to /etc/nix/nix.conf.

trusted-users = <USERNAME>

and restart nix-daemon sudo systemctl restart nix-daemon.service

ldesousa commented 1 day ago

I expanded the Swap file quite a good deal and the compilation succeeded. At some point it took 22 GB of RAM. However, I still get the same exception when I start QGis (see below).

In the meantime I will add myself to the trusted users.

$ qgis
(process:105355): Gtk-WARNING **: 10:16:49.274: Locale not supported by C library.
    Using the fallback 'C' locale.
Gtk-Message: 10:16:49.275: Failed to load module "xapp-gtk3-module"
Gtk-Message: 10:16:49.299: Failed to load module "canberra-gtk-module"
Gtk-Message: 10:16:49.299: Failed to load module "canberra-gtk-module"
Warning: qglx_findConfig: Failed to finding matching FBConfig for QSurfaceFormat(version 4.3, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize 0, redBufferSize 1, greenBufferSize 1, blueBufferSize 1, alphaBufferSize -1, stencilBufferSize 0, samples 1, swapBehavior QSurfaceFormat::SingleBuffer, swapInterval 1, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::CompatibilityProfile)
Warning: qglx_findConfig: Failed to finding matching FBConfig for QSurfaceFormat(version 4.3, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize 0, redBufferSize 1, greenBufferSize 1, blueBufferSize 1, alphaBufferSize -1, stencilBufferSize 0, samples 1, swapBehavior QSurfaceFormat::SingleBuffer, swapInterval 1, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::CompatibilityProfile)
Fatal: Could not initialize GLX
QGIS died on signal -1Could not attach to process.  If your uid matches the uid of the target
process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try
again as the root user.  For more details, see /etc/sysctl.d/10-ptrace.conf
ptrace: Operation not permitted.
No thread selected
No stack.
gdb returned 256

[1]+  Aborted                 (core dumped) qgis
imincik commented 1 day ago

I expanded the Swap file quite a good deal and the compilation succeeded. At some point it took 22 GB of RAM. However, I still get the same exception when I start QGis (see below).

In the meantime I will add myself to the trusted users.

$ qgis
(process:105355): Gtk-WARNING **: 10:16:49.274: Locale not supported by C library.
  Using the fallback 'C' locale.
Gtk-Message: 10:16:49.275: Failed to load module "xapp-gtk3-module"
Gtk-Message: 10:16:49.299: Failed to load module "canberra-gtk-module"
Gtk-Message: 10:16:49.299: Failed to load module "canberra-gtk-module"
Warning: qglx_findConfig: Failed to finding matching FBConfig for QSurfaceFormat(version 4.3, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize 0, redBufferSize 1, greenBufferSize 1, blueBufferSize 1, alphaBufferSize -1, stencilBufferSize 0, samples 1, swapBehavior QSurfaceFormat::SingleBuffer, swapInterval 1, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::CompatibilityProfile)
Warning: qglx_findConfig: Failed to finding matching FBConfig for QSurfaceFormat(version 4.3, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize 0, redBufferSize 1, greenBufferSize 1, blueBufferSize 1, alphaBufferSize -1, stencilBufferSize 0, samples 1, swapBehavior QSurfaceFormat::SingleBuffer, swapInterval 1, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::CompatibilityProfile)
Fatal: Could not initialize GLX
QGIS died on signal -1Could not attach to process.  If your uid matches the uid of the target
process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try
again as the root user.  For more details, see /etc/sysctl.d/10-ptrace.conf
ptrace: Operation not permitted.
No thread selected
No stack.
gdb returned 256

[1]+  Aborted                 (core dumped) qgis

That's the issue with GPU driver which should be fixed using nixGL .