Other Installing Sway on FreeBSD 12

lostleonardo

New Member


Messages: 6

Hi,

Total noob here. I installed FreeBSD yesterday and would like to install Sway - the Wayland-based compositor and window manager.

I have installed the X Window System and can run i3 without any apparent issues but, if possible, I would like to run my graphical environment on top of Wayland.

Initially, running sway resulted in a prompt saying that the $XDG_RUNTIME_DIR was not set, so I added the following to my .profile:

Bash:
if [ -z "$XDG_RUNTIME_DIR" ]; then
    export XDG_RUNTIME_DIR=/tmp
    if [ ! -d  "$XDG_RUNTIME_DIR" ]; then
        mkdir "$XDG_RUNTIME_DIR"
        chmod 0700 "$XDG_RUNTIME_DIR"
    fi
fi
Now, when I run sway -d, the output says failed to open /dev/drm/0.

Any advice anybody is able to provide regarding where/what the problem might be - and if there are any useful commands for tracking it down - would be greatly appreciated. To be honest, I'm not sure where to start looking, whether the issue is likely to be hardware, driver or library related, or if I have made a mistake in the setup or failed to set something up.

Thanks,
 

bsdman934

New Member

Reaction score: 2
Messages: 3

You need graphics driver. https://wiki.freebsd.org/Graphics
On intel GPU I installed drm-kmod and edited the rc.conf . Now I got other error messages and don't know what to do...

like
(backend/libinput/backend) libinput initialization failed ;
(backend/multi/backend) failed to initialize backend ;
(sway/server) failed to start backend ;
(main.c ) missing a required wayland interface
 
OP
OP
L

lostleonardo

New Member


Messages: 6

Thanks for that.

I tried setting $WLR_LIBINPUT_NO_DEVICES=0 as per the error message and the window manager started. Of course, setting that environment variable then meant that none of my input devices would work, which probably should have been obvious, but I wanted to see what would happen regardless.

It looks as if libinput failing to find any input devices. Running libinput list-devices does not return any output which might imply an issue with libinput. Presumably, I would not even be able to type characters in the terminal if the keyboard was not being detected...
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 7,680
Messages: 30,598

Presumably, I would not even be able to type characters in the terminal if the keyboard was not being detected...
Keyboard is detected by ukbd(4) or atkbd(4) and used via kbdmux(4) on FreeBSD, libinput is a library that's used by Wayland. As such libinput is not required or needed on the console. Standard Xorg detects the keyboard through devd(8). Not sure how Wayland/libinput does this.
 

bsdman934

New Member

Reaction score: 2
Messages: 3

Sway-sessions need libinput to work properly because of Wayland protocol and sway-config. I still don't know how to fix this problem:



Please help.
 

Elazar

Member

Reaction score: 23
Messages: 38

Similar problem from the freebsd-x11 mailing list archive.
https://lists.freebsd.org/pipermail/freebsd-x11/2019-May/023313.html

> 12.0-RELEASE does not have EVDEV_SUPPORT enabled out of the box :( so
> all the drivers not developed for evdev specifically (e.g. wmt is, but
> ums/ukbd/psm/atkbd/etc aren't) do not have evdev support.
>
> IIRC, it's on by default in -STABLE, and it will be in 12.1-RELEASE.
>
> You have to either switch to a -STABLE snapshot kernel or rebuild a
> -RELEASE kernel with options EVDEV_SUPPORT. (or switch to -CURRENT of
> course :D)
>
> Also it's a good idea to set sysctl kern.evdev.rcpt_mask=12 to make
> sure you get events from individual devices instead of the
> virtual/multiplexed things.
Anyways, it might be best to ask your question in the x11-mailing list.
 
OP
OP
L

lostleonardo

New Member


Messages: 6

For what it's worth, I successfully rebuilt the kernel with EVDEV_SUPPORT enabled and libinput list-devices does now list the input devices attached to the machine. However, when I run sway, I still see the same output as bsdman934.
 

abishai

Aspiring Daemon

Reaction score: 165
Messages: 720

Maybe you need to have user access to dev nodes. Try to start sway with debugging enabled. I reckon it will be -d flag. I've used sway on my laptop and don't remember serious issues.
 
OP
OP
L

lostleonardo

New Member


Messages: 6

Running the command with the -d flag generates a lot more output but nothing interesting apart from the errors bsdman934 has posted. Is there anything in particular that I need to do to enable user access to dev nodes? I have added the user to the video and wheel groups...
 
OP
OP
L

lostleonardo

New Member


Messages: 6

When I chmod all the things in /dev/input to 777, Sway starts!

The mouse works, but there is still an issue with the keyboard... unless something else is ultimately responsible. The key combo to launch the terminal emulator elicits no response, the key combo to launch dmenu doesn't launch dmenu, and the key combo to exit to the tty does not produce the expected prompt. I am able to escape to the tty using Ctrl+Alt+F1, but when I return to the terminal running Sway, even that key combo no longer works.

An improvement of a kind but now I have a slightly different set of issues I don't really understand.
 

abishai

Aspiring Daemon

Reaction score: 165
Messages: 720

I remember this one. Find how xkb options are applied in sway (I don't remember and I've migrated back to i3. Probably, arch wiki or sway github contains it) and pass "XkbRules" "evdev" option. Set kern.evdev.rcpt_mask=12 in /etc/sysctl.conf too. Don't forget to share your config here, I believe this problem is common. Good luck!
 

bsdman934

New Member

Reaction score: 2
Messages: 3

When I chmod all the things in /dev/input to 777, Sway starts!

The mouse works, but there is still an issue with the keyboard... unless something else is ultimately responsible. The key combo to launch the terminal emulator elicits no response, the key combo to launch dmenu doesn't launch dmenu, and the key combo to exit to the tty does not produce the expected prompt. I am able to escape to the tty using Ctrl+Alt+F1, but when I return to the terminal running Sway, even that key combo no longer works.
There's probably no sway folder inside /etc/.
At least in my installation there was none at all. So I copied the sway folder from a Linux installation into /etc/sway. Of course you can copy the folder to the home directory as described in the sway wiki. The sway config is important to configure input-devices and everything else.
 
OP
OP
L

lostleonardo

New Member


Messages: 6

Adding input * xkb_rules "evdev" to the Sway config file and adding kern.evdev.rcpt_mask=12 in /etc/sysctl.conf allowed the keyboard to work!

I still have to chmod the contents of the /dev/input directory every time I boot the machine. Is there a better, more stable way of achieving the same? Also, udev is not working as I would expect... do I need to write rules for each of the devices that I want to 'hotplug' or should that be being handled?

There are two remaining issues.

Code:
The XKEYBOARD keymap compiler (xkbcomp) reports:
Warning:        Unsupported maximum keycode 374, clipping.
                X11 cannot support keycodes above 255.
Warning:        Unsupported high keycode 372 for name <I372> ignored
And yet another message says that "not handling selection events: no seat assigned to xwayland".

I think that both of these issues are to do with how Sway handles running X programs.

Many thanks for the help getting things this far.
 

abishai

Aspiring Daemon

Reaction score: 165
Messages: 720

You can apply proper rights in /etc/devfs.rules

Something like this:
Code:
[localrules=10]

add path 'input/*' mode 0660 group video
and add devfs_system_ruleset="localrules" in your /etc/rc.conf

Warning is harmless.

I believe, libinput has probles with hotplug with both backends (udev and devd). At least, in Xorg.
 
Top