:: Re: [DNG] What is a user-init?
Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Alexandros Prekates
Ημερομηνία:  
Προς: dng
Αντικείμενο: Re: [DNG] What is a user-init?

A small effort to summarize the thread on userland services and the
propable need to init / supervise them.

My first issue that prompted some general thoughts on init, runit
and possible user-init were that emacs can run as a server (1).
Now i think it helps to point that usually (see Mysetup) i avoid
full featured desktop thus when i hear service or daemon my first answer
would be apache or sshd .Not a notification daemon or pulseaudio. Or emacs!
So emacs presents it self as capable of acting as an edit server (1) And how the emacs
manual propose to us to elevate it into a user service?

----------------------------------------------------------------------------------
| If your operating system uses systemd to manage startup, you can automatically |
| start Emacs in daemon mode when you login using the supplied systemd unit file.|
| To activate this:                                                              |
|  systemctl --user enable emacs                                                 |

----------------------------------------------------------------------------------

So how Systemd lured the proud gnu ? I think :
1. it can keep emacs server alive even if accidentaly or by error fails.
So that is a form of supervision. And i thing the 'accidental' case
seems adequate .
2 it offers systemd sockets units for activation . Emacs at installation can register
a socket .I wonder how it is related to d-bus autostart service. But i think that means that
i could execute an edit command on an email client and the server would start.
3. it offers log service
$ journalctl --user -u emacs.service
4. it has basic command for managing and checking status.
$ systemctl status --user emacs


Using thus .bashrc or a desktop session manager would not offers us those
facilities.

A natural question : Why only emacs? Why not other apps ? Keep that question
in your mind because i think pinponts and underlines a different kind of supervisor
that can be used in many user desktop apps.

And can we say that the use of the word server or daemon for emacs is just ?
It wants to run all the time or it wants to be available
all the time without loosing its state?

So maybe emacs does not qualifies as a user daemon but as a user facility
that we want it constant accessible with its state. It could be even out of
main memory when not needed .Also emacs is not critical
for the system or even the desktop but it is critical for a user's job or workflow.
So i think we need a new word here. eg : FlowNucleus . Pieces of a user workflow accessible
with their state during the whole user session. So flownucleus supervision
could be seen a kind of daemon supervision with diferent constraints possible
of more dynamic nature and more complex!.

That sounds better. $ sv start emacs-flownucleus

Anyway i decided to try emacs daemon and althought i found related attempts
at the web (2)(3)(4)(5) my first attempt (6) to use runit to control emacs
as a service (flownucleus) hit on the difficulty of stoping it when i log out. (7)
I have managed to run it from root runit but that breaks the semantics
of a user flownucleus management shared by root and the user.

As Lorenzo pointed (7) runit could supervise the start-stop stages of a
flownucleus or a classic daemon but it need some glue code or a glue
runit - login component . Also he added some interesting remarks in this
thread regarding the pros and cons of handling user daemons by chpst or
user specific supervisors. And Aitor has mentioned of a s6 based user
init-supervision (8) but for the time i try the runit so i can make any
comment on it.

So i think that sums up the points so far that i felt they had to be put
together to help me see a broader and less foggy picture.

Thanks to everyone.

Alexandros.


--------------------------- (My)setup ----------------------------------
I use Devuan + ligthweight desktops and currently sway. I guess as
i ensconsed myself to Devuan five years now to avoid systemd i think
also i avoided full featured desktops for generally the same reasons.
Those systems offer close integration as a feature but the are weakening
aspects of a computer system that (as Tito put it) allows human supervisors
(admins :-) ) to slow the the inevitable increase of chaos.
Now i cant help it to highlight that wayland compositors also follows the integration
trend in the display server space deavouring window managers! . and that
i plan to turn to X now that redhad seems to dumping it. I guess IT people
are less friendly to each other now days.. )
(a pause here ... to reflect upon what we mean
by integration and why some of us dont like that architectural approach)

--------------------------- (R)efs ------------------------------------

(1) https://www.gnu.org/software/emacs/manual/html_node/emacs/Emacs-Server.html
(2) Emacs daemon as a runit servicehttps  Hristos N Triantafilou https://hristos.lol/blog/emacs-daemon-runit-service/        (09/06/2018)
(3) Emacs daemon as a runit "user service" Hristos N Triantafilou https://hristos.lol/blog/emacs-daemon-runit-user-service/ (30/07/2020)
(4) Running Emacs with systemd  Bozhidar Batsov https://emacsredux.com/blog/2020/07/16/running-emacs-with-systemd/ (16/07/2020)
(5) Unlock the Power of the Daemon with emacsclient    https://systemcrafters.net/emacs-tips/using-the-emacs-daemon/
(6) Devuan Forum  Other Issues» runit services : Trying to create an emacs service   https://dev1galaxy.org/viewtopic.php?pid=45961#p45961 (29/11/2023)
(7) dng@???  Subject: [DNG] (runit)  Can emacs daemon become a user service ? (6/12/2023)
(8) Local User Services on s6/s6-rc on his www.gnuinos.org  :  https://wiki.artixlinux.org/Main/LocalUserServicesOns6
-------------------------------------------------------------------------


ps: Indeed a webserver services and users that dont have to login in the system.
    But in my framing of what sounds to me a solid mulciuser architecture the
    job of the sysadm with root privilages shouldnt be offer the service it self
    but the abstraction and manage the related resources.  
    Like the kernel offer fs but not files that belong to the users.
    I am not sure that this setup is trivial to set up. I guess it can  
    be done but as an afterthought of a default setup of a root controlled
    web server.