Re: [systemd-devel] How to mount NFS prior to start postgresql from this volume

2016-07-02 Thread Michael Biebl
2016-07-02 2:44 GMT+02:00 Lennart Poettering :
> On Fri, 01.07.16 14:44, wolfgang.wag...@riwa-gis.de 
> (wolfgang.wag...@riwa-gis.de) wrote:
>
>> My postgresql.service is this:  (unmodified file)
>> [Unit]
>> Description=PostgreSQL RDBMS
>>
>> [Service]
>> Type=oneshot
>> ExecStart=/bin/true
>> ExecReload=/bin/true
>> RemainAfterExit=on
>>
>> [Install]
>> WantedBy=multi-user.target
>
> Hmm, not sure how postgresql is setup on your distro, but the above
> unit file is pretty much a nop. How does your postgresql@.service
> template unit file look like though?

I guess all the postgresql@.service files declare a
PartOf=postgres.service and have [Install]WantedBy=postgres.service.

This way systemctl start/stop/restart/reload postgresql.service will
forward that to all instances.
A target would probably be more suited for that, but targets currently
have limitations (e.g. regarding forwarding reload) so this doesn't
work and one has to misuse such a nop service.

Regards,
Michael


-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] How to mount NFS prior to start postgresql from this volume

2016-07-01 Thread Lennart Poettering
On Fri, 01.07.16 17:59, Simon McVittie (simon.mcvit...@collabora.co.uk) wrote:

> This is fixed in testing (stretch); a backport of the version from
> stretch, or introducing native systemd services locally, would probably
> help. See  for
> more on this general topic. rpcbind's Debian maintainer does not appear
> to be working on it any more, so I suspect it might be in danger of not
> releasing with Debian 9; if NFS is important to you, you might want to
> look into taking over its maintenance.
> 
> I think vmware-tools might be in a similar situation: relatively early
> boot, but only a LSB init script, not a native systemd service.

Note that systemd upstream does not support early-boot SysV services,
because it's necessarily problematic.

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] How to mount NFS prior to start postgresql from this volume

2016-07-01 Thread Lennart Poettering
On Fri, 01.07.16 14:44, wolfgang.wag...@riwa-gis.de 
(wolfgang.wag...@riwa-gis.de) wrote:

> My postgresql.service is this:  (unmodified file)
> [Unit]
> Description=PostgreSQL RDBMS
> 
> [Service]
> Type=oneshot
> ExecStart=/bin/true
> ExecReload=/bin/true
> RemainAfterExit=on
> 
> [Install]
> WantedBy=multi-user.target

Hmm, not sure how postgresql is setup on your distro, but the above
unit file is pretty much a nop. How does your postgresql@.service
template unit file look like though?

Normally, if you want a service to run only after all NFS mounts are
in place, add an ordering dependency towards remote-fs.target to
it. Specifically: add a drop-in file
/etc/systemd/system/postgresql@.service.d/50-nfs.conf and write into
it:


[Unit]
After=remote-fs.target


> Maybe it is caused by this  (ssome lines before in journalctl-log):
> Jul 01 16:09:57 postgis1 systemd[1]: Cannot add dependency job for unit 
> display-manager.service, ignoring: Unit display-manager.service f
> Jul 01 16:09:57 postgis1 systemd[1]: Found ordering cycle on 
> basic.target/start
> Jul 01 16:09:57 postgis1 systemd[1]: Found dependency on sysinit.target/start
> Jul 01 16:09:57 postgis1 systemd[1]: Found dependency on rpcbind.service/start
> Jul 01 16:09:57 postgis1 systemd[1]: Found dependency on 
> network-online.target/start
> Jul 01 16:09:57 postgis1 systemd[1]: Found dependency on 
> vmware-tools.service/start
> Jul 01 16:09:57 postgis1 systemd[1]: Found dependency on basic.target/start
> Jul 01 16:09:57 postgis1 systemd[1]: Breaking ordering cycle by deleting job 
> rpcbind.service/start
> Jul 01 16:09:57 postgis1 systemd[1]: Job rpcbind.service/start deleted to 
> break ordering cycle starting with basic.target/start

So, there's an ordering cycle: basic.target → sysinit.target →
rpcbind.service → network-line.target → vmware-tools.service →
basic.target. Reach each arror in this as "After=" ordering.

This suggests some borkage probably either in vmware-tools.service or
in rpcbind.service. Not sure why the latter wants to be ordered until
after the network is fully up, and not sure why the former wants to be
ordered before that... The key of the issue though is that
vmware-tools is declared a late-boot service (since it wants to be
ordered after basic.target) while rpcbind.service is declared an early
boot service (since it wants to be ordered before basic.target), but
of course that cannot be fulfilled, given both their request for
ordering towards network-online.target.

Consider asking your distro for help, or vmware. This is really
borkage in those unit files. Most likely rpcbind is most broken
service in this regard.

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] How to mount NFS prior to start postgresql from this volume

2016-07-01 Thread Simon McVittie
On 01/07/16 15:44, wolfgang.wag...@riwa-gis.de wrote:
> Maybe it is caused by this  (ssome lines before in journalctl-log):

I don't know whether it's causal, but dependency loops are never good news.

> Jul 01 16:09:57 postgis1 systemd[1]: Cannot add dependency job for unit
> display-manager.service, ignoring: Unit display-manager.service f
> Jul 01 16:09:57 postgis1 systemd[1]: Found ordering cycle on
> basic.target/start
> Jul 01 16:09:57 postgis1 systemd[1]: Found dependency on
> sysinit.target/start
> Jul 01 16:09:57 postgis1 systemd[1]: Found dependency on
> rpcbind.service/start
> Jul 01 16:09:57 postgis1 systemd[1]: Found dependency on
> network-online.target/start
> Jul 01 16:09:57 postgis1 systemd[1]: Found dependency on
> vmware-tools.service/start
> Jul 01 16:09:57 postgis1 systemd[1]: Found dependency on basic.target/start
> Jul 01 16:09:57 postgis1 systemd[1]: Breaking ordering cycle by deleting
> job rpcbind.service/start
> Jul 01 16:09:57 postgis1 systemd[1]: Job rpcbind.service/start deleted
> to break ordering cycle starting with basic.target/start

I think I recognize this from when Debian switched default init system
to systemd.

Part of the problem is that rpcbind is an early-boot service (rcS,
sysinit.target) but the version in Debian 8 doesn't have a native
systemd service, only an LSB init script in /etc/init.d. systemd has a
generator that can fake a service from that script, but because it
doesn't have all the necessary information and has to make some
assumptions, it's easy for it to create a dependency loop that could
have been avoided when using native services.

This is fixed in testing (stretch); a backport of the version from
stretch, or introducing native systemd services locally, would probably
help. See  for
more on this general topic. rpcbind's Debian maintainer does not appear
to be working on it any more, so I suspect it might be in danger of not
releasing with Debian 9; if NFS is important to you, you might want to
look into taking over its maintenance.

I think vmware-tools might be in a similar situation: relatively early
boot, but only a LSB init script, not a native systemd service.

-- 
Simon McVittie
Collabora Ltd. 

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] How to mount NFS prior to start postgresql from this volume

2016-07-01 Thread Reindl Harald

please strip your quotes

Am 01.07.2016 um 17:44 schrieb killermoehre:

just drop a
---
[Unit]
ReuqiresMountsFor=/mnt/daten/postgis/9.4/main
---
into
»/etc/systemd/system/postgresql@9.4-main.service.d/wait-for-mountpoint.conf«
(create directory and file if necessary) end everything should be fine.
In your fstab also add »_netfs« and remove »noauto« for your mount
point. See »man systemd.unit« for more informations on RequireMountsFor=.


Oh, and obviously write RequiresMountsFor= in the right way and not with
reversed »q« and »u« or missing »s«.
well, after "systemctl daemon-reload" this should become obvious when 
someone takes a look at the systemlogs - sadly even distro-packagers 
don't look proper for errors like typos in their packages







signature.asc
Description: OpenPGP digital signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] How to mount NFS prior to start postgresql from this volume

