Error restoring backup

Greetings all,

I just updated a server (fresh install) to Ubuntu 24.04.2 and did a fresh install of HestiaCP v1.9.3. I had used the v-backup-users to create backups of all users prior to reload.

The server prior and after reinstall is configured to only have bind (installed with bash hst-install.sh --apache no --phpfpm no --vsftpd no --mysql no --exim no --dovecot no --clamav no --spamassassin no --iptables no --fail2ban no --interactive no).

When I restored users, quite a few of them went through without issue. I had a number of them under the – USER – section that showed the following error:

sed: -e expression #1, char 3: unknown command: `
'
sed: -e expression #1, char 3: unknown command: `
'

The CRON section complained, but we did not have any cron jobs defined so wasn’t too concerned. It appears like it is functioning fine, but concerned about USER section. I cannot see any difference on these users versus others. I’ve been poking around the v-restore-user command and not seeing anything what might be causing yet. I thought I’d post and also keep digging.

EDIT: It appears that it won’t let me paste in what the error on the shell looked like without it getting all jumbled up, so am taking a screenshot and attaching.

Screenshot 2025-03-27 at 10.07.32 AM

EDIT2: I seem to inadvertently filed the first post under Uncategorized. Not intending to double post, but also wanted to put this in the right place. :-/

Thanks,

Hi @ledoktre

If the error occurs during the USER restore section, the following sed commands are used:

In v-restore-user:

sed -i "/ $user /d" $HESTIA/data/queue/backup.pipe

In function rebuild_user_conf

sed -i "s/FNAME='$FNAME'/NAME='$NAME'/g" $USER_DATA/user.conf
sed -i "/LNAME='$LNAME'/d" $USER_DATA/user.conf
sed -i "/RKEY/a TWOFA=''" $USER_DATA/user.conf
sed -i "/TWOFA/a QRCODE=''" $USER_DATA/user.conf
sed -i "/QRCODE/a PHPCLI=''" $USER_DATA/user.conf
sed -i "/PHPCLI/a ROLE='user'" $USER_DATA/user.conf
sed -i "/LANGUAGE/a THEME=''" $USER_DATA/user.conf
sed -i "/NOTIFICATIONS/a PREF_UI_SORT='name'" $USER_DATA/user.conf
sed -i "/PREF_UI_SORT/a LOGIN_DISABLED=''" $USER_DATA/user.conf
sed -i "/LOGIN_DISABLED/a LOGIN_USE_IPLIST=''" $USER_DATA/user.conf
sed -i "/LOGIN_USE_IPLIST/a LOGIN_ALLOW_IPS=''" $USER_DATA/user.conf
sed -i "/MAIL_ACCOUNTS/a RATE_LIMIT='200'" $USER_DATA/user.conf
sed -i "s|^$user:[^:]*:|$user:$MD5:|" /etc/shadow
sed -i "/ $user$/d" $HESTIA/data/queue/disk.pipe

But it seems that only these ones could be the culprits:

sed -i "/ $user /d" $HESTIA/data/queue/backup.pipe
sed -i "s/FNAME='$FNAME'/NAME='$NAME'/g" $USER_DATA/user.conf
sed -i "/LNAME='$LNAME'/d" $USER_DATA/user.conf
sed -i "s|^$user:[^:]*:|$user:$MD5:|" /etc/shadow
sed -i "/ $user$/d" $HESTIA/data/queue/disk.pipe

If you need more info you should debug the v-restore-user command.

What is the user name and the contact name?

Thanks for “correcting” my initial post with backticks.

One example (there are 10+) of a user name and contact name is:
user name: worthbrew
contact name: Worth Brewing

I was looking at the file. mentioned and searching for the sed references before posting, and I did not see any related to sed -e. I saw lots related to sed -i. Just wanted to point that out, its what sort of what was tripping me up. Could not find anything yet on sed -e.

Thanks

-e is implicit. If you don’t use it, for sed, this:

sed -i "/ $user /d" $HESTIA/data/queue/backup.pipe

is like this:

sed -i -e "/ $user /d" $HESTIA/data/queue/backup.pipe

The user and contact name look fine, so the only way to understand what’s going on is by debugging it…

Thanks for the explanation. I will try to dig through it and figure it out. Also trying to figure out the rclone/restic inplementation as well (thats another topic I guess). Been using restic for years but now that it seems to be an option here why not check it out??

1 Like