• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

psarestore error: sh: - : invalid option

K

kyoo

Guest
I'm receiving an error message when I try to restore using psarestore. I've done the backup using this version:
[root@web1 backup]# rpm -qf /usr/local/psa/bin/psarestore
psa-bu-7.5.4-rh7.3.build75050926.17

And I'm doing the restore using this version:
[root@clone plesk]# rpm -qf /usr/local/psa/bin/psarestore
psa-bu-7.5.4-rhel4.build75050926.17

So the versions are the same, except the OS's. While doing the restore, I receive several "sh: - : invalid option" errors at various sections of the restore process. Two errors are shown.. others include while restoring directories.. it seems to be in between virtualhosts. Sometimes it occurs after creating the mysql DB for one virtual host and before the next domain's restoring directories step.

Any ideas? Things are still restoring, so I don't know yet if there are any obvious problems. This is my trial run. Trying to prepare for the real migration. I'd like to figure out the problem before the real run.

Thanks! --Kyoo

Saving certificate web1 public key ... done
Saving certificate web1 private key ... done
sh: - : invalid option
Usage: sh [GNU long option] [option] ...
sh [GNU long option] [option] script-file ...
GNU long options:
--debug
--debugger
--dump-po-strings
--dump-strings
--help
--init-file
--login
--noediting
--noprofile
--norc
--posix
--protected
--rcfile
--rpm-requires
--restricted
--verbose
--version
--wordexp
Shell options:
-irsD or -c command or -O shopt_option (invocation only)
-abefhkmnptuvxBCHP or -o option
sh: - : invalid option
Usage: sh [GNU long option] [option] ...
sh [GNU long option] [option] script-file ...
GNU long options:
--debug
--debugger
--dump-po-strings
--dump-strings
--help
--init-file
--login
--noediting
--noprofile
--norc
--posix
--protected
--rcfile
--rpm-requires
--restricted
--verbose
--version
--wordexp
Shell options:
-irsD or -c command or -O shopt_option (invocation only)
-abefhkmnptuvxBCHP or -o option
Restoring directory: /var/www/vhosts/domain1.com/ ... done
 
I am facing EXACTLY the same problem.. did your restore complete successfully ?
 
I ended up doing the server migration..if those errors meant something important, then I still haven't discovered what it was. It's been a full week now.

There were a few things that I had to deal w/ afterwards.

php register_globals turned off by default.. a few sites needed it turned back on via their vhosts.conf.

index.htm no longer works as a default page.. I had to symbolically link those to index.html's on a couple of sites.

A single "web user" that existed for one of the domains seemed to have a password that didn't work. I had to reset it. Not sure what was up with that.

Oh, and don't forget to open up your iptables firewall config to open up imap, imaps, pop, pops, 8443, smtp, https, http, etc..
 
after restore all domain's ftp passwords stopped working.. but after resetting them from plesk they started working back again, but it is a nightmare to handle 500+ domains .. anyway to fix ftp password problem quickly ?
 
yah. wish I knew.. i found a few more accts with passwords that were broken.. it didn't seem that ALL of them were broken, though.

come to think of it, the error I was seeing is probably something to do with the useradd command with the '-p' argument to pass in the md5 password hash. I'm guessing that psarestore isn't properly escaping the $ characters.. so any users that have $'s in their md5 pw hashes have broken passwords.

this is just a guess.
 
to me it appears it has something to do with ES4. Anyway all my passwords are broken.. but I am hopeful someone shall reply with a fix.. thanks
 
I'm migrating from RHEL 3 to RHEL 4, and having the same problem.
Both servers are updated, with version 7.5.4
 
Having the same problem moving from RedHat 7.3 to RHEL4 / Centos 4.3... it's a pretty big jump, but according to PLESK it should not be a problem. Latest buiild of PLESK7.5 Reloaded on both servers.

Did any of you come up with a solution on how to migrate the data without any big issues? Does the server migration-tool work betetr then backup/restore?

Thanks.
 
I think you can edit the restore.sh script and fix this syntax error, good luck.
I will stay in RHEL 3 in the new server too.
 
Thanks for the reply zooming but I'm not sure that I follow... Exactly where and what should I edit? Only got a bounch of dump.xx files or am I missing something?
 
The restore seams to have worked more or less exept for FTP passwords. After the expert response from PLESK support saying...

I've just checked the restoration log file and didn't find error "sh: - : invalid option" you reported about, Please let us know how everything goes.

...I ended up writing a PHP script that resets all FTP passwords. Perhaps someone might have use for it. Simply create a file called passwd.php i /home/httpd/vhosts/default/htdocs/ (or somewhere that is can be seen from the web) and paste the following:


<?

header("Content-Type: text/plain");

$server = "localhost";
$databas = "psa";
$anvandare = "admin";
$losen = "PLESK_PASSWORD_HERE";

mysql_connect ("$server", "$anvandare", "$losen");
mysql_select_db ("$databas");

echo "#!/bin/sh\n\n";

$plocka = mysql_query('Select login, account_id from sys_users') or die(mysql_error());
while ($se = mysql_fetch_array($plocka))
{
$e++;
$login = $se["login"];
$account_id = $se["account_id"];

echo "passwd --stdin ";
echo $login;
echo " << !\n";

$plocka2 = mysql_query("Select password from accounts where id = $account_id") or die(mysql_error());
while ($se2 = mysql_fetch_array($plocka2))
{
$i++;
$password = $se2["password"];
echo $password;
echo "\n";
echo $password;
echo "\n!\n";
}
echo "\n";
}
?>

It's not the best of PHP programming but it works ;-) Access this page from the web and you will end up having a nice shell-script that will set the FTP password correct...

What it does is simply to get FTP username and password from the PLESK database and putting it into a bunch of passwd-commands...

And don't forget to remove this from the server as the username/passwords are beeing show in simple text.

I'm happy if it can help someone. It saved me from looking up and running thousends of passwd commands. And PLESK support really need to... well... give support on thir product?!
 
Thank you for the script. It did not do the whole trick on our servers. In the files /etc/passwd and all the other password and groupfiles there were wrong paths mentioned. The path of the server restored on was /var/www/vhosts, the path of the restore file was /usr/local/psa/home/vhosts. After the restore the vhost dir was moved from /var/www to /usr/local/psa/home. The path in the various password file thus was wrong. Using the replace command in /etc:

replace "/var/www/vhosts" "/usr/local/psa/home/vhosts" -- *

updated all the files containing the wrong path. Now all ftp logins are working again!
 
I'm not sure, but I think you can edit the restore.sh script file and correct the wrong command's syntax.
It looks like that some shell command have it's syntax changed from RHEL3 to RHEL4, and the restore.sh file does not take that in account.
 
You will not find the error message in the log file.
You will only see this message if you watch the restore messages while it is running.
 
Hello Everybody,

Swsoft's support staff gave me a patch (bu-patches.tgz) that solved this problem.

:) :) :)
 
Hi,

I hit the same error when restoring a Plesk 7.5 for RHEL3 dump file on Plesk 7.5 on RHEL4.

Would you mind sharing the patch (e.g. uploading it to this thread)?

Thanks.
 
Just to bring this up. That link does not work and i'm now looking to mobilise my data, and correct this issue.

Does anyone know where is psarestore the line is that needs to be altered?
 
Back
Top