setup-data-path.sh not executing, resulting in broken permissions
Summary
In v1.3.2 there is a script, that can't be executed before the postgresql instance starts: /etc/patroni/setup-data-path.sh
. This script seems to set some folder permissions for the postgresql data.
I believe this is related to #2052 (closed).
Current Behaviour
There's an error logged before the postgresql instance is started:
2022-10-18 04:58:35,278 ERROR: Failed to execute ['/etc/patroni/setup-data-path.sh', 'on_start', 'replica', 'clustername']
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/patroni/postgresql/cancellable.py", line 30, in _start_process
self._process = psutil.Popen(cmd, *args, **kwargs)
File "/usr/lib64/python3.6/site-packages/psutil/__init__.py", line 1316, in __init__
self.__subproc = subprocess.Popen(*args, **kwargs)
File "/usr/lib64/python3.6/subprocess.py", line 729, in __init__
restore_signals, start_new_session)
File "/usr/lib64/python3.6/subprocess.py", line 1364, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/etc/patroni/setup-data-path.sh'
This script sets some permissions on the postgresql data folder. Because it's not executed the permissions for the folder aren't correct, and postgresql refuses to start. Manually executing the script is working.
Steps to reproduce
- Update operator to v1.3.2
- restart a cluster
- The nodes fail to restart due to the broken permissions
Note: downgrading to v1.3.1 resolves the issue.
Expected Behaviour
The script can be run so that the permissions are set correctly.
Possible Solution
The script is currently missing a shebang. It might be enough to specify it. Otherwise, call it explicitly with something like sh /etc/patroni/setup-data-path.sh
.
Environment
- StackGres version: 1.3.2
- Kubernetes version: 1.24
- Cloud provider or hardware configuration: Ceph CSI RBD
Relevant logs and/or screenshots
2022-10-18 04:58:35,278 ERROR: Failed to execute ['/etc/patroni/setup-data-path.sh', 'on_start', 'replica', 'earthnet']
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/patroni/postgresql/cancellable.py", line 30, in _start_process
self._process = psutil.Popen(cmd, *args, **kwargs)
File "/usr/lib64/python3.6/site-packages/psutil/__init__.py", line 1316, in __init__
self.__subproc = subprocess.Popen(*args, **kwargs)
File "/usr/lib64/python3.6/subprocess.py", line 729, in __init__
restore_signals, start_new_session)
File "/usr/lib64/python3.6/subprocess.py", line 1364, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/etc/patroni/setup-data-path.sh'