Re: How to debug systemd script?

2016-03-28 Thread chrisb
On Mon, Mar 28, 2016 at 04:02:20PM +0100, Oliver Elphick wrote:
> On Tue, 2016-03-29 at 02:33 +1300, chrisb@localhost.localdomain wrote:
> > On Mon, Mar 28, 2016 at 01:00:35PM +0100, Oliver Elphick wrote:
> > > How can I find out what is going on to stop the normal init script
> > > from
> > > working? Is there some way to force systemctl to log what it is
> > > doing?
> > > If it does log, where does it put the log?
> > See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=731862
> > 
> > Near the very end it suggests:
> > strace -f -o /tmp/strace.log -s 2048 -p 1 & systemctl restart
> > postgresql.service
> 
> In fact the other suggestion there, of suppressing the redirect to
> systemctl, proved helpful. the problem is actually in postgresql-
> common, in a Perl script.

Could you be more specific? Someone else may come across the same 
problem.

-- 
The media's the most powerful entity on earth. 
They have the power to make the innocent guilty 
and to make the guilty innocent, and that's power.
 -- Malcolm X



Re: How to debug systemd script?

2016-03-28 Thread Oliver Elphick
On Tue, 2016-03-29 at 02:33 +1300, chrisb@localhost.localdomain wrote:
> On Mon, Mar 28, 2016 at 01:00:35PM +0100, Oliver Elphick wrote:
> > How can I find out what is going on to stop the normal init script
> > from
> > working? Is there some way to force systemctl to log what it is
> > doing?
> > If it does log, where does it put the log?
> See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=731862
> 
> Near the very end it suggests:
> strace -f -o /tmp/strace.log -s 2048 -p 1 & systemctl restart
> postgresql.service

In fact the other suggestion there, of suppressing the redirect to
systemctl, proved helpful. the problem is actually in postgresql-
common, in a Perl script.

Thanks



Re: How to debug systemd script?

2016-03-28 Thread chrisb
On Mon, Mar 28, 2016 at 01:00:35PM +0100, Oliver Elphick wrote:
> I have installed Debian alongside Linux Mint and wish to have
> PostgreSQL use the same database.  So I have copied the system
> configuration files in /etc/postgresql from the Linux Mint partition.
> They point to the PostgreSQL data files in /lvhome/postgresql.  
> 
> This works in Linux Mint but not in Debian; PostgreSQL does not start.
> There is nothing in the logs of either system or PostgreSQL. It works
> if I call pg_ctl or if I run postgres directly.
> 
> I put set -x in the init script. When it is run, we see:
> 
> # /etc/init.d/postgresql start
> ...
> + echo -n Starting postgresql (via systemctl): postgresql.service
> Starting postgresql (via systemctl): postgresql.service+
> log_daemon_msg_post Starting postgresql (via systemctl)
> postgresql.service
> + :
> + /bin/systemctl start postgresql.service
> + rc=0
> ...
> 
> 
> There is a long pause at /bin/systemctl, but no error is indicated.
> However, the server is not started.
> 
> How can I find out what is going on to stop the normal init script from
> working? Is there some way to force systemctl to log what it is doing?
> If it does log, where does it put the log?

See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=731862

Near the very end it suggests:
strace -f -o /tmp/strace.log -s 2048 -p 1 & systemctl restart postgresql.service

Then, after a couple of seconds, fg into the strace process, cancel it, and then
see it the strace.log helps.

-- 
The media's the most powerful entity on earth. 
They have the power to make the innocent guilty 
and to make the guilty innocent, and that's power.
 -- Malcolm X



How to debug systemd script?

2016-03-28 Thread Oliver Elphick
I have installed Debian alongside Linux Mint and wish to have
PostgreSQL use the same database.  So I have copied the system
configuration files in /etc/postgresql from the Linux Mint partition.
They point to the PostgreSQL data files in /lvhome/postgresql.  

This works in Linux Mint but not in Debian; PostgreSQL does not start.
There is nothing in the logs of either system or PostgreSQL. It works
if I call pg_ctl or if I run postgres directly.

I put set -x in the init script. When it is run, we see:

# /etc/init.d/postgresql start
...
+ echo -n Starting postgresql (via systemctl): postgresql.service
Starting postgresql (via systemctl): postgresql.service+
log_daemon_msg_post Starting postgresql (via systemctl)
postgresql.service
+ :
+ /bin/systemctl start postgresql.service
+ rc=0
...


There is a long pause at /bin/systemctl, but no error is indicated.
However, the server is not started.

How can I find out what is going on to stop the normal init script from
working? Is there some way to force systemctl to log what it is doing?
If it does log, where does it put the log?

Thanks
Oliver Elphick