Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] Wayland : sway fails to start (nvidia, nouveau)
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
Alexdarcy
n00b
n00b


Joined: 17 May 2023
Posts: 8

PostPosted: Sun Jun 04, 2023 8:13 am    Post subject: [SOLVED] Wayland : sway fails to start (nvidia, nouveau) Reply with quote

Hi,

I wanted to try wayland with a window manager.My first try was to try to make it work with the nvidia drivers by installing dev-libs/wayland , gui-wm/sway, x11-base/xwayland. In /etc/portage/make.conf, there is:

Code:
USE="X dist-kernel binary pulseaudio"
VIDEO_CARDS="nvidia"


Sway refused to start, even with --unsupported-gpu (it found no GPU at this point). Xorg could still be started. My second try was to use nouveau with VIDEO_CARDS="nouveau" and rebuilding everything with emerge -auvDN @world. Sway fails to start with:

Code:
libEGL warning: MESA-LOADER: failed to open crocus: /usr/lib64/dri/crocus_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib64/dri, suffix _dri)

00:00:00.338 [ERROR] [wlr] [EGL] command: eglInitialize, error: EGL_NOT_INITIALIZED (0x3001), message: "DRI2: failed to load driver"
libEGL warning: MESA-LOADER: failed to open crocus: /usr/lib64/dri/crocus_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib64/dri, suffix _dri)

00:00:00.338 [ERROR] [wlr] [EGL] command: eglInitialize, error: EGL_NOT_INITIALIZED (0x3001), message: "DRI2: failed to load driver"
00:00:00.338 [ERROR] [wlr] [EGL] command: eglInitialize, error: EGL_NOT_INITIALIZED (0x3001), message: "eglInitialize"
00:00:00.338 [ERROR] [wlr] [render/egl.c:264] Failed to initialize EGL
00:00:00.338 [ERROR] [wlr] [render/egl.c:554] Failed to initialize EGL context
00:00:00.338 [ERROR] [wlr] [render/gles2/renderer.c:679] Could not initialize EGL
00:00:00.338 [ERROR] [wlr] [render/wlr_renderer.c:333] Could not initialize renderer
00:00:00.338 [ERROR] [sway/server.c:79] Failed to create renderer


Even though gui-libs/egl-wayland is installed ! At this point, I can still start X.
Installing media-libs/mesa-amber did not help and replacing USE="X" by USE="wayland" fails to build some package. At some point, I could no longer start X so I went back to xorg with nvidia.

1. Is there a way to make wayland work with nvidia drivers with a window manager ?
2. Otherwise, how can I make it work with nouveau ?

Thanks !


Last edited by Alexdarcy on Sun Jul 02, 2023 8:04 am; edited 1 time in total
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


Joined: 20 Jul 2019
Posts: 1549
Location: South America

PostPosted: Sun Jun 04, 2023 2:09 pm    Post subject: Re: Wayland : sway fails to start Reply with quote

Alexdarcy wrote:
Code:
libEGL warning: MESA-LOADER: failed to open crocus: /usr/lib64/dri/crocus_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib64/dri, suffix _dri)

That's coming from Mesa. The loader is looking for an Intel driver, crocus_dri.so, and doesn't find it. Is this actually an Optimus computer, or does it also have an Intel card?
_________________
NeddySeagoon wrote:
I'm not a witch, I'm a retired electronics engineer :)
Ionen wrote:
As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though :)
Back to top
View user's profile Send private message
Alexdarcy
n00b
n00b


Joined: 17 May 2023
Posts: 8

PostPosted: Sun Jun 04, 2023 2:59 pm    Post subject: Reply with quote

There is also an Intel card (HD graphics 4600), good catch. Is there a way to force wayland to use the NVIDIA card ?
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


Joined: 20 Jul 2019
Posts: 1549
Location: South America

PostPosted: Sun Jun 04, 2023 3:49 pm    Post subject: Reply with quote

Alexdarcy wrote:
Is there a way to force wayland to use the NVIDIA card ?

As a reference, how are you doing that for X11?
_________________
NeddySeagoon wrote:
I'm not a witch, I'm a retired electronics engineer :)
Ionen wrote:
As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though :)
Back to top
View user's profile Send private message
Alexdarcy
n00b
n00b


Joined: 17 May 2023
Posts: 8

PostPosted: Sun Jun 04, 2023 4:17 pm    Post subject: Reply with quote

Xorg found there were no intel driver, so it went back to the default driver.

And I just realized it was not (never ?) picking up nvidia. Xorg uses the "modesetting" module :/

With USE="nvidia intel", I can get sway to start with sway --unsupported-gpu. That's a good point.

However, I still cannot make xorg use nvidia instead of modesetting. Here's what I've tried :
- emerge @module-rebuild
- adding nvidia to /etc/modules-load.d/video.conf,
- custom xorg.conf : https://wiki.gentoo.org/wiki/NVIDIA/Optimus/xorg.conf
- xorg.conf generated by the nvidia tools

