MarkusVolk / meta-wayland

BSD 2-Clause "Simplified" License
17 stars 9 forks source link

How to start sway #3

Closed munoz0raul closed 1 year ago

munoz0raul commented 1 year ago

Hi,

I'm trying sway for the very first time. To be honest, I'm a little bit confuse on how to start it.

First, I'm having conflicts if I try as root, it says that I can use root user. But, when I'm trying with the normal user, I'm getting permission errors:

Dec 21 16:24:50 raspberrypi4-64 sway[1054]: 00:00:00.006 [ERROR] [wlr] [libseat] [common/terminal.c:149] Could not open target tty: Permission denied
Dec 21 16:24:50 raspberrypi4-64 sway[1054]: 00:00:00.006 [ERROR] [wlr] [libseat] [seatd/seat.c:60] Could not open tty0 to update VT: Permission denied
Dec 21 16:24:50 raspberrypi4-64 sway[1054]: 00:00:00.006 [ERROR] [wlr] [libseat] [common/terminal.c:149] Could not open target tty: Permission denied
Dec 21 16:24:50 raspberrypi4-64 sway[1054]: 00:00:00.006 [ERROR] [wlr] [libseat] [seatd/seat.c:71] Could not open terminal for VT 0: Permission denied
Dec 21 16:24:50 raspberrypi4-64 sway[1054]: 00:00:00.006 [ERROR] [wlr] [libseat] [seatd/seat.c:449] Could not open VT for client
Dec 21 16:24:50 raspberrypi4-64 sway[1054]: 00:00:00.006 [ERROR] [wlr] [libseat] [common/terminal.c:149] Could not open target tty: Permission denied
Dec 21 16:24:50 raspberrypi4-64 sway[1054]: 00:00:00.006 [ERROR] [wlr] [libseat] [seatd/seat.c:85] Could not open terminal to clean up VT 0: Permission denied

Also, could you explain to me if sway automatically starts Wayland or if I should have Wayland already up when starting it?

Thanks for all help.

MarkusVolk commented 1 year ago

Hi, are you working with systemd or sysvinit? Which poky branch are you on? In general I would check if seatd is running. You would also need to build your image with polkit DISTRO_FEATURE.

Then you should be able to run sway directly from the terminal like you tried.

munoz0raul commented 1 year ago

The log I sent was systemd log.

I tried over the terminal as well but didn't work as well.

I'm using the kirkstone branch, just because the master ask for a newer wayland. I think it is asking for 1.21 instead of 1.20.

I can give it a try and add polkit.

Any suggestion on how to start sway after installing it?

MarkusVolk commented 1 year ago

I start it just like this in .bashrc

if [ -z $DISPLAY ] && [ "$(tty)" == "/dev/tty1" ]; then
    /usr/bin/sway
fi

If you have not already done so, make sure to export these environment variables


export XDG_SESSION_TYPE=wayland
export XDG_SESSION_DESKTOP=sway
export XDG_CURRENT_DESKTOP=sway
munoz0raul commented 1 year ago

@MarkusVolk thanks for helping me.

Well, I need to figure out how I will solve it, but basically, I ssh on my device.

using sudo I launch seatd and change the owner of the socket:

fio@raspberrypi4-64:~$ sudo su
root@raspberrypi4-64:/var/rootdirs/home/fio# seatd &
[1] 1119
root@raspberrypi4-64:/var/rootdirs/home/fio# chown fio:fio /run/seatd.sock 

After doing it, the commands from my no-root user start to work.

fio@raspberrypi4-64:~$ export XDG_SESSION_TYPE=wayland
fio@raspberrypi4-64:~$ export XDG_SESSION_DESKTOP=sway
fio@raspberrypi4-64:~$ export XDG_CURRENT_DESKTOP=sway
fio@raspberrypi4-64:~$ /usr/bin/sway

Any suggestion?

image

MarkusVolk commented 1 year ago

Some progress :)

Normally it shouldn't be needed to start standalone seatd for systemd. This should work just with logind/libseat. Can you check your seatd log.do_configure if systemd support was built?

seatd 0.7.0

    libseat-seatd  : YES
    libseat-builtin: YES
    libseat-systemd: YES
    libseat-elogind: NO
    server         : YES

  User defined options
    Cross files    : /home/flk/poky/build-intel/tmp/work/corei7-64-poky-linux/seatd/0.7.0-r0/meson.cross
    Native files   : /home/flk/poky/build-intel/tmp/work/corei7-64-poky-linux/seatd/0.7.0-r0/meson.native
    bindir         : bin
    buildtype      : plain
    datadir        : share
    includedir     : include
    infodir        : share/info
    libdir         : lib
    libexecdir     : libexec
    localstatedir  : /var
    mandir         : share/man
    prefix         : /usr
    sbindir        : sbin
    sharedstatedir : /com
    sysconfdir     : /etc
    wrap_mode      : nodownload
    libseat-builtin: enabled

the libseat-systemd backend should be runtime-detected but you can try to set it manually by exporting export LIBSEAT_BACKEND=logind https://sr.ht/~kennylevinsen/seatd/

munoz0raul commented 1 year ago

Found a way to make it work.

I'm using systemctl and couldn't find a service to launch seatd.

I then create a service to lanch it and run it on -g video. (Copy some part from weston init)

+#!/bin/sh
+# Copyright (C) 2016 O.S. Systems Software LTDA.
+# Copyright (C) 2016 Freescale Semiconductor
+
+export PATH="/sbin:/usr/sbin:/bin:/usr/bin"
+SWAY_USER=fio
+if test -z "$XDG_RUNTIME_DIR"; then
+   export XDG_RUNTIME_DIR=/run/user/1000
+   if ! test -d "$XDG_RUNTIME_DIR"; then
+       mkdir --parents $XDG_RUNTIME_DIR
+       chmod 0700 $XDG_RUNTIME_DIR
+   fi
+   if [ -n "$SWAY_USER" ]
+   then
+       chown $SWAY_USER:$SWAY_USER $XDG_RUNTIME_DIR
+   fi
+fi
+
+seatd -g video

Then I start sway but add my user as part of video, render, and tty.

I hope it helps someone when trying it on systemctl.