You are not logged in.

#1 2017-09-30 15:48:34

grindv1k
Member
Registered: 2015-11-15
Posts: 21

Emacs as a systemd unit, very slow and blocks login?

Hi, according to the wiki I am starting emacs as a systemd unit:


https://wiki.archlinux.org/index.php/em … stemd_unit

However it takes a while to start this up, so when I boot my computer and enter my username+password I have to wait ~10s until I actually finish booting.

Anyone out there know how to fix? Can one make it so it starts in the background instead?

Offline

#2 2017-10-04 23:56:14

holytrousers
Member
From: 3rd Rock from the Sun
Registered: 2007-10-19
Posts: 75

Re: Emacs as a systemd unit, very slow and blocks login?

Hi grindv1k

I am having a similar problem with mpd.service
When i log in, i have to wait several seconds before i get to the prompt.

I checked the Unit in /usr/lib/systemd/user/mpd.service and found out that Type is set to notify (in your case it's forking) , which forces systemd to wait until the application finishes starting and notifies about it.
I changed it to idle and that solved the problem; mpd starts in the background and starts playing after a while which is quite nice (works the same with Type=simple) so i get my prompt instantly !

However, when i mentioned it in mpd@github , the maintainer answered that this solution was a mere side effect of type=idle and it shouldn't be solved that way because systemd wont be able to properly know if the daemon has successfully started or not.

I haven't found any clue so far on how to achieve this by tweaking systemd.
What i understood is that enabling a service means requiring it in a target, in this case default.target.
systemctl --user enable "service_name.service" adds symlinks in ~/.config/systemd/default.target.wants/ to your service file (either located in /usr/lib/systemd/user/ or /etc/systemd/user/)

The problem is that default.target is at the top of the chain; to get the prompt you have to go through everything it wants : you have to wait until the service is loaded
so it seems to me that the only way to load a service (not of type : idle) would be to link it to a target which is loaded after default.target.
maybe by setting a timer ?
i am really stuck in understanding how this works big_smile

Last edited by holytrousers (2017-10-05 00:06:20)

Offline

#3 2017-10-05 02:06:25

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,703

Re: Emacs as a systemd unit, very slow and blocks login?

Yeah, I fought with that quite a bit.  The only thing I found was to pare down the configuration. A lot.

Now I've it set up so it starts the server when I open my first client.  I do that by creating two bash scripts; one called 'e' which starts a GUI client, and one called 'et' which starts a terminal client.

The contents are as follows

e:

emacsclient --alternate-editor='' -nc $1

et:

emacsclient --alternate-editor='' -ct $1

Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

Board footer

Powered by FluxBB