Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 708680 - gui-wm/sway with sys-apps/systemd-245_rc1-r1 : backend/session/direct-ipc.c:35: Do not have CAP_SYS_ADMIN; cannot become DRM master
Summary: gui-wm/sway with sys-apps/systemd-245_rc1-r1 : backend/session/direct-ipc.c:3...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal with 1 vote (vote)
Assignee: Aaron Bauman
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-02-08 07:40 UTC by Vasco Gervasi
Modified: 2020-05-16 19:23 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (emerge.info,14.33 KB, text/plain)
2020-02-08 07:40 UTC, Vasco Gervasi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vasco Gervasi 2020-02-08 07:40:06 UTC
Hi all,
I am running the latest ~amd64.
Updating systemd to 245_rc1-r1 gives the following error on running sway from console:

$ sway -V
2020-02-08 07:35:23 - [sway/main.c:152] Linux janis 5.5.2 #1 SMP PREEMPT Thu Feb 6 08:10:12 GMT 2020 x86_64 Intel(R) Core(TM) i7-4810MQ CPU @ 2.80GHz GenuineIntel GNU/Linux
2020-02-08 07:35:23 - [sway/main.c:168] Contents of /etc/os-release:
2020-02-08 07:35:23 - [sway/main.c:152] NAME=Gentoo
2020-02-08 07:35:23 - [sway/main.c:152] ID=gentoo
2020-02-08 07:35:23 - [sway/main.c:152] PRETTY_NAME="Gentoo/Linux"
2020-02-08 07:35:23 - [sway/main.c:152] ANSI_COLOR="1;32"
2020-02-08 07:35:23 - [sway/main.c:152] HOME_URL="https://www.gentoo.org/"
2020-02-08 07:35:23 - [sway/main.c:152] SUPPORT_URL="https://www.gentoo.org/support/"
2020-02-08 07:35:23 - [sway/main.c:152] BUG_REPORT_URL="https://bugs.gentoo.org/"
2020-02-08 07:35:23 - [sway/main.c:168] Contents of /etc/gentoo-release:
2020-02-08 07:35:23 - [sway/main.c:152] Gentoo Base System release 2.6
2020-02-08 07:35:23 - [sway/main.c:140] LD_LIBRARY_PATH=(null)
2020-02-08 07:35:23 - [sway/main.c:140] LD_PRELOAD=(null)
2020-02-08 07:35:23 - [sway/main.c:140] PATH=/usr/lib/llvm/9/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin
2020-02-08 07:35:23 - [sway/main.c:140] SWAYSOCK=(null)
2020-02-08 07:35:23 - [backend/session/logind.c:217] Failed to activate session: Permission denied
2020-02-08 07:35:23 - [backend/session/direct-ipc.c:35] Do not have CAP_SYS_ADMIN; cannot become DRM master
2020-02-08 07:35:23 - [backend/session/session.c:96] Failed to load session backend
2020-02-08 07:35:23 - [backend/backend.c:286] Failed to start a DRM session
2020-02-08 07:35:23 - [backend/noop/backend.c:51] Creating noop backend
2020-02-08 07:35:23 - [sway/server.c:47] Unable to create backend

Downgrading to systemd-244 does not present this error.

Thanks



Reproducible: Always

Steps to Reproduce:
1. emerge =systemd-245_rc1-r1
2. sway
3.
Actual Results:  
2020-02-08 07:35:23 - [backend/session/logind.c:217] Failed to activate session: Permission denied
2020-02-08 07:35:23 - [backend/session/direct-ipc.c:35] Do not have CAP_SYS_ADMIN; cannot become DRM master
2020-02-08 07:35:23 - [backend/session/session.c:96] Failed to load session backend
2020-02-08 07:35:23 - [backend/backend.c:286] Failed to start a DRM session
2020-02-08 07:35:23 - [backend/noop/backend.c:51] Creating noop backend
2020-02-08 07:35:23 - [sway/server.c:47] Unable to create backend


Expected Results:  
sway session
Comment 1 Vasco Gervasi 2020-02-08 07:40:35 UTC
Created attachment 612632 [details]
emerge --info
Comment 2 Matthew Thode ( prometheanfire ) archtester Gentoo Infrastructure gentoo-dev Security 2020-02-08 19:20:24 UTC
I'm not seeing any reason 245 should cause problems (and 244 works for me).  https://github.com/systemd/systemd/blob/master/NEWS

is sway emerged with the systemd use flag set?  (emerge --info sway)
Comment 3 Vasco Gervasi 2020-02-08 19:57:38 UTC
Yes it is:

