Hi, Am Donnerstag, 5. Mai 2022, 13:44:50 CEST schrieb Luca Di Maio:
Hi all,
as discussed on the matrix channel, there is the need for MicroOS Desktop users to be notified about needed reboots for updates.
Brainstorming about it one of the solutions could be:
1 - reintroduce transactional-update.timer 2 - set up rebootmgr to work well with desktop workloads 3 - notify the user that the system is updated and a reboot is needed 4 - nice-to-have: if I click the notification it calls the native reboot prompt of the installed DE.
IMO ideally transactional updates get integrated into the usual (maybe DE specific) ways to perform updates. That way they're rather similar to PK offline upgrades which most of them can already handle.
What I'm proposing now is just a proof of concept.
As a starting idea, I've thought about patching rebootmgr to have a new strategy: notify
Here is the patched rebootmgr: https://github.com/89luca89/rebootmgr/tree/feature/add_notify_strategy
The patch consists in adding the strategy to rebootmgrctl and rebootmgrd. The new strategy should consist in notifying the user with a dbus notification. The problem that came up is that I couldn't find a way for a root service to de-privilege itself to use the user's dbus-session, I had various errors about DISPLAY variable, xauth and so on.
The best option is to just send a signal over DBus (system bus) that some updates were installed (ideally with some details). That can be picked up by any daemon in the user session and get translated to a persistent notification with a reboot button. Ideally also update failures get announced that way. Currently it just silently fails, so unless the journal is getting looked at randomly it's currently too easy to miss that the system didn't get updated properly for a while. Cheers, Fabian
To work around it, I thought of creating an user-running service (systemctl --user), that would open a file socket in /run/user/$ID/ that would receive the command to launch the notification.
You can find the example daemon here (very example...): https://gist.github.com/89luca89/bd78f5e716a7bd9206f802756e6c10de
So you would have:
t-u -> rebootmgrctl reboot -> dbus message to -> reboomgrd -> contact file socket -> user_notification_daemon
The routine I've added to the rebootmgrd should find all the active sockets for all users and contact all of them so that all users are notified about the update.
I'd like to have a feedback on the implementation, I'm 100% sure there is a lot to improve and I'm surely missing something on that user's dbus-session issue I had. As it stands now this proof of concept is working right now on my installation.
Thanks, 89luca89