img IX mining rig inside white and gray room

HestiaCP backups saves the day!

A couple of days ago, I was exploring a few things on my VPS only to realize that while installing or removing any package from Ubuntu distro – I was presented with this error – “sub-process /usr/bin/dpkg returned an error code (1)”. And like any part time sysadmin I decided to Google the solution and tried to follow what Bosko Marijan recommended on his blog post. Only to realize that I’d messed up even more after removing Apache2 and that took all the sites hosted on this server.

I could’ve spent hours trying to find/think of a fix, however – I took the short route and that is resetting up the VPS! Yeah, one would think that would be a pain, however it turned out that doing that was much faster and easier as compared to figuring out the fix to solve the original error, which eventually bubbled up to sites going down.

Thankfully, Hestia has remote backup functionality which I’d already configured to back the Linux users on Backblaze B2. If you happen to be on Hestia, then these instructions can save you from disaster of losing sites(s) as well –

  1. Reset the VPS by reinstalling Ubuntu
  2. Setup HestiaCP on the newly installed Ubuntu
  3. Download the latest backup from Backblaze or any other remote location which you might have configured at the time of setting remote backup on hestia.
  4. Upload the backup to /backup directory using CyberDuck, Filezilla or WinSCP (whatever you prefer)
  5. Once it’s uploaded – SSH into the server and run the following command
v-restore-user username username.2020.01.01-00-00.tar

where username is the original username of the Linux user account where you installed various websites and username.2020.01.01-00-00.tar is the name of the latest backup file.

This one single command will restore the linux user, all the files of any website(s) setup on that user account and will also restore the database. It’ll be like you never changed anything.

Needless to say – you’ll have to configure Hestia again, for me particularly – here’s what I did –

  1. Configured 2FA for the Hestia admin account
  2. Disabled login of the Hestia user accounts
  3. Configured the remote backup again
  4. Mapped the Hestia control panel with a domain.

Hope you never have to face such issues – but that’s what backups are for! To save our hard work on a bad day!

Feature image credit: Imgix