2016-07-01 Thread killermoehre
Am 01.07.2016 um 17:29 schrieb killermoehre:
> Am 01.07.2016 um 16:44 schrieb wolfgang.wag...@riwa-gis.de:
>> Hello list,
>>
>>  
>>
>> after days of reading man-pages and searching the web i have no solution
>> to my problem, and I am lost in the documentation.
>>
>> My system is Debian Jessie 8.5, upgraded from wheezy 7.11. With Debian
>> wheezy all works fine, after the upgrade to jessie my postgresql-service
>> does not start on boot automatically.
>>
>> Starting manually after booting works fine, but this is not a option for
>> a database-server.
>>
>> I want do some simple thing, which worked with SysV-Init without any
>> problems:
>>
>>  
>>
>> Starting postgresql from a NFS-mount.
>>
>>  
>>
>> I am not able to achieve this. The error is always the same:
>>
>>  
>>
>> Jul 01 16:11:27 postgis1 postgresql@9.4-main[536]: Error:
>> /mnt/daten/postgis/9.4/main is not accessible or does not exist
>>
>> Jul 01 16:11:27 postgis1 systemd[1]: postgresql@9.4-main.service:
>> control process exited, code=exited status=1
>>
>> Jul 01 16:11:27 postgis1 systemd[1]: Failed to start PostgreSQL Cluster
>> 9.4-main.
>>
>> Jul 01 16:11:27 postgis1 systemd[1]: Unit postgresql@9.4-main.service
>> entered failed state.
>>
>>  
>>
>> A few lines after these log-lines i  find this:
>>
>>  
>>
>> Jul 01 16:11:28 postgis1 rpcbind[818]: Starting rpcbind daemon
>>
>> Jul 01 16:11:28 postgis1 rpc.statd[861]: Version 1.2.8 starting
>>
>> Jul 01 16:11:28 postgis1 rpc.statd[861]: Flags: TI-RPC
>>
>> Jul 01 16:11:28 postgis1 kernel: FS-Cache: Loaded
>>
>> Jul 01 16:11:28 postgis1 kernel: RPC: Registered named UNIX socket
>> transport module.
>>
>> Jul 01 16:11:28 postgis1 kernel: RPC: Registered udp transport module.
>>
>> Jul 01 16:11:28 postgis1 kernel: RPC: Registered tcp transport module.
>>
>> Jul 01 16:11:28 postgis1 kernel: RPC: Registered tcp NFSv4.1 backchannel
>> transport module.
>>
>> Jul 01 16:11:28 postgis1 kernel: FS-Cache: Netfs 'nfs' registered for
>> caching
>>
>>  
>>
>> It seems to me, that NFS-mounts were done after trying to start postgresql.
>>
>>  
>>
>> My postgresql.service is this:  (unmodified file)
>>
>> [Unit]
>>
>> Description=PostgreSQL RDBMS
>>
>>  
>>
>> [Service]
>>
>> Type=oneshot
>>
>> ExecStart=/bin/true
>>
>> ExecReload=/bin/true
>>
>> RemainAfterExit=on
>>
>>  
>>
>> [Install]
>>
>> WantedBy=multi-user.target
>>
>> ---
>>
>> Modifications in section [Unit] like :
>>
>> ConditionPathExists=/mnt/daten/postgis
>>
>>  
>>
>> Requires=mnt-daten-postgis.mount
>>
>> Before=mnt-daten-postgis.mount
>>
>> (and creating a Unit-file for the mount-point, enabling etc. instead of
>> /etc/fstab) don’t change the problem.
>>
>>  
>>
>> After booting is complete, the mount is available, but not at the time,
>> when postgresql should  be startet.
>>
>>  
>>
>> Maybe it is caused by this  (ssome lines before in journalctl-log):
>>
>> Jul 01 16:09:57 postgis1 systemd[1]: Cannot add dependency job for unit
>> display-manager.service, ignoring: Unit display-manager.service f
>>
>> Jul 01 16:09:57 postgis1 systemd[1]: Found ordering cycle on
>> basic.target/start
>>
>> Jul 01 16:09:57 postgis1 systemd[1]: Found dependency on
>> sysinit.target/start
>>
>> Jul 01 16:09:57 postgis1 systemd[1]: Found dependency on
>> rpcbind.service/start
>>
>> Jul 01 16:09:57 postgis1 systemd[1]: Found dependency on
>> network-online.target/start
>>
>> Jul 01 16:09:57 postgis1 systemd[1]: Found dependency on
>> vmware-tools.service/start
>>
>> Jul 01 16:09:57 postgis1 systemd[1]: Found dependency on basic.target/start
>>
>> Jul 01 16:09:57 postgis1 systemd[1]: Breaking ordering cycle by deleting
>> job rpcbind.service/start
>>
>> Jul 01 16:09:57 postgis1 systemd[1]: Job rpcbind.service/start deleted
>> to break ordering cycle starting with basic.target/start
>>
>>  
>>
>>  
>>
>> Where is my error?
>>
>>  
>>
>>  
>>
>> mit freundlichen Grüssen
>>
>>  
>>
>> Wolfgang Wagner
>>
>> Systemadministration
>>
>>  
>>
>> RIWA GmbH
>>
>> Gesellschaft für Geoinformationen
>>
>> Zwingerstr. 2, 87435 Kempten
>>
>> E-Mail: wolfgang.wag...@riwa-gis.de
>>
>> http://www.riwa-gis.de
>>
>>  
>>
>> --
>> RIWA GmbH, Zwingerstrasse 2, 87435 Kempten
>> Sitz der Gesellschaft: Kempten (Allgaeu)
>> Registergericht: Amtsgericht Kempten, HRB 6480
>> Geschaeftsfuehrer: Dipl.-Ing. Guenter Kraus
>> --
>>
>>
>>
>> ___
>> systemd-devel mailing list
>> systemd-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
>>
> 
> Hi,
> 
> just drop a
> ---
> [Unit]
> ReuqiresMountsFor=/mnt/daten/postgis/9.4/main
> ---
> into
> »/etc/systemd/system/postgresql@9.4-main.service.d/wait-for-mountpoint.conf«
> (create directory and file if necessary) end everything should be fine.
> In your fstab 

