Snapd fails to start `panic: assignment to entry in nil map`

This morning I was tinkering with LXD snap and attempting to enable shiftfs with the following snap set lxd shiftfs.enable=true which eventually failed with error: cannot communicate with server: Get "http://localhost/v2/changes/184": dial unix /run/snapd.socket: connect: connection refused.

● snapd.service - Snap Daemon
     Loaded: loaded (/usr/lib/systemd/system/snapd.service; enabled; vendor preset: disabled)
     Active: failed (Result: exit-code) since Wed 2021-03-17 11:20:31 EDT; 15min ago
TriggeredBy: ● snapd.socket
    Process: 14349 ExecStart=/usr/libexec/snapd/snapd (code=exited, status=2)
   Main PID: 14349 (code=exited, status=2)

Mar 17 11:20:31 linux-iqu9 systemd[1]: snapd.service: Scheduled restart job, restart counter is at 5.
Mar 17 11:20:31 linux-iqu9 systemd[1]: Stopped Snap Daemon.
Mar 17 11:20:31 linux-iqu9 systemd[1]: snapd.service: Start request repeated too quickly.
Mar 17 11:20:31 linux-iqu9 systemd[1]: snapd.service: Failed with result 'exit-code'.
Mar 17 11:20:31 linux-iqu9 systemd[1]: Failed to start Snap Daemon.
Mar 17 11:20:31 linux-iqu9 systemd[1]: snapd.service: Triggering OnFailure= dependencies.

Which now refuses to start:

AppArmor status: apparmor is enabled but some kernel features are missing: dbus, network
2021/03/17 11:38:45.553940 patch.go:64: Patching system state level 6 to sublevel 1...
2021/03/17 11:38:45.565885 patch.go:64: Patching system state level 6 to sublevel 2...
2021/03/17 11:38:45.575843 patch.go:64: Patching system state level 6 to sublevel 3...
2021/03/17 11:38:45.597315 daemon.go:347: started snapd/2.49-1.12 (series 16; classic; devmode) opensuse-tumbleweed/20210219 (amd64) linux/5.11.2-1-default.
2021/03/17 11:38:45.703533 daemon.go:440: adjusting startup timeout by 1m55s (pessimistic estimate of 30s plus 5s per snap)
2021/03/17 11:38:46.983230 stateengine.go:150: state ensure error: cannot sections: got unexpected HTTP status code 403 via GET to "https://api.snapcraft.io/api/v1/snaps/sections"
panic: assignment to entry in nil map

goroutine 28 [running]:
github.com/snapcore/snapd/overlord/configstate/config.applyChanges(0x0, 0xc0008ab230)
        /home/abuild/rpmbuild/BUILD/snapd-2.49/gopath/src/github.com/snapcore/snapd/overlord/configstate/config/transaction.go:306 +0x146
github.com/snapcore/snapd/overlord/configstate/config.(*Transaction).Commit(0xc00055fa80)
        /home/abuild/rpmbuild/BUILD/snapd-2.49/gopath/src/github.com/snapcore/snapd/overlord/configstate/config/transaction.go:293 +0x1f4
github.com/snapcore/snapd/overlord/configstate.ContextTransaction.func1(0x4500000003, 0x7467fef0971e)
        /home/abuild/rpmbuild/BUILD/snapd-2.49/gopath/src/github.com/snapcore/snapd/overlord/configstate/hooks.go:53 +0x35
github.com/snapcore/snapd/overlord/hookstate.(*Context).Done(0xc0001dd960, 0x0, 0x0)
        /home/abuild/rpmbuild/BUILD/snapd-2.49/gopath/src/github.com/snapcore/snapd/overlord/hookstate/context.go:264 +0x84
github.com/snapcore/snapd/overlord/hookstate.(*HookManager).runHook(0xc0004961e0, 0xc0001dd960, 0xc0004e4700, 0xc000822400, 0xc000715d10, 0x0, 0x0)
        /home/abuild/rpmbuild/BUILD/snapd-2.49/gopath/src/github.com/snapcore/snapd/overlord/hookstate/hookmgr.go:416 +0x650
github.com/snapcore/snapd/overlord/hookstate.(*HookManager).runHookForTask(0xc0004961e0, 0xc0003d2c60, 0xc000715d10, 0xc0004e4700, 0xc000822400, 0x0, 0x0)
        /home/abuild/rpmbuild/BUILD/snapd-2.49/gopath/src/github.com/snapcore/snapd/overlord/hookstate/hookmgr.go:312 +0xba
github.com/snapcore/snapd/overlord/hookstate.(*HookManager).doRunHook(0xc0004961e0, 0xc0003d2c60, 0xc000715d10, 0x228f178, 0x7467f72ccb0b)
        /home/abuild/rpmbuild/BUILD/snapd-2.49/gopath/src/github.com/snapcore/snapd/overlord/hookstate/hookmgr.go:264 +0x168
github.com/snapcore/snapd/overlord/state.(*TaskRunner).run.func1(0x0, 0x0)
        /home/abuild/rpmbuild/BUILD/snapd-2.49/gopath/src/github.com/snapcore/snapd/overlord/state/taskrunner.go:203 +0xe3
github.com/snapcore/snapd/vendor/gopkg.in/tomb%2ev2.(*Tomb).run(0xc000715d10, 0xc00083e030)
        /home/abuild/rpmbuild/BUILD/snapd-2.49/gopath/src/github.com/snapcore/snapd/vendor/gopkg.in/tomb.v2/tomb.go:163 +0x3a
created by github.com/snapcore/snapd/vendor/gopkg.in/tomb%2ev2.(*Tomb).Go
        /home/abuild/rpmbuild/BUILD/snapd-2.49/gopath/src/github.com/snapcore/snapd/vendor/gopkg.in/tomb.v2/tomb.go:159 +0xbc

I’m not sure the failure to retrieve contents from https://api.snapcraft.io/api/v1/snaps/sections is the reason for snapd to be stumbling itself, which would mean there’s a hard dependency. What would be the workaround to returning to a working snapd?

Distro: OpenSUSE Tumbleweed

I took the initiative and reported a bug @ https://bugs.launchpad.net/snapd/+bug/1919504. It seems to me, I would have to purge all my snaps and snapd itself. Unfortuantely, common recipes won’t work, as they assume you have a working snapd.

Found this solution: Cannot delete snapd directory