Page 1 of 1
[RESOLVED] Restores database
Published: October 7, 2026 - 3:50 PM
by ploubi
Hello,
During my attempt to update Debian 12 to 13 on my WAPT server, I messed up the database update and the cluster disappeared...
I do have the database dump, but I can't find the information in the documentation to recreate it (name, permissions, etc.).
Is this information available somewhere?
Thanks in advance.
Re: Restore the database
Published: October 7, 2026 - 4:01 PM
by dcardon
Hi Peyo,
You can draw inspiration from the documentation
https://www.wapt.fr/en/doc-2.7/wapt-ser ... html#linux
As mentioned, you need to verify that you are indeed using en_US.utf8 locale (this should be the case if you have correctly followed the initial installation documentation).
Something like the following should do the trick:
Code: Select all
cd /tmp
sudo -u postgres psql -c "drop database wapt"
sudo -u postgres psql -c "create database wapt with owner=wapt encoding='utf-8'"
sudo -u postgres psql < /tmp/backup_wapt.sql
Sincerely,
Denis
Re: Restore the database
Published: October 8, 2026 - 11:05 AM
by ploubi
THANKS,
But now I'm running into another problem.
It appears that the PostgreSQL service is no longer running
Code: Select all
urrugne@URR-DEB-WAPT:~$ sudo -u postgres psql -c "drop database wapt"
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
Is the server running locally and accepting connections on that socket?
urrugne@URR-DEB-WAPT:~$
Postgres has been successfully updated to version 17
Code: Select all
urrugne@URR-DEB-WAPT:~$ apt list --installed | grep postgresql
postgresql-17/stable,stable-security,now 17.11-0+deb13u1 amd64 [installed,automatic]
postgresql-client-17/stable,stable-security,now 17.11-0+deb13u1 amd64 [installed,automatic]
postgresql-client-common/stable,now 278 all [installed,automatic]
postgresql-common-dev/stable,now 278 all [installed,automatic]
postgresql-common/stable,now 278 all [installed,automatic]
postgresql/stable,now 17+278 all [installed]
urrugne@URR-DEB-WAPT:~$
When I try to restart the service, it exits immediately, but I don't see any error (and can't find any logs providing more details)
Code: Select all
urrugne@URR-DEB-WAPT:~$ ps -ef | grep sql
urrugne 2349 1038 0 10:41 pts/0 00:00:00 grep sql
urrugne@URR-DEB-WAPT:~$ sudo systemctl restart postgresql
urrugne@URR-DEB-WAPT:~$ sudo systemctl status postgresql
● postgresql.service - PostgreSQL RDBMS
Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; preset: enabled)
Active: active (exited) since Thu 2026-10-08 10:41:36 CEST; 2s ago
Invocation: 5deec630581644f7956fffef07df2e66
Process: 2355 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
Main PID: 2355 (code=exited, status=0/SUCCESS)
Mem peak: 1.7M
CPU: 8ms
Oct 08 10:41:36 URR-DEB-WAPT.ville-urrugne.fr systemd[1]: Starting postgresql.service - PostgreSQL RDBMS...
Oct 08 10:41:36 URR-DEB-WAPT.ville-urrugne.fr systemd[1]: Finished postgresql.service - PostgreSQL RDBMS.
urrugne@URR-DEB-WAPT:~$
I don't know what to do now...
Re: Restore database
Published: October 12, 2026 - 10:55 AM
by dcardon
Hi Peyo,
You do indeed need to reset the Postgres cluster beforehand. Performing a complete purge and reinstalling the Postgres server should re-instantiate it.
The only thing you need to be careful about is putting it in the right locale (having a bad locale isn't a deal-breaker, but it can cause some problems later on, especially if the instantiation was done with LANG=C).
Code: Select all
pg_createcluster 17 main --locale en_US.utf8
systemctl start postgresql
Sincerely,
Denis
Re: Restore database
Published: October 14, 2026 - 12:41
by ploubi
Thanks,
I had to recreate the wapt user too, but it's all good now, I was able to recreate the database.
However, something strange happened: after restarting the server, when I relaunched the WAPT console on my PC, the inventory was empty.
Now my workstations are gradually appearing in the inventory.
Okay, now that the OS is updated, I need to upgrade the Wapt server to version 2.7.
Re: Restore database
Published: October 14, 2026 - 2:58 PM
by dcardon
Hi Peyo,
you should check the SQL dump. Is there data in the hosts table or not? Inventory data is stored there. That said, the machine data will still be retrieved, as you can see. However, the audit history isn't included, and you'll have to wait for it to be retrieved.
To ensure you have at least the latest audit value on the server, you can force an inventory from the console.
Best regards,
Denis
Re: Restore database
Published: October 15, 2026 - 10:33
by ploubi
Thanks,
I did a bit of digging in the dump, but apart from the table creation, I didn't find anything.
But then again, I don't know the structure of a dump and can't recognize the format of an insert; these aren't simple INSERT commands, it seems.
Two-thirds of the PCs are already back online; I trust the server to find everything as it goes.
We can say the problem is solved.