Barman on OSX - barman-wal-archive fails with exit code 2 / Error executing ssh: [Errno 32] Broken pipe

398 views
Skip to first unread message

Marc

unread,
Aug 21, 2023, 9:07:04 AM8/21/23
to Barman, Backup and Recovery Manager for PostgreSQL
Hello,

I have set up a Barman server on macOS Ventura with MacPorts.
The primary PostgreSQL server is running on a different machine, also with macOS Ventura.

On the Barman server, everything seems to be in order, but the PostgreSQL server keeps logging the following error:

2023-08-21 13:33:26.077 CEST [91942] LOG:  archive command failed with exit code 2
2023-08-21 13:33:26.077 CEST [91942] DETAIL:  The failed archive command was: barman-wal-archive 192.163.1.38 pg36 pg_wal/00000001000000D400000077
2023-08-21 13:33:26.077 CEST [91942] WARNING:  archiving write-ahead log file "00000001000000D400000077" failed too many times, will try again later
ERROR: Error executing ssh: [Errno 32] Broken pipe
Exception ignored in: <function _Stream.__del__ at 0x101438f40>
Traceback (most recent call last):
  File "/opt/macports-bin-pkg-version/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/tarfile.py", line 415, in __del__
    self.close()
  File "/opt/macports-bin-pkg-version/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/tarfile.py", line 465, in close
    self.fileobj.write(self.buf)
ValueError: write to closed file



The Postgres server (identified as "pg36" in the Barman configuration) can open an SSH connection for the barman user on the Barman server (ip .38). The command
>   ssh bar...@192.163.1.38 -C true
returns no output, as expected.


If I try the barman-wal-archive in the terminal on the Postgres server, I get a similar result as the in the log:
>   barman-wal-archive 192.163.1.38 pg36 pg_wal/00000001000000D400000077
sh: barman: command not found
ERROR: Error executing ssh: [Errno 32] Broken pipe
Exception ignored in: <function _Stream.__del__ at 0x104df4f40>
Traceback (most recent call last):
  File "/opt/macports-bin-pkg-version/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/tarfile.py", line 415, in __del__
    self.close()
  File "/opt/macports-bin-pkg-version/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/tarfile.py", line 465, in close
    self.fileobj.write(self.buf)
ValueError: write to closed file



Any idea why I keep getting this error?

Marc

unread,
Aug 21, 2023, 9:15:55 AM8/21/23
to Barman, Backup and Recovery Manager for PostgreSQL
I forgot to mention: the barman-wal-archive test described in the Barman tutorial, returns the following:
>   barman-wal-archive --test 192.163.1.38 pg36 DUMMY

sh: barman: command not found

>

That is en empty line under the "sh: barman: command not found" before returning another prompt.

Marc

unread,
Aug 22, 2023, 4:50:56 AM8/22/23
to Barman, Backup and Recovery Manager for PostgreSQL
UPDATE:
I have found a solution for my problem. The error was caused because the barman user could not resolve the barman commands over SSH. By setting the environment variable in the SSHD config, the problem is fixed:

SetEnv PATH="/opt/local/bin:/opt/local/sbin:$PATH"

Mike Wallace

unread,
Aug 22, 2023, 5:06:16 AM8/22/23
to pgba...@googlegroups.com
Hi Marc,

Glad you found a solution and thank you for sharing it here.

Best,

Mike

--
--
You received this message because you are subscribed to the "Barman for PostgreSQL" group.
To post to this group, send email to pgba...@googlegroups.com
To unsubscribe from this group, send email to
pgbarman+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/pgbarman?hl=en?hl=en-GB

---
You received this message because you are subscribed to the Google Groups "Barman, Backup and Recovery Manager for PostgreSQL" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pgbarman+u...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/pgbarman/dc6874fc-34d7-4194-bbb2-f78344f298f4n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages