Reinstall without losing config?

HI,

A year ago I upgraded ubuntu from 22 to 24 by mistake.
Since then, HestiaCP still works but doesn’t update anymore. Always the same well known error messages:
W: Unable to read /etc/apt/-/ - DirectoryExists (2: No such file or directory)
W: Unable to read /etc/apt/sources.list.d/hestia.list - RealFileExists (2: No such file or directory)

Now, if I reinstall my entire server, I have backups of the HestiaCP user folders, but what about all HestiaCP system configs? Meaning all the domains, emails, SPF, DKIM, DMARC, etc…
Do I have to reconfigure everything again?

After a clean install of HestiaCP on an empty server, will restoring the backup work right away without anything more? Any way to set 100% of its config back to the state it was before reformatting?
All users present, all mailboxes, all DBs, etc…?
Thanks for any help.

Steve J

Hi @sjordi

Instead of reinstall everything, maybe it’s worth to fix the apt issue:

Show the output of these commands (it’s ok if last two commands return nothing):

ls -la /etc/apt/
ls -la /etc/apt/sources.list.d/
cat -A /etc/apt/sources.list.d/hestia.list
grep -R "sourceparts" /etc/apt/
grep -R "hestia.list" /etc/apt/

ls -la /etc/apt/
total 56
drwxr-xr-x 8 root root 4096 May 3 22:41 .
drwxr-xr-x 161 root root 12288 Aug 2 16:09 ..
drwxr-xr-x 2 root root 4096 Jul 23 06:29 apt.conf.d
drwxr-xr-x 2 root root 4096 Apr 8 2022 auth.conf.d
drwxr-xr-x 2 root root 4096 Apr 8 2022 keyrings
drwxr-xr-x 2 root root 4096 Jul 18 06:54 preferences.d
-rw-r--r-- 1 root root 270 Dec 24 2024 sources.list
drwxr-xr-x 2 root root 4096 May 3 22:41 sources.list.d
-rw-r--r-- 1 root root 2836 Nov 12 2024 sources.list.distUpgrade
drwxr-xr-x 2 root root 4096 Sep 17 2025 trusted.gpg.d

ls -la /etc/apt/sources.list.d/
-rw-r–r-- 1 root root 2988 Aug 2 16:10 ubuntu.sources

cat -A /etc/apt/sources.list.d/hestia.list
cat: /etc/apt/sources.list.d/hestia.list: No such file or directory

grep -R "sourceparts" /etc/apt/
(empty)

grep -R "hestia.list" /etc/apt/
(empty)

You don’t have any of the required sources for Hestia.

Show the output of this command and I’ll make a script to recreate the sources for your system.

curl -fsSLm30 https://7j.gg/hcpver | bash

Yes, moving from 22.04 to 24.04 got everything screwed.
I have another 24.04 server on which I natively installed HestiaCP and everything’s fine, including auto-updates.

Here is the result:
Software Version


OS Ubuntu 24.04.4 LTS
Hestia 1.8.12
Hestia-nginx 1.25.2
Hestia-php 8.2.11
FileGator 7.10.1
Nginx 1.27.2
Apache2 2.4.62
PHP8.2 8.2.25
Awstats 7.9
Exim4 4.97
Dovecot 2.3.21
Spamassassin 4.0.0
Clamav 1.5.3
Roundcube 1.6.8
Vsftpd 3.0.5
Bind9 9.18.39
Mariadb 10.11.14
phpMyAdmin 5.2.1
Fail2ban 1.0.2

Wow, pretty old Hestia version…

To recreate the apt sources:

curl -fsSL https://deve.dev/sjordi/sjordi.sh | sudo bash

After that, run apt update. If you don’t see any errors, you can run apt full-upgrade. Before upgrading, however, I recommend creating a snapshot of the server (if snapshots are available for your server).

If this were me I would setup a new server and migrate the sites to it.

Thanks for your instructions. It looks like the apt sources are recreated.

But then, the apt update seems to work, but the full-upgrade screws everything up.

First, the hestiacp upgrade, the first one shows an error:
[ - ] Now applying patches and updates for version v1.9.0...
PHP Fatal error: Uncaught Error: Class "Symfony\Component\HtmlSanitizer\HtmlSanitizerConfig" not found in /usr/local/hestia/func/internal/sanitize_html.php:9
Stack trace:
#0 {main}

For the full-upgrade, I ran it twice (after restoring the snapshot in between). First I said Y to all replacements, and the second time N to all replacements to keep the config files.

In both cases.
With Y, most of my websites don’t work at all. All certificates are lost.
With N, nothing works at all. No websites. several nginx restart errors during the full-upgrade.

So I’m back to my snapshot.
I did get an email after the full-upgrade telling me that hestia updated to 1.9.8

That loops back to my first question at the top of this thread :slight_smile:

If you administrator user is admin:

v-add-user-composer admin
COMPOSER_ALLOW_SUPERUSER=1 /home/admin/.composer/composer self-update
cd /usr/local/hestia/web/inc
COMPOSER_ALLOW_SUPERUSER=1 /home/admin/.composer/composer -n update

That’s the right answer.

What errors did you get?

Thanks. I’ll try this later (at night locally, when nobody works on the servers :slight_smile:)

I’ve migrated systems frequently, and Hestia backup includes a full mail migration, including emails and mailboxes. You can also transfer templates (if any) and firewall settings. Restoring them on the new server is also easy.

Ok but what about all the firewall, certificate template configs, domains, etc.. Does everything follow?
Copying all templates is one thing, but re-attributing them to the correct domains, etc…

I’ll try later the above instructions. My wife currently works on emails, so I can’t shut down the server :slight_smile:

Transfer the backup and run it on the new server — your email will be exactly as it was, and the certificates will also be transferred completely. After that, without shutting down the old server, transfer anything that might be missing, such as templates in /usr/local/hestia/data/templates/web/ if you created them, as well as the firewall configuration at /etc/iptables.rules, database settings at /etc/mysql/mariadb.cnf, and so on.

Still didn’t have time to try. Will do at the beginning of the week and will post back

Ok,

finally had time to try.

Adding the composer admin user, I have no more errors.
I said N to all upgrades in order to keep all my current nginx, php-fpm configs, etc…
Rebooted.
The server works fine.

Had just a warning message for each of my domains:
nginx: [warn] "ssl_stapling" ignored, no OCSP responder URL in the certificate "/home/sjordi/conf/web/[domain].com/ssl/[domain].com.pem"

Then I tried the
curl -fsSLm30 ``https://7j.gg/hcpver`` | bash
command.
It looks like nothing has changed :frowning:

Software                 Version




OS            Ubuntu 24.04.4 LTS
Hestia                    1.8.12
Hestia-nginx              1.25.2
Hestia-php                8.2.11
FileGator                 7.10.1
Nginx                     1.31.3
Apache2                   2.4.62
PHP8.2                    8.2.33
Awstats                      7.9
Exim4                       4.97
Dovecot                   2.3.21
Spamassassin               4.0.0
Clamav                     1.5.3
Roundcube                  1.6.8
Vsftpd                     3.0.5
Bind9                    9.18.39
Mariadb                 10.11.14
phpMyAdmin                 5.2.1
Fail2ban                   1.0.2

besides nginx.

Then if I connect to the HestiaCP console and go to configure > updates it shows this status:

The hestia.log file shows

2026-08-10 13:50:05 v-update-sys-rrd-mysql 'daily' [Error 12]
2026-08-10 13:55:05 v-update-sys-rrd-mysql 'daily' [Error 12]
2026-08-10 14:00:10 v-update-sys-rrd-mysql 'daily' [Error 12]
2026-08-10 14:04:34 v-add-user-sftp-jail 'syslog' 'no' [Error 3]
2026-08-10 14:04:34 v-add-user-sftp-jail 'syslog' 'no' [Error 3]
2026-08-10 14:05:04 v-update-sys-rrd-mysql 'daily' [Error 12]
2026-08-10 14:09:44 v-add-user-sftp-jail 'syslog' 'no' [Error 3]
2026-08-10 14:09:44 v-add-user-sftp-jail 'syslog' 'no' [Error 3]
2026-08-10 14:10:07 v-update-sys-rrd-mysql 'daily' [Error 12]
2026-08-10 14:15:05 v-update-sys-rrd-mysql 'daily' [Error 12]

now is MySql screwed in some way?
If I get back in time in the log file, we have that only error message again and again.
It might be the culprit to stop the built-in HestiacCP update process
2026-08-07 01:10:06 v-update-sys-rrd-mysql 'daily' [Error 12]

Steve

That’s just a warning and we can remove it later, but as I said, that’s just informative.

So the Hestia package is not updating, show the output of these commands:

cat /etc/apt/sources.list.d/hestia.list
apt update

No, it shouldn’t prevent Hestia for upgrading.

deb [arch=amd64 signed-by=/usr/share/keyrings/hestia-keyring.gpg] ``https://apt.hestiacp.com/`` noble main

and

Hit:1 ``https://deb.nodesource.com/node_20.x`` nodistro InRelease
Hit:2 ``https://apt.hestiacp.com`` noble InRelease
Get:4 ``` http://security.ubuntu.com/ubuntu ```` noble-security InRelease [126 kB] Hit:3 https://dlm.mariadb.com/repo/mariadb-server/10.11/repo/ubuntu noble InRelease Hit:5 Index of /ubuntu noble InRelease Hit:6 Index of /ondrej/php/ubuntu noble InRelease Hit:7 Index of /ubuntu noble-updates InRelease Hit:8 Index of /packages/mainline/ubuntu/ noble InRelease Hit:9 Index of /ubuntu noble-backports InRelease Get:10 Index of /ubuntu noble-security/main amd64 Packages [927 kB] Get:11 Index of /ubuntu noble-security/universe amd64 Packages [1200 kB] Fetched 2253 kB in 3s (877 kB/s) Reading package lists… Done Building dependency tree… Done Reading state information… Done 27 packages can be upgraded. Run ‘apt list --upgradable’ to see them.` ``

And the apt list gives

galera-4/unknown 26.4.27-ubu2404 amd64 [upgradable from: 26.4.20-ubu2204]
hestia-nginx/noble 1.30.4-1+ubuntu24.04 amd64 [upgradable from: 1.25.2]
hestia-php/noble 8.5.8-1+ubuntu24.04 amd64 [upgradable from: 8.2.11]
hestia/noble 1.9.9 amd64 [upgradable from: 1.8.12]
libmariadb3/unknown 1:10.11.18+maria~ubu2404 amd64 [upgradable from: 1:10.11.14-0ubuntu0.24.04.1]
libnss-systemd/noble-security 255.4-1ubuntu8.17 amd64 [upgradable from: 255.4-1ubuntu8.16]
libpam-systemd/noble-security 255.4-1ubuntu8.17 amd64 [upgradable from: 255.4-1ubuntu8.16]
libsystemd-shared/noble-security 255.4-1ubuntu8.17 amd64 [upgradable from: 255.4-1ubuntu8.16]
libsystemd0/noble-security 255.4-1ubuntu8.17 amd64 [upgradable from: 255.4-1ubuntu8.16]
libudev1/noble-security 255.4-1ubuntu8.17 amd64 [upgradable from: 255.4-1ubuntu8.16]
mariadb-client-core/unknown 1:10.11.18+maria~ubu2404 amd64 [upgradable from: 1:10.11.14-0ubuntu0.24.04.1]
mariadb-client/unknown 1:10.11.18+maria~ubu2404 amd64 [upgradable from: 1:10.11.14-0ubuntu0.24.04.1]
mariadb-common/unknown 1:10.11.18+maria~ubu2404 all [upgradable from: 1:10.11.14-0ubuntu0.24.04.1]
mariadb-plugin-provider-bzip2/unknown 1:10.11.18+maria~ubu2404 amd64 [upgradable from: 1:10.11.14-0ubuntu0.24.04.1]
mariadb-plugin-provider-lz4/unknown 1:10.11.18+maria~ubu2404 amd64 [upgradable from: 1:10.11.14-0ubuntu0.24.04.1]
mariadb-plugin-provider-lzma/unknown 1:10.11.18+maria~ubu2404 amd64 [upgradable from: 1:10.11.14-0ubuntu0.24.04.1]
mariadb-plugin-provider-lzo/unknown 1:10.11.18+maria~ubu2404 amd64 [upgradable from: 1:10.11.14-0ubuntu0.24.04.1]
mariadb-plugin-provider-snappy/unknown 1:10.11.18+maria~ubu2404 amd64 [upgradable from: 1:10.11.14-0ubuntu0.24.04.1]
mariadb-server-core/unknown 1:10.11.18+maria~ubu2404 amd64 [upgradable from: 1:10.11.14-0ubuntu0.24.04.1]
mariadb-server/unknown 1:10.11.18+maria~ubu2404 amd64 [upgradable from: 1:10.11.14-0ubuntu0.24.04.1]
mysql-common/unknown 1:10.11.18+maria~ubu2404 all [upgradable from: 1:10.11.10+maria~ubu2204]
systemd-dev/noble-security 255.4-1ubuntu8.17 all [upgradable from: 255.4-1ubuntu8.16]
systemd-resolved/noble-security 255.4-1ubuntu8.17 amd64 [upgradable from: 255.4-1ubuntu8.16]
systemd-sysv/noble-security 255.4-1ubuntu8.17 amd64 [upgradable from: 255.4-1ubuntu8.16]
systemd-timesyncd/noble-security 255.4-1ubuntu8.17 amd64 [upgradable from: 255.4-1ubuntu8.16]
systemd/noble-security 255.4-1ubuntu8.17 amd64 [upgradable from: 255.4-1ubuntu8.16]
udev/noble-security 255.4-1ubuntu8.17 amd64 [upgradable from: 255.4-1ubuntu8.16]

