Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 479492 - net-fs/autofs - add systemd unit
Summary: net-fs/autofs - add systemd unit
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Yixun Lan
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: install-systemd-unit
  Show dependency tree
 
Reported: 2013-08-02 11:00 UTC by Charles Nérot
Modified: 2013-08-22 07:18 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
autofs.service (autofs.service,183 bytes, text/plain)
2013-08-02 15:05 UTC, Charles Nérot
Details
add systemd support (autofs-5.0.7-r4.ebuild.patch,1.33 KB, patch)
2013-08-03 18:03 UTC, Yixun Lan
Details | Diff
ebuild diff agaist 5.0.7-r3 (autofs-5.0.7-r4.v2.ebuild.patch,1.74 KB, patch)
2013-08-03 23:45 UTC, Yixun Lan
Details | Diff
ebuild diff v3 against 5.0.7-r3 (autofs-5.0.7-r4.ebuild.v3.patch,1.76 KB, patch)
2013-08-05 02:10 UTC, Yixun Lan
Details | Diff
ebuild diff agaist 5.0.7-r3 (v4) (autofs-5.0.7-r3.ebuild.v4.patch,963 bytes, patch)
2013-08-06 15:26 UTC, Yixun Lan
Details | Diff
ebuild diff agaist 5.0.7-r3 (v5) (autofs-fix.patch,1.04 KB, patch)
2013-08-22 06:38 UTC, Yixun Lan
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Charles Nérot 2013-08-02 11:00:46 UTC
net-fs/autofs should provide systemd unit file.

Reproducible: Always
Comment 1 Pacho Ramos gentoo-dev 2013-08-02 14:47:13 UTC
If you are able to prepare one, that will make things go faster for sure
Comment 2 Charles Nérot 2013-08-02 15:05:58 UTC
Created attachment 354930 [details]
autofs.service

"Work's for me"
It's my first unit file so it need a review.
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-08-02 15:08:22 UTC
Err, what's the point of using autofs in the first place? systemd has built-in automounts support...
Comment 4 Yixun Lan archtester gentoo-dev 2013-08-02 21:02:20 UTC
hi charles, I'm already aware that upstream support systemd. I haven't added it because I don't use systemd and can't test. so, I'm really need helps here.

hi @mgorny, what's your suggestion here? do you mean it's not necessary to add systemd support into autofs? or can we make them exist mutual exclusive? like you add some flag(automount?) into systemd, so autofs can add something like "system? ( sys-apps/systemd[-automount] )" into RDPEND?
Comment 5 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-08-02 21:11:13 UTC
I was just curious if this isn't one of the cases where people install random packages when everything they need is around already.
Comment 6 Yixun Lan archtester gentoo-dev 2013-08-03 18:03:28 UTC
Created attachment 355040 [details, diff]
add systemd support

hi @charles, could you test is this works for you?
Comment 7 Yixun Lan archtester gentoo-dev 2013-08-03 23:45:19 UTC
Created attachment 355076 [details, diff]
ebuild diff agaist 5.0.7-r3

1) update RDEPEND, at least make it depend on RDEPEND (is this necessary?)
2) make systemddir controlled by IUSE=systemd
3) revision bump, update to 5.0.7-r4? (IUSE changes, necessary?)
Comment 8 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-08-04 07:37:32 UTC
You are not allowed to use USE=systemd to control unit files. You install them unconditionally.
Comment 9 Sergey Popov gentoo-dev 2013-08-04 11:42:55 UTC
Bug can not be marked RESOLVED TEST-REQUEST before changes will hit portage tree. Reopening...
Comment 10 Yixun Lan archtester gentoo-dev 2013-08-05 02:10:09 UTC
Created attachment 355138 [details, diff]
ebuild diff v3 against 5.0.7-r3

this should address @mgorny's concern. install unit files unconditionally
Comment 11 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-08-05 07:35:33 UTC
It's still conditional. Looking at the sources, upstream uses --with-systemd purely to control unit file install. You should pass --with-systemd, and no RDEPEND on systemd.

Also, please suggest upstream to use --with-systemdsystemunitdir like other packages do. Uniformity is a good thing, and the same switch can be used both to provide the directory and control installing unit files.

If they want, I have a pretty nice snippet in [1]. If they don't want the whole file, earlier versions [2] do not use the generic macro and therefore are more specialized.

[1]:https://bitbucket.org/mgorny/systemd-sdk/src/master/m4/systemd.m4
[2]:https://bitbucket.org/mgorny/systemd-sdk/src/6e32c48490/m4/systemd.m4
Comment 12 Charles Nérot 2013-08-05 14:10:49 UTC
(In reply to Dennis 'dlan' Lan from comment #10)
> Created attachment 355138 [details, diff] [details, diff]
> ebuild diff v3 against 5.0.7-r3
> 
> this should address @mgorny's concern. install unit files unconditionally

This ebuild work's for me on start and stop usage.
The reload usage work but raise error due to return of kill :

# systemctl reload autofs
Job for autofs.service failed. See 'systemctl status autofs.service' and 'journalctl -xn' for details.
# systemctl status autofs
autofs.service - Automounts filesystems on demand
   Loaded: loaded (/usr/lib64/systemd/system/autofs.service; enabled)
   Active: active (running) (Result: exit-code) since lun. 2013-08-05 15:56:03 CEST; 1min 22s ago
  Process: 4284 ExecReload=/usr/bin/kill -HUP $MAINPID (code=exited, status=203/EXEC)
  Process: 4247 ExecStart=/usr/sbin/automount $OPTIONS --pid-file /run/autofs.pid (code=exited, status=0/SUCCESS)
 Main PID: 4249 (automount)
   CGroup: /system.slice/autofs.service
           └─4249 /usr/sbin/automount --pid-file /run/autofs.pid

août 05 15:56:38 polochon systemd[1]: Forked /usr/bin/kill as 4279
août 05 15:56:38 polochon systemd[1]: autofs.service changed running -> reload
août 05 15:57:18 polochon systemd[1]: Trying to enqueue job autofs.service/reload/replace
août 05 15:57:18 polochon systemd[1]: Installed new job autofs.service/reload as 1415
août 05 15:57:18 polochon systemd[1]: Enqueued job autofs.service/reload as 1415
août 05 15:57:18 polochon systemd[1]: Reloading Automounts filesystems on demand.
août 05 15:57:18 polochon systemd[1]: About to execute: /usr/bin/kill -HUP $MAINPID
août 05 15:57:18 polochon systemd[1]: Forked /usr/bin/kill as 4284
août 05 15:57:18 polochon systemd[1]: autofs.service changed running -> reload
août 05 15:57:18 polochon systemd[1]: autofs.service changed reload -> running

I think it's an upstream bug, isn't it ?

Hi @Michał. 
I use autofs to mount nfs remote directory automaticaly based on hostname and directory name. Ex : ls /net/192.168.1.50/volume1/data => automount nfs. Can Systemd do that ?
I have autofs already functional with OpenRC. I move to systemd for Gnome. So I have not "install random packages" but try to get already installed/tuned program to work.
Comment 13 Yixun Lan archtester gentoo-dev 2013-08-06 03:25:24 UTC
(In reply to Michał Górny from comment #11)
> It's still conditional. Looking at the sources, upstream uses --with-systemd
> purely to control unit file install. You should pass --with-systemd, and no
> RDEPEND on systemd.
> 
what do you mean here about "conditional"? it sounds weird to me that we install unit file without systemd support.

I could come up with two options "--with-systemd" and "--with-systemdsystemunitdir", they have no interactions with each other. that mean "--with-systemdsystemunitdir" can be enabled without systemd support (without --with-systemd=yes"). so, unit files will be always installed with/without systemd enabled. is this ok?

> Also, please suggest upstream to use --with-systemdsystemunitdir like other
> packages do. Uniformity is a good thing, and the same switch can be used
> both to provide the directory and control installing unit files.
> 
> If they want, I have a pretty nice snippet in [1]. If they don't want the
> whole file, earlier versions [2] do not use the generic macro and therefore
> are more specialized.
> 
> [1]:https://bitbucket.org/mgorny/systemd-sdk/src/master/m4/systemd.m4
> [2]:https://bitbucket.org/mgorny/systemd-sdk/src/6e32c48490/m4/systemd.m4

I will ping upstream, but I'd like to keep the changes minimal. Your proposal require pkg-config, Makefile.am(automake) support. the file of sample/Makefile is still hand coded. this may require too many changes. I'm not sure whether I can convince upstream developer.
Comment 14 Yixun Lan archtester gentoo-dev 2013-08-06 15:26:42 UTC
Created attachment 355248 [details, diff]
ebuild diff agaist 5.0.7-r3 (v4)

final version.

I plan to cook a patch to suggest upstream add a option "--with-systemdsystemunitdir", but I do not want to introduce it into 5.0.7-r3. becasue it do not affect the installed files(exactly the same).
Comment 15 Yixun Lan archtester gentoo-dev 2013-08-20 08:08:26 UTC
upstream discussion for adding a --with-systemdsystemunitdir option

[1] http://thread.gmane.org/gmane.linux.kernel.autofs/6703
[2] http://article.gmane.org/gmane.linux.kernel.autofs/6702
[3] http://article.gmane.org/gmane.linux.kernel.autofs/6704
Comment 16 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-08-20 08:19:31 UTC
If you could proxy our answer, I'd appreciate it. --with-systemdsystemunitdir (however horrible that is to spell) is upstream's option name. It's covered in the manual [1].

Programs that use that include syslog-ng, gdm, libcanberra, alsa-utils, mpd, NetworkManager, polkit, colord, ...

[1]:http://0pointer.de/public/systemd-man/daemon.html
Comment 17 Yixun Lan archtester gentoo-dev 2013-08-20 09:56:42 UTC
(In reply to Michał Górny from comment #16)

ok, I will forward this..

and I'm still puzzled about why you advocate installing systemd unit file unconditionally?
from the link you give, I got this, so that mean unit file will be installed when systemd support is enabled? (on condition systemd support is enabled.)

if HAVE_SYSTEMD
systemdsystemunit_DATA = \
        foobar.socket \
        foobar.service
endif
Comment 18 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-08-20 10:00:51 UTC
Yes. However, in Gentoo we have a policy of installing them unconditionally to avoid rebuilding a number of packages when switching between OpenRC and systemd.
Comment 19 Yixun Lan archtester gentoo-dev 2013-08-20 13:33:04 UTC
(In reply to Charles Nérot from comment #12)
> (In reply to Dennis 'dlan' Lan from comment #10)
> > Created attachment 355138 [details, diff] [details, diff] [details, diff]
> > ebuild diff v3 against 5.0.7-r3
> > 
> > this should address @mgorny's concern. install unit files unconditionally
> 
> This ebuild work's for me on start and stop usage.
> The reload usage work but raise error due to return of kill :
> 
> # systemctl reload autofs
> Job for autofs.service failed. See 'systemctl status autofs.service' and
> 'journalctl -xn' for details.
> # systemctl status autofs
> autofs.service - Automounts filesystems on demand
>    Loaded: loaded (/usr/lib64/systemd/system/autofs.service; enabled)
>    Active: active (running) (Result: exit-code) since lun. 2013-08-05
> 15:56:03 CEST; 1min 22s ago
>   Process: 4284 ExecReload=/usr/bin/kill -HUP $MAINPID (code=exited,
> status=203/EXEC)
>   Process: 4247 ExecStart=/usr/sbin/automount $OPTIONS --pid-file
> /run/autofs.pid (code=exited, status=0/SUCCESS)
>  Main PID: 4249 (automount)
>    CGroup: /system.slice/autofs.service
>            └─4249 /usr/sbin/automount --pid-file /run/autofs.pid
> 
> août 05 15:56:38 polochon systemd[1]: Forked /usr/bin/kill as 4279
> août 05 15:56:38 polochon systemd[1]: autofs.service changed running ->
> reload
> août 05 15:57:18 polochon systemd[1]: Trying to enqueue job
> autofs.service/reload/replace
> août 05 15:57:18 polochon systemd[1]: Installed new job
> autofs.service/reload as 1415
> août 05 15:57:18 polochon systemd[1]: Enqueued job autofs.service/reload as
> 1415
> août 05 15:57:18 polochon systemd[1]: Reloading Automounts filesystems on
> demand.
> août 05 15:57:18 polochon systemd[1]: About to execute: /usr/bin/kill -HUP
> $MAINPID
> août 05 15:57:18 polochon systemd[1]: Forked /usr/bin/kill as 4284
> août 05 15:57:18 polochon systemd[1]: autofs.service changed running ->
> reload
> août 05 15:57:18 polochon systemd[1]: autofs.service changed reload ->
> running
> 
> I think it's an upstream bug, isn't it ?
> 
> Hi @Michał. 
> I use autofs to mount nfs remote directory automaticaly based on hostname
> and directory name. Ex : ls /net/192.168.1.50/volume1/data => automount nfs.
> Can Systemd do that ?
> I have autofs already functional with OpenRC. I move to systemd for Gnome.
> So I have not "install random packages" but try to get already
> installed/tuned program to work.

Hi @charles, do you have any updates about the reload operation?
shouldn't the reload operation equal to "stop + start"? can you make sure the running process is killed first, then start later? it seems the killed process(4284) is behind the start process(4247)? (PID bigger)

I may try to setup a systemd environment, but this may takes a few time...
or, could you report to upstream if you still think it's upstream problem?
Comment 20 Yixun Lan archtester gentoo-dev 2013-08-22 06:38:15 UTC
Created attachment 356662 [details, diff]
ebuild diff agaist 5.0.7-r3 (v5)

changing from /usr/bin/kill -> /bin/kill, this also fix systemd reload bug.
Comment 21 Sergey Popov gentoo-dev 2013-08-22 06:52:23 UTC
+  22 Aug 2013; Sergey Popov <pinkbyte@gentoo.org> -autofs-5.0.7-r3.ebuild,
+  +autofs-5.0.7-r4.ebuild:
+  Revision bump: add systemd support, wrt bug #479492. Thanks to Charles Nérot
+  <charles AT nerot.com> for discovering this issue and Dennis Lan <dennis.yxun
+  AT gmail.com> for all necessary fixes. Drop old revision
Comment 22 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-08-22 07:18:35 UTC
(In reply to Dennis 'dlan' Lan from comment #20)
> Created attachment 356662 [details, diff] [details, diff]
> ebuild diff agaist 5.0.7-r3 (v5)
> 
> changing from /usr/bin/kill -> /bin/kill, this also fix systemd reload bug.

Just for record, if you want to be super-safe, you can use '/usr/bin/env kill' but I doubt it will be ever necessary.