I'm trying to provision a FreeBSD 13.1 VM over SSH by running shell commands. Among many other things I'm executing commands like these:
It gets to
I can reproduce it via simple command by not running
Again, similar output is printed out and SSH connection will hang indefinitely.
By running this command manually within SSH connection does not cause any problems - it's only problematic when I try to automate postgresql server installation via scripting.
Now, I did google about this problem and found one issue at ansible issue tracker from the year 2016 at https://github.com/ansible/ansible/issues/5923. I'm not using ansible, but the problem description is really similar.
Found one solution from there, which worked for me too:
However, it does feel dirty to send log output to /dev/null during provisioning - maybe there's something important which I would like to see? And as I understand then logs will be sent to /dev/null in the future too which is definitely not something I would prefer. Also, it hardcodes postgresql_flags in a way, which might not work in the future.
While writing this post, I've managed to improve above commands a little:
Instead of setting
However, postgresql is not the only service I'm installing and starting via provisioning - I don't have any similar problems with anything else so far.
Does anyone know why this problem exists in the first place and what would be the proper solution in this case?
Thank you for all the help.
Code:
pkg install -y postgresql15-server
service postgresql initdb
service postgresql start
It gets to
service postgresql start
, prints the following and hangs indefinitely:
Code:
2023-04-09 22:49:53.174 EEST [84492] LOG: ending log output to stde
2023-04-09 22:49:53.174 EEST [84492] HINT: Future log output will go to log destination "syslog".
I can reproduce it via simple command by not running
service postgresql start
command via the provisioning script, but executing it after service postgresql initdb
manually like this: ssh freebsd service postgresql start
Again, similar output is printed out and SSH connection will hang indefinitely.
By running this command manually within SSH connection does not cause any problems - it's only problematic when I try to automate postgresql server installation via scripting.
Now, I did google about this problem and found one issue at ansible issue tracker from the year 2016 at https://github.com/ansible/ansible/issues/5923. I'm not using ansible, but the problem description is really similar.
Found one solution from there, which worked for me too:
Code:
pkg install -y postgresql15-server
service postgresql initdb
sysrc postgresql_flags="-l /dev/null -w -s -m fast"
service postgresql start
While writing this post, I've managed to improve above commands a little:
Code:
pkg install -y postgresql15-server
service postgresql initdb
service postgresql start >/dev/null
Instead of setting
postgresql_flags
and affecting all the commands in the future too, I'm just redirecting stdout to /dev/null - yes, I might miss something important/interesting when provisioning, but at least nothing blocks and I expect to receive a non-successful exit code when something goes wrong thus causing provisioning to fail too.However, postgresql is not the only service I'm installing and starting via provisioning - I don't have any similar problems with anything else so far.
Does anyone know why this problem exists in the first place and what would be the proper solution in this case?
Thank you for all the help.
Last edited by a moderator: