You may receive “Unable to execute bash: No such file or directory” error message while starting a VPS and the result is the VPS fails to start. The reason is, either the binaries from /bin OR /usr/bin are missing OR corrupted.
To fix the issue, you either copy the directories /bin and /usr/bin from a working VPS OR from the OS template the VPS is using.
Solution:
1) Copy directories from a working VPS:
cp -p /vz/private/VEID1/fs/root/bin /vz/private/VEID/fs/root/ -R
cp -p /vz/private/VEID1/fs/root/usr/bin /vz/private/VEID/fs/root/usr/ -R
where,
VEID1 is the working VPS
VEID is the VPS in question
2) Copy directories from the OS template. The OS templates are stored under /vz/template/cache directory.
a) Extract the template file the VPS is using
cd /vz/template/cache/
tar -zxf os-templatename.tar.gz
b) Copy the directories to the VPS private area
cp -p /vz/template/cache/root/bin /vz/private/VEID/fs/root/ -R
cp -p /vz/template/cache/root/usr/bin /vz/private/VEID/fs/root/usr/ -R
Once copied, make sure you are out of the VPS private area and restart the VPS.
vzctl start VEID
It will re-calculate the quota of the VPS and will start the VPS.
Tags: binaries missing from VPS, copy /bin directory from working vps, replace /usr/bin from OS template, Unable to execute bash: No such file or directory, unable to restart VPS: bash file missing, VPS not starting: Unable to execute bash