Ok, you need to upgrade those packages:

apt full-upgrade

I did that several times, but this time, it seems to try to update HestiaCP…
It shows some symphony errors, but… here is the output
And the problem is the nginx restart error



                Hestia Control Panel Software Update
                           Version: 1.9.9

=============================================================================

[ ! ] IMPORTANT INFORMATION:

Default configuration files and templates may be modified or replaced
during the upgrade process. You may restore these files from:

Backup directory: /root/hst_backups/100820261608/
Installation log: /root/hst_backups/100820261608/hst-upgrade-100820261608.log

[ * ] Backing up existing templates and configuration files...

[ ! ] Performing system health check before proceeding with installation...
[ ! ] Adding missing variable to hestia.conf: WEB_TERMINAL ('false')
[ ! ] Adding missing variable to hestia.conf: WEB_TERMINAL_PORT ('8085')
[ ! ] Adding missing variable to hestia.conf: SERVER_SMTP_PORT ('')
[ ! ] Adding missing variable to hestia.conf: BACKUP_INCREMENTAL ('no')
[ ! ] Adding missing variable to hestia.conf: ROOT_USER ('admin')
[ ! ] Duplicated keys found repair config
[ * ] Health check complete. Starting upgrade from 1.8.12 to 1.9.9...

[ - ] Now applying patches and updates for version v1.9.0...
PHP Fatal error:  Uncaught Error: Class "Symfony\Component\HtmlSanitizer\HtmlSanitizerConfig" not found in /usr/local/hestia/func/internal/sanitize_html.php:9
Stack trace:
#0 {main}
thrown in /usr/local/hestia/func/internal/sanitize_html.php on line 9
info: The user hestiamail' is already a member of hestia-users'.

[ - ] Now applying patches and updates for version v1.9.1...

[ - ] Now applying patches and updates for version v1.9.2...

[ - ] Now applying patches and updates for version v1.9.3...

[ - ] Now applying patches and updates for version v1.9.4...

[ - ] Now applying patches and updates for version v1.9.5...
[ * ] Fixing spamd execution in Exim when reject_spam is off
[ * ] Adding ESMTP to Exim smtp banner

[ - ] Now applying patches and updates for version v1.9.6...

[ - ] Now applying patches and updates for version v1.9.7...

[ - ] Now applying patches and updates for version v1.9.8...
[ * ] Fixing Subsystem sftp config
[ * ] Updating composer for users:
- admin...
[ + ] Fixing phpmyadmin.inc for Nginx

[ - ] Now applying patches and updates for version v1.9.9...
[ ! ] Updating default web domain templates...
[ ! ] Updating default mail domain templates...
[ ! ] Updating default DNS zone templates...
[ ! ] Upgrading File Manager to version 7.14.4...
[ ! ] Upgrading Roundcube to version 1.6.17...
[ ! ] Update Hestia PHP dependencies...
[ * ] Updating Cloudflare IP Ranges for NGINX...
[ * ] Upgrading phpMyAdmin to version 5.2.3...

Installation tasks complete, performing clean-up...

[ * ] Rebuilding user accounts and domains, this may take a few minutes...
- admin...
- sjordi...
[ * ] Restarting services...
Error: nginx restart failed

Upgrade complete! If you encounter any issues or find a bug,
please take a moment to report it to us on GitHub at the URL below:
https://github.com/hestiacp/hestiacp/issues

Read the release notes to learn about new fixes and features:
https://github.com/hestiacp/hestiacp/blob/release/CHANGELOG.md

We hope that you enjoy using this version of Hestia Control Panel,
have a wonderful day!

Sincerely,
The Hestia Control Panel development team

I rebooted the server and checked everything but none of my websites work :frowning:
All websites are running inside containers so I’m not sure all are affected by the nginx error since they embed their own nginx. But it might be related to all the certificates used in each, linked to all .tpl and.stpl?

Got two emails:
nginx: [emerg] unknown directive "proxy_passreverse" in /etc/nginx/conf.d/domains/budget.tiltsoft.com.ssl.conf:19
nginx: configuration file /etc/nginx/nginx.conf test failed

and

srv586445.hstgr.cloud has been upgraded from Hestia Control Panel v1.8.12 to v1.9.9.
Installation log: /root/hst_backups/100820261608/hst-upgrade-100820261608.log