[ebuild   R    ] gui-wm/sway-1.4::gentoo  USE="man swaybar swaybg swaylock swaymsg swaynag systemd -X -elogind -fish-completion -swayidle -tray -wallpapers -zsh-completion" 0 KiB
Comment 4 Vasco Gervasi 2020-02-25 18:49:38 UTC
Same error with systemd-245_rc1-r2
Comment 5 Vasco Gervasi 2020-03-04 22:13:38 UTC
Same error with systemd-245_rc2
Comment 6 Vasco Gervasi 2020-03-08 18:36:00 UTC
Same error with systemd-245
Comment 7 Vasco Gervasi 2020-03-13 06:16:31 UTC
Maybe related to this: 
https://github.com/systemd/systemd/commit/4acf0cfd2f92edb94ad48d04f1ce6c9ab4e19d55
Comment 8 Daniel Cordero 2020-03-22 20:15:29 UTC
I also ran into this when upgrading to systemd-245. After upgrading through portage, I ran `systemd-run -S` (use systemd-run to get a root shell) as root, which crashed sway and sddm and both wouldn't start again.

Two workarounds:

1) adding CAP_SYS_ADMIN to /usr/bin/sway

setcap cap_sys_admin+ep /usr/bin/sway

2) adding a polkit rule to allow passwordless access to org.freedesktop.login1.chvt:

polkit.addRule(function(action, subject) {
    if (action.id == "org.freedesktop.login1.chvt") {
      return polkit.Result.YES;
    }
});