Re: [systemd-devel] How to mount NFS prior to start postgresql from this volume

2016-07-01 Thread killermoehre
Am 01.07.2016 um 16:44 schrieb wolfgang.wag...@riwa-gis.de:
> Hello list,
> 
>  
> 
> after days of reading man-pages and searching the web i have no solution
> to my problem, and I am lost in the documentation.
> 
> My system is Debian Jessie 8.5, upgraded from wheezy 7.11. With Debian
> wheezy all works fine, after the upgrade to jessie my postgresql-service
> does not start on boot automatically.
> 
> Starting manually after booting works fine, but this is not a option for
> a database-server.
> 
> I want do some simple thing, which worked with SysV-Init without any
> problems:
> 
>  
> 
> Starting postgresql from a NFS-mount.
> 
>  
> 
> I am not able to achieve this. The error is always the same:
> 
>  
> 
> Jul 01 16:11:27 postgis1 postgresql@9.4-main[536]: Error:
> /mnt/daten/postgis/9.4/main is not accessible or does not exist
> 
> Jul 01 16:11:27 postgis1 systemd[1]: postgresql@9.4-main.service:
> control process exited, code=exited status=1
> 
> Jul 01 16:11:27 postgis1 systemd[1]: Failed to start PostgreSQL Cluster
> 9.4-main.
> 
> Jul 01 16:11:27 postgis1 systemd[1]: Unit postgresql@9.4-main.service
> entered failed state.
> 
>  
> 
> A few lines after these log-lines i  find this:
> 
>  
> 
> Jul 01 16:11:28 postgis1 rpcbind[818]: Starting rpcbind daemon
> 
> Jul 01 16:11:28 postgis1 rpc.statd[861]: Version 1.2.8 starting
> 
> Jul 01 16:11:28 postgis1 rpc.statd[861]: Flags: TI-RPC
> 
> Jul 01 16:11:28 postgis1 kernel: FS-Cache: Loaded
> 
> Jul 01 16:11:28 postgis1 kernel: RPC: Registered named UNIX socket
> transport module.
> 
> Jul 01 16:11:28 postgis1 kernel: RPC: Registered udp transport module.
> 
> Jul 01 16:11:28 postgis1 kernel: RPC: Registered tcp transport module.
> 
> Jul 01 16:11:28 postgis1 kernel: RPC: Registered tcp NFSv4.1 backchannel
> transport module.
> 
> Jul 01 16:11:28 postgis1 kernel: FS-Cache: Netfs 'nfs' registered for
> caching
> 
>  
> 
> It seems to me, that NFS-mounts were done after trying to start postgresql.
> 
>  
> 
> My postgresql.service is this:  (unmodified file)
> 
> [Unit]
> 
> Description=PostgreSQL RDBMS
> 
>  
> 
> [Service]
> 
> Type=oneshot
> 
> ExecStart=/bin/true
> 
> ExecReload=/bin/true
> 
> RemainAfterExit=on
> 
>  
> 
> [Install]
> 
> WantedBy=multi-user.target
> 
> ---
> 
> Modifications in section [Unit] like :
> 
> ConditionPathExists=/mnt/daten/postgis
> 
>  
> 
> Requires=mnt-daten-postgis.mount
> 
> Before=mnt-daten-postgis.mount
> 
> (and creating a Unit-file for the mount-point, enabling etc. instead of
> /etc/fstab) don’t change the problem.
> 
>  
> 
> After booting is complete, the mount is available, but not at the time,
> when postgresql should  be startet.
> 
>  
> 
> Maybe it is caused by this  (ssome lines before in journalctl-log):
> 
> Jul 01 16:09:57 postgis1 systemd[1]: Cannot add dependency job for unit
> display-manager.service, ignoring: Unit display-manager.service f
> 
> Jul 01 16:09:57 postgis1 systemd[1]: Found ordering cycle on
> basic.target/start
> 
> Jul 01 16:09:57 postgis1 systemd[1]: Found dependency on
> sysinit.target/start
> 
> Jul 01 16:09:57 postgis1 systemd[1]: Found dependency on
> rpcbind.service/start
> 
> Jul 01 16:09:57 postgis1 systemd[1]: Found dependency on
> network-online.target/start
> 
> Jul 01 16:09:57 postgis1 systemd[1]: Found dependency on
> vmware-tools.service/start
> 
> Jul 01 16:09:57 postgis1 systemd[1]: Found dependency on basic.target/start
> 
> Jul 01 16:09:57 postgis1 systemd[1]: Breaking ordering cycle by deleting
> job rpcbind.service/start
> 
> Jul 01 16:09:57 postgis1 systemd[1]: Job rpcbind.service/start deleted
> to break ordering cycle starting with basic.target/start
> 
>  
> 
>  
> 
> Where is my error?
> 
>  
> 
>  
> 
> mit freundlichen Grüssen
> 
>  
> 
> Wolfgang Wagner
> 
> Systemadministration
> 
>  
> 
> RIWA GmbH
> 
> Gesellschaft für Geoinformationen
> 
> Zwingerstr. 2, 87435 Kempten
> 
> E-Mail: wolfgang.wag...@riwa-gis.de
> 
> http://www.riwa-gis.de
> 
>  
> 
> --
> RIWA GmbH, Zwingerstrasse 2, 87435 Kempten
> Sitz der Gesellschaft: Kempten (Allgaeu)
> Registergericht: Amtsgericht Kempten, HRB 6480
> Geschaeftsfuehrer: Dipl.-Ing. Guenter Kraus
> --
> 
> 
> 
> ___
> systemd-devel mailing list
> systemd-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
> 

Hi,

just drop a
---
[Unit]
ReuqiresMountsFor=/mnt/daten/postgis/9.4/main
---
into
»/etc/systemd/system/postgresql@9.4-main.service.d/wait-for-mountpoint.conf«
(create directory and file if necessary) end everything should be fine.
In your fstab also add »_netfs« and remove »noauto« for your mount
point. See »man systemd.unit« for more informations on RequireMountsFor=.

Regards




signature.asc
Description: OpenPGP digital 

Re: [systemd-devel] How to mount NFS prior to start postgresql from this volume

2016-07-01 Thread Reindl Harald



Am 01.07.2016 um 16:44 schrieb wolfgang.wag...@riwa-gis.de:

Modifications in section [Unit] like :

ConditionPathExists=/mnt/daten/postgis
Requires=mnt-daten-postgis.mount
Before=mnt-daten-postgis.mount


nonsense - you explicitly state that it should be startet *before* the 
mountpoint - when you want something to be started after some other 
thing, well then you say After=whatever-should-be-started-before


Requires and Before with the same value is not solveable at all



signature.asc
Description: OpenPGP digital signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel