Sway on a systemd-less system (using openrc and elogind), will fail to start on Gentoo due to permissions issues. This is solved by running `chmod u+s /usr/bin/sway` as root. The need for this workaround is confirmed by upstream: https://github.com/swaywm/sway/wiki/Running-Sway-without-systemd
I'm using Sway with OpenRC and ConsoleKit, and I don't have the SUID bit set. As you can see in the wiki page you linked, there are 2 ways to get Sway running on no-logind systems (applies only to a OpenRC/ConsoleKit setup - with elogind you should not need these): setuid and capabilities. The ebuild correctly takes care of this: it uses the fcaps.eclass to set the CAP_SYS_ADMIN capability if capabilities are supported and the filecaps flag is enabled. Otherwise, it set the SUID bit on the binary. Probably, the ebuild found that your system supports capabilities and you have the filecaps use flag enabled. If you check with `getcap /usr/bin/sway` you should see that the binary has the CAP_SYS_ADMIN cap enabled. So, if you have problems with Sway, they must be searched somewhere else. Some common mistakes are: - You forgot to add your user to the `input` group (it's required that the user do it manually - the ebuild can not take care of this); - You are using ConsoleKit (instead of systemd or elogind) and you are not launching Sway in the right manner. As advised by the ebuild at the end of the installation, with ConsoleKit you must run Sway with `exec ck-launch-session sway`; If you still have problems, please post the output of `emerge --info dev-libs/sway` and the output of Sway when launched.
I've read 'openrc or elogind' instead of 'openrc and elogind' in your message before. Even with elogind you should not have the need to set SUID or capabilities: the wiki talks about three different *exclusive* methods to run Sway without systemd: - With elogind; - Directly, via setuid; - Directly, via capabilities. The sense of using elogind with Sway is just to avoid giving Sway root permissions. So the problem with permissions should be somewhere else. Please, post the output of `emerge --info dev-libs/sway dev-libs/wlroots` (since the problem may be in wlroots) and `sway` when launched.
Created attachment 557226 [details] emerge --info dev-libs/sway dev-libs/wlroots
Please see attachment for the command output. Adding myself to the input group (which indeed I had not done) changes nothing. I still need the uid bit.
Even the `sway` output may be useful. Remove the SUID bit to the Sway binary and run it. If the system hangs during Sway launch, you can redirect the output of `sway` to a file using: sway > output.txt 2>&1
Created attachment 557278 [details] sway.log without uid
Created attachment 557280 [details] sway.log with uid
Added sway logs for both with or without UID usage ^
I see. I'm setting up a test environment with elogind. I will comment here again as soon as I find the solution to the issue. For now, just use the setuid/cap_sys_admin: it's quite safe since Sway drops root asap.
Thanks for looking into this, at any rate it should be addressed by the package manager, as it stands whenever one re-compiles and re-starts sway it breaks and you have to re-log in as root and set the UID bit.
I've got Sway running in QEMU with OpenRC and elogind, without the setuid bit set. Looking at your `sway.log without uid` seems that Sway is not able to connect to elogind. This is probably caused by the fact that elogind is not started when Sway is launched. Try this: - Remove the setuid from the sway binary (or re-emerge it); - from root: `rc-update add elogind boot` then reboot; - Try running Sway again.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dcd8d505572b7922e9939f5eaa442fa210f38052 commit dcd8d505572b7922e9939f5eaa442fa210f38052 Author: Niccolò Scatena <speedjack95@gmail.com> AuthorDate: 2019-02-09 23:47:06 +0000 Commit: Aaron Bauman <bman@gentoo.org> CommitDate: 2019-02-13 00:04:18 +0000 dev-libs/sway: various fixes - Use ${PN} wherever possible; - Remove bash-completion use flag: bash completions should be always installed (see [1]); - Remove clipboard use flag and related dep: makes no sense to add this here, if the user wants to add utilities to handle the clipboard under wayland it is just and emerge away; wl-clipboard has nothing to do with sway; - Rename use flag: doc -> man (doc is a global use flag used to install additional documentation that most users does not want); - The sway tray feature (enabled by the tray use flag) now requires a logind provider: reflect this in REQUIRED_USE (fixes #677748); - Fix order of (R)DEPEND; - Remove required use gdk-pixbuf[jpeg]: the jpeg use flag is not required to be enabled. If the user wants support for JPEG images, he can manually enable it in gdk-pixbuf (as for other img formats); - Remove libcap dep: the fcaps eclass automatically adds it if filecaps use flag is enabled; - Dependency dbus is no longer required with tray (now uses sd-bus from logind): remove anything related to it; - Move scdoc and wayland-protocols dependencies to BDEPEND; - Add dep on xkeyboard-config: see bug #674640; - Add man-pages parameter to meson (fixes bug #677654); - Disable swaybar man page installation when swaybar use flag is disabled; - Use $MY_PV in sway-version arg to meson to reflect upstream version in sway --version; - Add a reminder to set XDG_RUNTIME_DIR if it's not set by the environment. This is needed in systems without logind/consolekit. [1] www.gentoo.org/support/news-items/2014-11-25-bash-completion-2_1-r90.html Closes: https://bugs.gentoo.org/672590 Closes: https://bugs.gentoo.org/675978 Closes: https://bugs.gentoo.org/674640 Closes: https://bugs.gentoo.org/677654 Closes: https://bugs.gentoo.org/677748 Package-Manager: Portage-2.3.59, Repoman-2.3.12 Signed-off-by: Niccolò Scatena <speedjack95@gmail.com> Signed-off-by: Aaron Bauman <bman@gentoo.org> dev-libs/sway/metadata.xml | 5 +- dev-libs/sway/sway-1.0_beta1.ebuild | 66 +++++++++++------- dev-libs/sway/sway-1.0_beta2.ebuild | 66 +++++++++++------- ...{sway-1.0_rc1.ebuild => sway-1.0_rc1-r1.ebuild} | 79 +++++++++++++--------- dev-libs/sway/sway-9999.ebuild | 79 ++++++++++++---------- 5 files changed, 174 insertions(+), 121 deletions(-)