* make install does not setup systemd correctly
@ 2018-07-15 10:58 Bingo
2018-07-16 0:40 ` Noam Postavsky
0 siblings, 1 reply; 4+ messages in thread
From: Bingo @ 2018-07-15 10:58 UTC (permalink / raw
To: help-gnu-emacs
Hi,
On my Fedora installation, emacs 25.3 was already installed
in /usr/bin. In another
location (~/Downloads/emacs26/install/bin/emacs) , I installed emacs
27.0 from source using ./configure, make and make install. $PATH
contains ~/Downloads/emacs26/install/ before /usr/bin.
In this state, running "emacs --daemon" creates a emacs process, using
the binary from ~/Downloads/emacs26/install as a subprocess of systemd.
But the systemd configuration still uses the configuration info
from /lib/systemd/user/emacs.service, which is from the pre-installed
emacs 25.3. Any systemd operations end up using the binary
from /usr/bin. This is confirmed using
=================================
systemctl --user status emacs.service
emacs.service - Emacs text editor
Loaded: loaded (/usr/bin/emacs;
disabled; vendor preset: enabled)
=================================
I was experiencing emacsclient hanging sometimes. I have not
sufficiently debugged that yet, but it seems wrong to use /usr/bin
binaries of 25.3 to handle emacs daemon process of 27.0
Effectively, I have 2 questions / problems :
1. Emacs man page, or --help does not give an obvious way to not use
systemd for its daemon. Is it supported at all ?
2. If we are not making it easy to avoid systemd, let us configure it
while installing? Emacswiki says that we need to copy the included
emacs.service file to ~/.config/systemd/user/emacs.service. It seems to
help - my emacsclient has not been hanging since then. But couldn't
make install have copied this file by default ? Or used emacs.service
file from the correct place when a binary from this emacs 27.0
installation is being run as daemon ?
thanks
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: make install does not setup systemd correctly
2018-07-15 10:58 make install does not setup systemd correctly Bingo
@ 2018-07-16 0:40 ` Noam Postavsky
2018-07-16 14:33 ` Bingo
0 siblings, 1 reply; 4+ messages in thread
From: Noam Postavsky @ 2018-07-16 0:40 UTC (permalink / raw
To: Bingo; +Cc: Help Gnu Emacs mailing list
On 15 July 2018 at 06:58, Bingo <right.ho@gmail.com> wrote:
> Hi,
> On my Fedora installation, emacs 25.3 was already installed
> in /usr/bin. In another
> location (~/Downloads/emacs26/install/bin/emacs) , I installed emacs
> 27.0 from source using ./configure, make and make install. $PATH
> contains ~/Downloads/emacs26/install/ before /usr/bin.
>
> In this state, running "emacs --daemon" creates a emacs process, using
> the binary from ~/Downloads/emacs26/install as a subprocess of systemd.
As far as I understand it, when you are running systemd, every process
is a subprocess of systemd, because it's the init process, so it's at
the root of the process tree.
> But the systemd configuration still uses the configuration info
> from /lib/systemd/user/emacs.service, which is from the pre-installed
> emacs 25.3. Any systemd operations end up using the binary
> from /usr/bin.
Maybe because it doesn't use your $PATH configuration? The
emacs.service file doesn't seem to have anything version specific in
it.
> 1. Emacs man page, or --help does not give an obvious way to not use
> systemd for its daemon. Is it supported at all ?
I guess just don't use any "systemd operations"?
Currently Emacs doesn't use systemd at all, except that it takes
sockets passed by systemd and makes them available to the
`:use-external-socket' option of `make-network-process'.
> 2. If we are not making it easy to avoid systemd, let us configure it
> while installing? Emacswiki says that we need to copy the included
> emacs.service file to ~/.config/systemd/user/emacs.service. It seems to
> help - my emacsclient has not been hanging since then. But couldn't
> make install have copied this file by default ? Or used emacs.service
> file from the correct place when a binary from this emacs 27.0
> installation is being run as daemon ?
According to this comment in Makefile.in, it's not entirely clear
where the service file should get installed.
# Where the etc/emacs.service file is to be installed.
# The system value (typically /usr/lib/systemd/user) can be
# obtained with: pkg-config --variable=systemduserunitdir systemd
# but that does not respect configure's prefix.
# It is not clear where we should install this file when
# prefix != /usr (or /usr/local?) (eg for non-root installs).
# Other options include ~/.config/systemd/user/,
# $XDG_RUNTIME_DIR/systemd/user/
# It seems the user may end up having to make a manual link...
systemdunitdir=$(libdir)/systemd/user
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: make install does not setup systemd correctly
2018-07-16 0:40 ` Noam Postavsky
@ 2018-07-16 14:33 ` Bingo
2018-07-16 15:31 ` Noam Postavsky
0 siblings, 1 reply; 4+ messages in thread
From: Bingo @ 2018-07-16 14:33 UTC (permalink / raw
To: Help Gnu Emacs mailing list
Thanks Noam. See replies inline
On Sun, 15 Jul 2018 20:40:21 -0400
Noam Postavsky <npostavs@gmail.com> wrote:
> On 15 July 2018 at 06:58, Bingo <right.ho@gmail.com> wrote:
> > Hi,
> > On my Fedora installation, emacs 25.3 was already installed
> > in /usr/bin. In another
> > location (~/Downloads/emacs26/install/bin/emacs) , I installed
> > emacs 27.0 from source using ./configure, make and make install.
> > $PATH contains ~/Downloads/emacs26/install/ before /usr/bin.
> >
> > In this state, running "emacs --daemon" creates a emacs process,
> > using the binary from ~/Downloads/emacs26/install as a subprocess
> > of systemd.
>
> As far as I understand it, when you are running systemd, every process
> is a subprocess of systemd, because it's the init process, so it's at
> the root of the process tree.
In my case, it is not exactly so. There is another, non-init, non PID
1 process of systemd , with PID 4142 in this case, under which these
emacs daemons reside. To illustrate :
bingo 4142 1 0 juil.15 ? 00:00:00 /usr/lib/systemd/systemd
--user
bingo 9976 4142 0 juil.15 ?
00:00:10 /home/bingo/Downloads/emacs26/install/bin/emacs --daemon
>
> > But the systemd configuration still uses the configuration info
> > from /lib/systemd/user/emacs.service, which is from the
> > pre-installed emacs 25.3. Any systemd operations end up using the
> > binary from /usr/bin.
>
> Maybe because it doesn't use your $PATH configuration? The
> emacs.service file doesn't seem to have anything version specific in
> it.
I had checked the symlink /proc/9976/exe : it does point the way I
expect from $PATH i.e. /home/bingo/Downloads/emacs26/install/bin/emacs.
The emacs.service has an extremely version specific thing in it :
"ExecStart=/usr/bin/emacs --daemon". This is an emacs binary which is
25.3 - but probably it could have been any version.
>
> > 1. Emacs man page, or --help does not give an obvious way to not use
> > systemd for its daemon. Is it supported at all ?
>
> I guess just don't use any "systemd operations"?
The configuration that ships with emacs has, e.g.,
Restart=on-failure
ExecStart=/usr/bin/emacs --daemon
I am guessing that emacs is coming under the "on-failure" condition
somehow. So the "systemd operations" are not being used intentionally.
Since I am not sure what could have caused on-failure, so I am not
asking about that problem here. But only with an improvement to the
emacs installation process in mind, I am asking these questions.
>
> Currently Emacs doesn't use systemd at all, except that it takes
> sockets passed by systemd and makes them available to the
> `:use-external-socket' option of `make-network-process'.
Specifically becoming a subprocess of a particular systemd process
seems to be more than taking sockets - but maybe there are some terms
here that I don't fully understand.
>
> > 2. If we are not making it easy to avoid systemd, let us configure
> > it while installing? Emacswiki says that we need to copy the
> > included emacs.service file to
> > ~/.config/systemd/user/emacs.service. It seems to help - my
> > emacsclient has not been hanging since then. But couldn't make
> > install have copied this file by default ? Or used emacs.service
> > file from the correct place when a binary from this emacs 27.0
> > installation is being run as daemon ?
>
> According to this comment in Makefile.in, it's not entirely clear
> where the service file should get installed.
>
> # Where the etc/emacs.service file is to be installed.
> # The system value (typically /usr/lib/systemd/user) can be
> # obtained with: pkg-config --variable=systemduserunitdir systemd
> # but that does not respect configure's prefix.
> # It is not clear where we should install this file when
> # prefix != /usr (or /usr/local?) (eg for non-root installs).
> # Other options include ~/.config/systemd/user/,
> # $XDG_RUNTIME_DIR/systemd/user/
> # It seems the user may end up having to make a manual link...
> systemdunitdir=$(libdir)/systemd/user
Ok, so it looks like ~/.config/systemd/user was considered. I agree that
it may not be ideal. I am not sure if systemd makes it possible to use
$PREFIXDIR/lib/systemd/user/emacs.service .
thanks
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: make install does not setup systemd correctly
2018-07-16 14:33 ` Bingo
@ 2018-07-16 15:31 ` Noam Postavsky
0 siblings, 0 replies; 4+ messages in thread
From: Noam Postavsky @ 2018-07-16 15:31 UTC (permalink / raw
To: Bingo; +Cc: Help Gnu Emacs mailing list
On 16 July 2018 at 10:33, Bingo <right.ho@gmail.com> wrote:
>> > On my Fedora installation, emacs 25.3 was already installed
>> > in /usr/bin. In another
>> > location (~/Downloads/emacs26/install/bin/emacs) , I installed
>> > emacs 27.0 from source using ./configure, make and make install.
>> > $PATH contains ~/Downloads/emacs26/install/ before /usr/bin.
>> >
>> > In this state, running "emacs --daemon" creates a emacs process,
>> > using the binary from ~/Downloads/emacs26/install as a subprocess
>> > of systemd.
>>
>> As far as I understand it, when you are running systemd, every process
>> is a subprocess of systemd, because it's the init process, so it's at
>> the root of the process tree.
>
> In my case, it is not exactly so. There is another, non-init, non PID
> 1 process of systemd , with PID 4142 in this case, under which these
> emacs daemons reside. To illustrate :
>
> bingo 4142 1 0 juil.15 ? 00:00:00 /usr/lib/systemd/systemd
> --user
>
> bingo 9976 4142 0 juil.15 ?
> 00:00:10 /home/bingo/Downloads/emacs26/install/bin/emacs --daemon
Ah, my guess this is due to the 'systemd --user' process setting
itself as a subreaper for any daemons you start (i.e., this is not an
Emacs-specific thing).
https://unix.stackexchange.com/questions/250153/what-is-a-subreaper-process
> I had checked the symlink /proc/9976/exe : it does point the way I
> expect from $PATH i.e. /home/bingo/Downloads/emacs26/install/bin/emacs.
>
> The emacs.service has an extremely version specific thing in it :
> "ExecStart=/usr/bin/emacs --daemon". This is an emacs binary which is
> 25.3 - but probably it could have been any version.
Oh, I was looking at the file in the repo, which just says
"ExecStart=emacs --daemon", but now I see that the install script adds
the absolute filename.
By the way, it was only added in 26.1, so I guess whoever packaged it
for Fedora backported it to your 25.3 package.
>> > 1. Emacs man page, or --help does not give an obvious way to not use
>> > systemd for its daemon. Is it supported at all ?
>>
>> I guess just don't use any "systemd operations"?
>
> The configuration that ships with emacs has, e.g.,
> Restart=on-failure
> ExecStart=/usr/bin/emacs --daemon
>
> I am guessing that emacs is coming under the "on-failure" condition
> somehow.
Not sure, do you actually see "/usr/bin/emacs --daemon" getting run?
In the status output you posted in the OP, I see it says "disabled".
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-07-16 15:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-15 10:58 make install does not setup systemd correctly Bingo
2018-07-16 0:40 ` Noam Postavsky
2018-07-16 14:33 ` Bingo
2018-07-16 15:31 ` Noam Postavsky
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.