FS#73547 - [sway] polkit is not needed as a dependency

Attached to Project: Community Packages
Opened by Ayush Agarwal (ayushnix) - Saturday, 29 January 2022, 12:54 GMT
Last edited by Brett Cornwall (ainola) - Friday, 20 May 2022, 19:05 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Jerome Leclanche (Adys)
Brett Cornwall (ainola)
Maxim Baz (maximbaz)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

I've been able to confirm that sway version 1:1.7-1 works fine without polkit
and by using seatd instead which is a dependency of wlroots 0.15.0-4 which in
turn is a dependency of sway itself. I created a custom PKGBUILD and removed
polkit from the list of dependencies. I didn't make any other changes.

Here's what I did although some variations of the following steps may also
work:

- create a group for seatd

groupadd -r seatd

- add $USER to the seatd group

usermod -aG seatd

- create, and enable, a systemd service file for seatd using the this upstream link

https://git.sr.ht/~kennylevinsen/seatd/tree/master/item/contrib/systemd/seatd.service

- reboot the system and sway starts and works without issues

I've also tested this with, and without, greetd although I don't think that's
relevant. I'm willing to add instructions to the arch wiki page of sway as well if the
polkit dependency is removed. The Alpine Linux wiki has some instructions about this
setup as well.

https://wiki.alpinelinux.org/wiki/Sway

If, for some reason, polkit is still desired as a dependency (although I'm not sure why
that would be the case), it should probably be made an optional dependency.
This task depends upon

Closed by  Brett Cornwall (ainola)
Friday, 20 May 2022, 19:05 GMT
Reason for closing:  Implemented
Comment by Ayush Agarwal (ayushnix) - Saturday, 29 January 2022, 12:58 GMT
`usermod -aG seatd` should be `usermod -aG $USER`
Comment by Brett Cornwall (ainola) - Wednesday, 16 February 2022, 13:56 GMT
Thanks for all your investigation and thorough explanation, ayushnix! I'll do some testing myself later this week.
Comment by Brett Cornwall (ainola) - Monday, 09 May 2022, 04:32 GMT
I can confirm that this does work.

Do we have any reason to prefer one method over another? I personally don't really care. Functionally, both polkit and seatd seem to serve the same purpose. What benefit does leaning on seatd give us over polkit?

It does bear mentioning that using the seatd method would require user intervention since their user would have to be added to the "seat" group. That means manual intervention, which ultimately means lots of users that will end up with broken systems when they miss the news. :)

@maximbaz: Any opinions?
Comment by Ayush Agarwal (ayushnix) - Monday, 09 May 2022, 14:47 GMT
@ainola

> What benefit does leaning on seatd give us over polkit?

We would remove an unnecessary dependency considering seatd is bound to be installed when installing sway.

> It does bear mentioning that using the seatd method would require user intervention since their user would have to be added to the "seat" group.

Please correct me if I'm wrong but if we make polkit an optional dependency of sway, users who are unaware of the seatd method of using sway won't be affected in subsequent upgrades. New users who install sway for the first time can choose between using seatd or polkit. Of course, this caveat would need documentation and I'm ready to add that to the sway wiki page.
Comment by Brett Cornwall (ainola) - Wednesday, 11 May 2022, 04:41 GMT
That sounds reasonable to me. I'll do some more testing to verify the upgrade path and then push updates to seatd/sway. Thanks for hanging in there with me, ayushnix
Comment by Brett Cornwall (ainola) - Wednesday, 11 May 2022, 05:30 GMT
The biggest downside here is that initial users will have to either manually add themselves to the "seat" group/re-log or manually install polkit. Either will require a secondary step to get a running system (i.e. sway is "broken" out of the box.)

I've updated seatd to include the upstream service file and created a seat user; The package can be found in [community-testing].

I've also built sway-1.7-3 with the new setup, though that's going to live in [community-staging] until we're going to go forward. This does seem to be the most "correct" path, it's just unfortunate about the inevitable confusion users will get.

@maximbaz, I'll give you some more time to respond if you have any thoughts/opinions. :)
Comment by Maxim Baz (maximbaz) - Wednesday, 11 May 2022, 14:23 GMT
Hello, thanks for the ping, and for the interesting suggestion! Overall I share the same sentiment as Brett, it's not ideal that sway won't be functional after installation, but on the other hand let's not force one dep as required if it's clearly one of the possible options.

Two comments on the PKGBUILD:
- we probably shouldn't make `seatd` a required dep either, I think it should be together with `polkit` in `optdepends`, indicating that either is an option.
- in addition to `post_upgrade` we probably need a `post_install` too, saying that if you go with `seatd` option, you have to add yourself to the group.

