snap restore breaks sudo snap commands

Bug #2012615 reported by Natalia Litvinova
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
snapd
New
Undecided
Unassigned

Bug Description

I was following these instructions https://maas.io/docs/how-to-back-up-maas for MAAS backup and restore. And after the snapshot restore MAAS becomes unavailable. When I try running:

sudo maas config --show --show-database-password
cannot create user data directory: /root/snap/maas/25850: No such file or directory

But at the same time this command works:

sudo snap run --shell maas -c true; echo $?
cannot create user data directory: /root/snap/maas/25850: No such file or directory
1

The folder does exist:
sudo ls -l /root/snap/maas
total 8
drwxr-xr-x 2 root root 4096 Mar 16 09:45 25850
drwxr-xr-x 2 root root 4096 Mar 14 18:50 common
lrwxrwxrwx 1 root root 5 Feb 27 09:31 current -> 25850

This command hangs indefinitely:

sudo apparmor_parser

journalctl output is here: https://pastebin.canonical.com/p/KNYCnKFC48/
maas.cli apparmor profile: https://pastebin.canonical.com/p/d2NHvgsvwW/
maas.maas apparmor profile: https://pastebin.canonical.com/p/n9SkTxNBJN/
maas.supervisor apparmor profile: https://pastebin.canonical.com/p/4fDwZYrYWW/

Workaround:
After rebooting the MAAS machine it becomes alive and the command runs:
$ sudo maas config --show --show-database-password
Mode: region+rack
Settings:
maas_url=http://localhost:5240/MAAS/
database_host=localhost
database_port=None
database_name=maas
database_user=<REDACTED>
database_pass=<REDACTED>

Steps to reproduce:

sudo -u postgres pg_dumpall -c > ~/dump.sql
sudo systemctl stop postgresql.service
sudo snap save maas
sudo snap remove --purge maas
sudo systemctl start postgresql.service
sudo -u postgres psql -f dump.sql postgres
sudo snap restore <snapshot-id>
sudo maas config --show --show-database-password

Revision history for this message
Michael Vogt (mvo) wrote :

Uh, super sorry about the slow reply and also about the incorrect "apparmor_parsr" question - this should have been "apparmor_status".

Revision history for this message
Chengen Du (chengendu) wrote :

The issue and a potential fix are detailed in: https://github.com/snapcore/snapd/pull/13303

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.