Also, downgrading to systemd-244 also 'resolves' the issue.
Comment 9 Vasco Gervasi 2020-03-23 07:30:50 UTC
Upstream a patch has been merged (https://github.com/systemd/systemd/commit/19bb87fbfac8df67c0c8ff4714382a88733c61a2), I have tried to patch systemd-245 but still same error.

Thanks
Comment 10 Matthew Thode ( prometheanfire ) archtester Gentoo Infrastructure gentoo-dev Security 2020-03-24 02:19:01 UTC
related to this patch?

(test the systemd patch please)

https://github.com/systemd/systemd/pull/15111
Comment 11 Matthew Thode ( prometheanfire ) archtester Gentoo Infrastructure gentoo-dev Security 2020-03-24 02:19:30 UTC
and nevermind :|
Comment 12 Matthew Thode ( prometheanfire ) archtester Gentoo Infrastructure gentoo-dev Security 2020-03-24 02:21:17 UTC
have you tried with the https://github.com/systemd/systemd/commit/4acf0cfd2f92edb94ad48d04f1ce6c9ab4e19d55 patch though (I see that you tried with the oneline patch)
Comment 13 Vasco Gervasi 2020-03-24 14:02:46 UTC
Seems that https://github.com/systemd/systemd/commit/4acf0cfd2f92edb94ad48d04f1ce6c9ab4e19d55 is already part of 245.
Comment 14 Matthew Thode ( prometheanfire ) archtester Gentoo Infrastructure gentoo-dev Security 2020-03-24 15:40:09 UTC
ya, it looks like the error may be something else
Comment 15 Piero La Terza 2020-04-07 21:45:55 UTC
I experienced this issue as well, but since upgrading to 245 in a new installation, I don't have this problem anymore.

However, I did manage to fix this by enabling early kernel modesetting.

Using `dracut`:

```
$ cat /etc/dracut.conf.d/10-drm.conf
add_dracutmodules+="drm"
```

Hope this proves helpful in some way.
Comment 16 Piero La Terza 2020-04-07 21:47:58 UTC
(In reply to Piero La Terza from comment #15)
> I experienced this issue as well, but since upgrading to 245 in a new
> installation, I don't have this problem anymore.
> 
> However, I did manage to fix this by enabling early kernel modesetting.
> 
> Using `dracut`:
> 
> ```
> $ cat /etc/dracut.conf.d/10-drm.conf
> add_dracutmodules+="drm"
> ```
> 
> Hope this proves helpful in some way.

PS. if you do this, you'll also have to regenerate your initramfs.
Comment 17 Vasco Gervasi 2020-04-11 12:51:36 UTC
drm is correctly loaded:

```
$ dmesg | grep drm                                                                  
[    0.497579] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[    0.497581] [drm] Driver supports precise vblank timestamp query.
[    0.518727] [drm] Initialized i915 1.6.0 20200114 for 0000:00:02.0 on minor 0
[    0.747427] fbcon: i915drmfb (fb0) is primary device
[    2.230944] i915 0000:00:02.0: fb0: i915drmfb frame buffer device
```

Am I missing something?
Comment 18 Vasco Gervasi 2020-04-11 13:09:04 UTC
Also I have tried to run:
```
$ setcap cap_sys_admin+ep /usr/bin/sway
```

But I got this errors:
```

2020-04-11 13:59:21 - [backend/session/direct.c:48] Failed to open /dev/input/event2: Permission denied
2020-04-11 13:59:21 - [backend/session/direct.c:48] Failed to open /dev/input/event3: Permission denied
2020-04-11 13:59:21 - [backend/session/direct.c:48] Failed to open /dev/input/event4: Permission denied
2020-04-11 13:59:21 - [backend/session/direct.c:48] Failed to open /dev/input/event0: Permission denied
2020-04-11 13:59:21 - [backend/session/direct.c:48] Failed to open /dev/input/event1: Permission denied
2020-04-11 13:59:21 - [backend/session/direct.c:48] Failed to open /dev/input/event11: Permission denied
2020-04-11 13:59:21 - [backend/session/direct.c:48] Failed to open /dev/input/event12: Permission denied
2020-04-11 13:59:21 - [backend/session/direct.c:48] Failed to open /dev/input/event13: Permission denied
2020-04-11 13:59:21 - [backend/session/direct.c:48] Failed to open /dev/input/event14: Permission denied
2020-04-11 13:59:21 - [backend/session/direct.c:48] Failed to open /dev/input/event15: Permission denied
2020-04-11 13:59:21 - [backend/session/direct.c:48] Failed to open /dev/input/event16: Permission denied
2020-04-11 13:59:21 - [backend/session/direct.c:48] Failed to open /dev/input/event17: Permission denied
2020-04-11 13:59:21 - [backend/session/direct.c:48] Failed to open /dev/input/event18: Permission denied
2020-04-11 13:59:21 - [backend/session/direct.c:48] Failed to open /dev/input/event19: Permission denied
2020-04-11 13:59:21 - [backend/session/direct.c:48] Failed to open /dev/input/event23: Permission denied
2020-04-11 13:59:21 - [backend/session/direct.c:48] Failed to open /dev/input/event24: Permission denied
2020-04-11 13:59:21 - [backend/session/direct.c:48] Failed to open /dev/input/event25: Permission denied
2020-04-11 13:59:21 - [backend/session/direct.c:48] Failed to open /dev/input/event26: Permission denied
2020-04-11 13:59:21 - [backend/session/direct.c:48] Failed to open /dev/input/event27: Permission denied
2020-04-11 13:59:21 - [backend/session/direct.c:48] Failed to open /dev/input/event28: Permission denied
2020-04-11 13:59:21 - [backend/session/direct.c:48] Failed to open /dev/input/event29: Permission denied
2020-04-11 13:59:21 - [backend/session/direct.c:48] Failed to open /dev/input/event30: Permission denied
2020-04-11 13:59:21 - [backend/session/direct.c:48] Failed to open /dev/input/event31: Permission denied
2020-04-11 13:59:21 - [backend/session/direct.c:48] Failed to open /dev/input/event256: Permission denied
2020-04-11 13:59:21 - [backend/session/direct.c:48] Failed to open /dev/input/event8: Permission denied
2020-04-11 13:59:21 - [backend/session/direct.c:48] Failed to open /dev/input/event9: Permission denied
2020-04-11 13:59:21 - [backend/session/direct.c:48] Failed to open /dev/input/event10: Permission denied
2020-04-11 13:59:21 - [backend/session/direct.c:48] Failed to open /dev/input/event6: Permission denied
2020-04-11 13:59:21 - [backend/session/direct.c:48] Failed to open /dev/input/event7: Permission denied
2020-04-11 13:59:21 - [backend/session/direct.c:48] Failed to open /dev/input/event5: Permission denied
2020-04-11 13:59:21 - [backend/session/direct.c:48] Failed to open /dev/input/event20: Permission denied
2020-04-11 13:59:21 - [backend/session/direct.c:48] Failed to open /dev/input/event21: Permission denied
2020-04-11 13:59:21 - [backend/session/direct.c:48] Failed to open /dev/input/event22: Permission denied
2020-04-11 13:59:21 - [backend/libinput/backend.c:84] libinput initialization failed, no input devices
2020-04-11 13:59:21 - [backend/libinput/backend.c:85] Set WLR_LIBINPUT_NO_DEVICES=1 to suppress this check
2020-04-11 13:59:21 - [backend/multi/backend.c:32] Failed to initialize backend.
2020-04-11 13:59:21 - [sway/server.c:199] Failed to start backend
```

Any ideas?

Thanks
Comment 19 Vasco Gervasi 2020-05-16 19:23:20 UTC
Seems that:
sudo chmod a+s /usr/bin/sway

did the trick.

I think will be very helpful if the sway ebuild is modified to run this command if sway is compiled with `-elogind` use flag?