What do you think?
Comment by Brett Cornwall (ainola) - Wednesday, 11 May 2022, 18:35 GMT
Those are reasonable suggestions. I'll update the package to include those changes. ayushnix, you mentioned being ready for updating a wiki page; Does that mean you have a draft already written?
Comment by Brett Cornwall (ainola) - Wednesday, 11 May 2022, 18:46 GMT
Oh, maximbaz, seatd is a dependency regardless of whether the daemon is used or not.
Comment by Ayush Agarwal (ayushnix) - Wednesday, 11 May 2022, 19:02 GMT
> ayushnix, you mentioned being ready for updating a wiki page; Does that mean you have a draft already written?

I don't, but I can prepare it within a day or two. Is this the right place to discuss changes to the wiki?
Comment by Brett Cornwall (ainola) - Wednesday, 11 May 2022, 19:04 GMT
I've pushed sway-1.7-4 to [community-staging] with a post_install() function. Feel free to test it out alongside seatd 0.6.4-2 in [community-testing]!
Comment by Brett Cornwall (ainola) - Wednesday, 11 May 2022, 21:04 GMT
It's no problem! I just didn't want to duplicate efforts if you had already written it. For simplifying coordination, I'll go ahead and write the wiki changes (unless you want to do that!) so that they're live once these packages reach [community].
Comment by Ayush Agarwal (ayushnix) - Thursday, 12 May 2022, 14:58 GMT
Sounds good, let me know if I can help.
Comment by Brett Cornwall (ainola) - Thursday, 12 May 2022, 17:55 GMT
Sure! You could test those packages and make sure that there's nothing we're missing for this transition. I think it's all handled but I wouldn't be surprised if I forgot something :).
Comment by Ayush Agarwal (ayushnix) - Thursday, 12 May 2022, 18:22 GMT
There may be room for improvement in these two areas

1. seatd may not be needed as a required dependency of sway because sway will need wlroots which in turn needs seatd. I think that makes mentioning seatd as a required dependency of sway as redundant? seatd is also not specified as a dependency of sway on sway's github page (they mention making sway a suid although I don't think we should do that) and libseat (seatd) is mentioned as a dependency of wlroots on their gitlab page.

2. This is unrelated but dmenu is mentioned as an optional dependency of sway. However, dmenu is an Xorg program and needs Xwayland installed and enabled to run. Moreover, if a user has changed the scale of his display, dmenu will appear blurry, which results in a poor user experience. There are many wayland native dmenu replacements such as fuzzel, bemenu, wofi etc. I guess we can either recommend one of these wayland native dmenu programs instead or simply remove dmenu as a suggested optional dependency.
Comment by Brett Cornwall (ainola) - Saturday, 14 May 2022, 02:46 GMT
Indeed, it appears that the sway binary does not depend on the libseat shared object, I removed it. I also added all the dependent shared objects. For dmenu, I kept it in the optdepends because it's in the default configuration. But I added bemenu as a wayland-native alternative.

These changes are in sway-1:1.7-6. I'll dogfood it some before pushing it to [community-testing].

Thanks for the feedback!
Comment by Ayush Agarwal (ayushnix) - Saturday, 14 May 2022, 06:31 GMT
Another possibly unrelated nitpick but the wlroots 0.15.1-3 package lists both seatd and libseat as required dependencies. I guess mentioning seatd is redundant?
Comment by Brett Cornwall (ainola) - Saturday, 14 May 2022, 17:26 GMT
I reworked the dep list. Thanks!
Comment by Ayush Agarwal (ayushnix) - Saturday, 14 May 2022, 17:48 GMT
Thanks Brett!
Comment by Ayush Agarwal (ayushnix) - Tuesday, 17 May 2022, 19:36 GMT
@ainola,

I've prepared the section that should be added to the sway wiki page. Should I add it?

https://gist.github.com/ayushnix/b4d6eedc64743b3dd5da1c5b024aba3b
Comment by Brett Cornwall (ainola) - Wednesday, 18 May 2022, 02:57 GMT
I'm letting sway-1:1.7-8 marinate in [community-testing], where it's been promoted. In the next day or two we can push it live.
Comment by Brett Cornwall (ainola) - Friday, 20 May 2022, 17:41 GMT
sway-1:1.7-9 (includes an unrelated change) has been moved to [community]. Update away, ayushnix!
Comment by Ayush Agarwal (ayushnix) - Friday, 20 May 2022, 18:15 GMT Comment by Brett Cornwall (ainola) - Friday, 20 May 2022, 19:04 GMT
Thanks. I've also updated the Cage package in a similar manner.

Loading...