So the initial problem is solved but there's a new one :/
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


Joined: 20 Jul 2019
Posts: 1549
Location: South America

PostPosted: Mon Jun 05, 2023 12:56 pm    Post subject: Reply with quote

Alexdarcy wrote:
With USE="nvidia intel", I can get sway to start with sway --unsupported-gpu. That's a good point.

Be aware that, because media-libs/mesa with VIDEO_CARDS="nvidia intel" (is that what you meant?) willl now give you the crocus driver, there's a possibility that sway is using the Intel card.

Alexdarcy wrote:
However, I still cannot make xorg use nvidia instead of modesetting. Here's what I've tried :
- emerge @module-rebuild
- adding nvidia to /etc/modules-load.d/video.conf,
- custom xorg.conf : https://wiki.gentoo.org/wiki/NVIDIA/Optimus/xorg.conf
- xorg.conf generated by the nvidia tools

If you really have an Optimus computer, both the modesetting and proprietary nvidia drivers would be used, and, because the nvidia card is not driving a display, two extra xrandr commands are needed, in addition to a custom xorg.conf file, before Xorg starts. They are also in the Wiki article about Optimus.
_________________
NeddySeagoon wrote:
I'm not a witch, I'm a retired electronics engineer :)
Ionen wrote:
As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though :)
Back to top
View user's profile Send private message
Alexdarcy
n00b
n00b


Joined: 17 May 2023
Posts: 8

PostPosted: Mon Jun 19, 2023 5:23 pm    Post subject: Reply with quote

Yes, my idea was to use intel by default instead of trying to make nvidia drivers works.

I'm not sure the computer has an Optimus but using the two xrandr commands on the wiki https://wiki.gentoo.org/wiki/NVIDIA/Optimus
Code:
xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto

and a Xorg.conf generated by nvidia-xconfig --prime.
Xorg does starts but only with modesetting. As it works, I can leave as is :)
Back to top
View user's profile Send private message
CooSee
Veteran
Veteran


Joined: 20 Nov 2004
Posts: 1445
Location: Earth

PostPosted: Mon Jun 19, 2023 7:15 pm    Post subject: Reply with quote

Alexdarcy wrote:
There is also an Intel card (HD graphics 4600), good catch. Is there a way to force wayland to use the NVIDIA card ?

from https://github.com/swaywm/sway/wiki
Quote:
I have a multi-gpu setup (like intel+nvidia or intel+amd) and sway does not start

Unless specified otherwise, wlroots will choose a card for you and you could have a similar message in sway's log:

To use a different default card (listed in /dev/dri/), set this environment variable before starting sway:

WLR_DRM_DEVICES=/dev/dri/card1 sway

It's likely that you want sway to use the integrated (Intel) card, because probably that's the only one directly connected to the laptop monitor. However, the mapping between node names in /dev/dri/ and actual cards isn't guaranteed to be the same across reboots.

This script detects which is the device path of the integrated card and launches sway accordingly:

#!/bin/sh
val=$(udevadm info -a -n /dev/dri/card1 | grep boot_vga | rev | cut -c 2)
WLR_DRM_DEVICES="/dev/dri/card$val" sway

You can also configure multiple graphics cards like so:

WLR_DRM_DEVICES=/dev/dri/card0:/dev/dri/card1 sway

The first card is used for actual rendering, and display buffers are copied to the secondary cards for any displays connected to them.

here's my .profile file in my users home with some entries:
Code:
export MOZ_ENABLE_WAYLAND=1
export MOZ_DBUS_REMOTE=1
export XDG_CURRENT_DESKTOP=sway
export XDG_SESSION_DESKTOP=sway
export XDG_SESSION_TYPE=wayland
export EDITOR=/usr/bin/geany
export BROWSER=firefox
export TERM=sakura

just add the above mentioned variable to this file.

better use Intel Card - less headaches !

start Sway from TTY as user via sway -d 2> ~/sway.log - you'll get more infos.

8)
_________________
" Die Realität ist eine Illusion, die durch Mangel an ehrlicher Kommunikation entsteht "
---
" Der Mensch ist von Natur aus neugierig, was am Ende übrig bleibt ist die Gier "
Back to top
View user's profile Send private message
Alexdarcy
n00b
n00b


Joined: 17 May 2023
Posts: 8

PostPosted: Sun Jul 02, 2023 8:04 am    Post subject: Reply with quote

Thanks for the tips ! Somehow your script was not working so I removed nvidia drivers for nouveau. Now both Xorg and waylaynd starts without issue so I'm marking the issue as solved.

For future reference, migration was done by
- VIDEO_CARDS="nouveau intel"
- emerge sys-firmware/nvidia-firmware
- emerge -auvDN @world
- mv /etc/modprobe.d/nvidia.conf /etc/modprobe.d/.nvidia.conf

The last command was the most important as nvidia was still being used.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum