for backing up and restoring the PostgreSQL DB. I used:
sudo -u postgres pg_dump maas_db -c > “backup/$(date +%s)_maas_dump.sql”
and
sudo -u postgres psql maas_db < /home/ubuntu/backup/$(unix date)_maas_dump.sql
That one actually worked for me, because previously I was having permission issues with the procedure presented in the docs.
but for restoring the snap maas, it is where I am having issues. True we need to reinstall maas before running restore, like mentioned here: Issue restoring from backup
Still, when restarts maas it does not remain active
$ sudo snap services maas
Service Startup Current Notes
maas.supervisor enabled inactive -
$ sudo snap logs maas
2025-08-20T06:44:57Z systemd[1]: Stopped Service for snap application maas.supervisor.
2025-08-20T06:44:57Z systemd[1]: Started Service for snap application maas.supervisor.
2025-08-20T06:44:57Z maas.supervisor[86775]: cannot create user data directory: /root/snap/maas/39713: No such file or directory
2025-08-20T06:44:57Z systemd[1]: snap.maas.supervisor.service: Main process exited, code=exited, status=1/FAILURE
2025-08-20T06:44:57Z systemd[1]: snap.maas.supervisor.service: Failed with result 'exit-code'.
2025-08-20T06:44:57Z systemd[1]: snap.maas.supervisor.service: Scheduled restart job, restart counter is at 5.
2025-08-20T06:44:57Z systemd[1]: Stopped Service for snap application maas.supervisor.
2025-08-20T06:44:57Z systemd[1]: snap.maas.supervisor.service: Start request repeated too quickly.
2025-08-20T06:44:57Z systemd[1]: snap.maas.supervisor.service: Failed with result 'exit-code'.
2025-08-20T06:44:57Z systemd[1]: Failed to start Service for snap application maas.supervisor.
Does anyone have the correct procedure for backing up and restoring MAAS? ( that is not the one presented on the official documentation )
On sudo snap install --channel=3.4/stable maas I noticed MAAS is not configured if I run maas status and after sudo snap restore it is when i cannot (re)start maas again.
What if you run sudo snap install --revision <revision-number-from-backup> instead, during the restoration? This will bring you from snapstore the same revision as the one present in the snapshot. --channel 3.4/stable will bring the latest revision available in 3.4/stable channel, which at the moment is 39713 for amd64.
ubuntu@poc-1:~$ sudo snap services maas
Service Startup Current Notes
maas.supervisor enabled active -
but,
$ sudo maas status
cannot create user data directory: /root/snap/maas/39713: No such file or directory
( be aware of this:
sudo ls -l /root/snap/maas/
total 8
drwxr-xr-x 2 root root 4096 Aug 22 11:53 39713
drwxr-xr-x 2 root root 4096 Aug 22 11:53 common
lrwxrwxrwx 1 root root 5 Aug 22 12:10 current -> 39713
ubuntu@poc-1:~$ sudo snap logs maas
2025-08-22T12:14:02Z systemd[1]: Stopped Service for snap application maas.supervisor.
2025-08-22T12:14:02Z systemd[1]: Started Service for snap application maas.supervisor.
2025-08-22T12:14:02Z maas.supervisor[7326]: cannot create user data directory: /root/snap/maas/39713: No such file or directory
2025-08-22T12:14:02Z systemd[1]: snap.maas.supervisor.service: Main process exited, code=exited, status=1/FAILURE
2025-08-22T12:14:02Z systemd[1]: snap.maas.supervisor.service: Failed with result 'exit-code'.
2025-08-22T12:14:02Z systemd[1]: snap.maas.supervisor.service: Scheduled restart job, restart counter is at 5.
2025-08-22T12:14:02Z systemd[1]: Stopped Service for snap application maas.supervisor.
2025-08-22T12:14:02Z systemd[1]: snap.maas.supervisor.service: Start request repeated too quickly.
2025-08-22T12:14:02Z systemd[1]: snap.maas.supervisor.service: Failed with result 'exit-code'.
2025-08-22T12:14:02Z systemd[1]: Failed to start Service for snap application maas.supervisor.
No,
After running maas snap restore, it does not restore the maas snap correctly
The log says it cannot find directory /root/snap/maas/
when it actually exists
Interesting that re-starting MAAS after some downtime seems to have fixed it. I wonder if there’s some long running process that didn’t complete in time for your first MAAS restart?
Aug 28 08:45:40 poc-1 systemd[1]: Stopped PostgreSQL RDBMS.
Aug 28 08:45:40 poc-1 systemd[1]: Stopping PostgreSQL RDBMS...
Aug 28 08:45:40 poc-1 systemd[1]: Stopping PostgreSQL Cluster 17-main...
Aug 28 08:45:45 poc-1 systemd[1]: postgresql@17-main.service: Deactivated successfully.
Aug 28 08:45:45 poc-1 systemd[1]: Stopped PostgreSQL Cluster 17-main.
Aug 28 08:45:45 poc-1 systemd[1]: postgresql@17-main.service: Consumed 7min 19.342s CPU time.
Aug 28 08:45:45 poc-1 systemd[1]: Starting PostgreSQL Cluster 17-main...
Aug 28 08:45:47 poc-1 systemd[1]: Started PostgreSQL Cluster 17-main.
Aug 28 08:45:47 poc-1 systemd[1]: Starting PostgreSQL RDBMS...
Aug 28 08:45:47 poc-1 systemd[1]: Finished PostgreSQL RDBMS.
Aug 28 08:45:47 poc-1 systemd[1]: Started Service for snap application maas.supervisor.
Aug 28 08:45:48 poc-1 maas.supervisor[203920]: cannot create user data directory: /root/snap/maas/39713: No such file or directory
Aug 28 08:45:48 poc-1 systemd[1]: snap.maas.supervisor.service: Main process exited, code=exited, status=1/FAILURE
Aug 28 08:45:48 poc-1 systemd[1]: snap.maas.supervisor.service: Failed with result 'exit-code'.
Aug 28 08:45:48 poc-1 systemd[1]: snap.maas.supervisor.service: Scheduled restart job, restart counter is at 1.