Maas Failure to Run

Please help with the following maas failure. I have got no clue as to why the maas service won’t start. please help.

root@maas:~# snap list
Name          Version                 Rev    Tracking       Publisher   Notes
core18        20210128                1988   latest/stable  canonical✓  base
core20        20201210                904    latest/stable  canonical✓  base
maas          2.9.2-9164-g.ac176b5c4  11851  2.9/stable     canonical✓  -
maas-cli      0.6.5                   13     latest/stable  canonical✓  -
maas-test-db  12.4-17-g.9e70484       53     2.9/stable     canonical✓  -
snapd         2.49.1                  11402  latest/stable  canonical✓  snapd
root@maas:~# maas config
Mode: region+rack
Settings:
maas_url=http://10.49.210.148:5240/MAAS
database_host=/var/snap/maas/common/test-db-socket
database_port=None
database_name=maasdb
database_user=maas
database_pass=(hidden)
root@maas:~# maas status
unix:///var/snap/maas/11851/supervisord/sock no such file
root@maas:~# netstat -an | grep "LISTEN "
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN     
tcp6       0      0 :::22                   :::*                    LISTEN

Could you please check both the journal log (sudo journalctl -ef -u snap.maas.supervisor) and supervisord log (/var/snap/maas/current/supervisord/supervisord.log) for errors and paste what you find?

Here is the output from the first (journalctl -ef -u snap.maas.supervisor)

. . .
– Reboot –
Mar 30 14:16:15 maas systemd[1]: Started Service for snap application maas.supervisor.
Mar 30 14:16:15 maas maas.supervisor[3651]: cannot write to fd 11: Operation not permitted
Mar 30 14:16:15 maas systemd[1]: snap.maas.supervisor.service: Main process exited, code=exited, status=1/FAILURE
Mar 30 14:16:15 maas systemd[1]: snap.maas.supervisor.service: Failed with result ‘exit-code’.
Mar 30 14:16:15 maas systemd[1]: snap.maas.supervisor.service: Scheduled restart job, restart counter is at 1.
Mar 30 14:16:15 maas systemd[1]: Stopped Service for snap application maas.supervisor.
Mar 30 14:16:15 maas systemd[1]: Started Service for snap application maas.supervisor.
Mar 30 14:16:15 maas maas.supervisor[3677]: cannot write to fd 11: Operation not permitted
Mar 30 14:16:15 maas systemd[1]: snap.maas.supervisor.service: Main process exited, code=exited, status=1/FAILURE
Mar 30 14:16:15 maas systemd[1]: snap.maas.supervisor.service: Failed with result ‘exit-code’.
Mar 30 14:16:15 maas systemd[1]: snap.maas.supervisor.service: Scheduled restart job, restart counter is at 2.
Mar 30 14:16:15 maas systemd[1]: Stopped Service for snap application maas.supervisor.
Mar 30 14:16:15 maas systemd[1]: Started Service for snap application maas.supervisor.
Mar 30 14:16:15 maas maas.supervisor[3700]: cannot write to fd 11: Operation not permitted
Mar 30 14:16:15 maas systemd[1]: snap.maas.supervisor.service: Main process exited, code=exited, status=1/FAILURE
Mar 30 14:16:15 maas systemd[1]: snap.maas.supervisor.service: Failed with result ‘exit-code’.
Mar 30 14:16:16 maas systemd[1]: snap.maas.supervisor.service: Scheduled restart job, restart counter is at 3.
Mar 30 14:16:16 maas systemd[1]: Stopped Service for snap application maas.supervisor.
Mar 30 14:16:16 maas systemd[1]: Started Service for snap application maas.supervisor.
Mar 30 14:16:16 maas maas.supervisor[3723]: cannot write to fd 11: Operation not permitted
Mar 30 14:16:16 maas systemd[1]: snap.maas.supervisor.service: Main process exited, code=exited, status=1/FAILURE
Mar 30 14:16:16 maas systemd[1]: snap.maas.supervisor.service: Failed with result ‘exit-code’.
Mar 30 14:16:16 maas systemd[1]: snap.maas.supervisor.service: Scheduled restart job, restart counter is at 4.
Mar 30 14:16:16 maas systemd[1]: Stopped Service for snap application maas.supervisor.
Mar 30 14:16:16 maas systemd[1]: Started Service for snap application maas.supervisor.
Mar 30 14:16:16 maas maas.supervisor[3749]: cannot write to fd 11: Operation not permitted
Mar 30 14:16:16 maas systemd[1]: snap.maas.supervisor.service: Main process exited, code=exited, status=1/FAILURE
Mar 30 14:16:16 maas systemd[1]: snap.maas.supervisor.service: Failed with result ‘exit-code’.
Mar 30 14:16:16 maas systemd[1]: snap.maas.supervisor.service: Scheduled restart job, restart counter is at 5.
Mar 30 14:16:16 maas systemd[1]: Stopped Service for snap application maas.supervisor.
Mar 30 14:16:16 maas systemd[1]: snap.maas.supervisor.service: Start request repeated too quickly.
Mar 30 14:16:16 maas systemd[1]: snap.maas.supervisor.service: Failed with result ‘exit-code’.
Mar 30 14:16:16 maas systemd[1]: Failed to start Service for snap application maas.supervisor.

Here is the output from the second (/var/snap/maas/current/supervisord/supervisord.log
< file not present >

First lines of (/var/snap/maas/current/supervisord/supervisord.conf
root@maas:~# cat /var/snap/maas/current/supervisord/supervisord.conf
[unix_http_server]
file=%(ENV_SNAP_DATA)s/supervisord/sock
chown=root
chmod=600

[rpcinterface:supervisor]
supervisor.rpcinterface_factory=supervisor.rpcinterface:make_main_rpcinterface

[supervisord]
directory=%(here)s
logfile=%(here)s/supervisord.log
pidfile=%(here)s/supervisord.pid
user=root

[supervisorctl]
serverurl=unix://%(ENV_SNAP_DATA)s/supervisord/sock

[program:regiond]
process_name=regiond
command=%(ENV_SNAP)s/bin/run-regiond
stopasgroup=true
killasgroup=true
redirect_stderr=true
stdout_logfile=%(ENV_SNAP_COMMON)s/log/regiond.log
serverurl=unix://%(ENV_SNAP_DATA)s/supervisord/sock
startsecs=10
[program:rackd]
process_name=rackd
command=%(ENV_SNAP)s/bin/run-rackd
stopasgroup=true
killasgroup=true
redirect_stderr=true
stdout_logfile=%(ENV_SNAP_COMMON)s/log/rackd.log
serverurl=unix://%(ENV_SNAP_DATA)s/supervisord/sock
startsecs=10

. . .

**root@maas:~#** cat /etc/systemd/system/snap.maas.supervisor.service 
[Unit]
# Auto-generated, DO NOT EDIT
Description=Service for snap application maas.supervisor
Requires=snap-maas-11851.mount
Wants=network.target
After=snap-maas-11851.mount network.target snapd.apparmor.service
X-Snappy=yes

[Service]
EnvironmentFile=-/etc/environment
ExecStart=/usr/bin/snap run maas.supervisor
SyslogIdentifier=maas.supervisor
Restart=on-failure
WorkingDirectory=/var/snap/maas/11851
TimeoutStopSec=30
Type=simple

[Install]
WantedBy=multi-user.target

**root@maas:~#** systemctl status snap-maas-11851.mount
● snap-maas-11851.mount - Mount unit for maas, revision 11851
     Loaded: loaded (/proc/self/mountinfo; enabled; vendor preset: enabled)
    Drop-In: /run/systemd/generator/snap-maas-11851.mount.d
             └─container.conf
     Active: active (mounted) since Tue 2021-03-30 16:26:32 UTC; 22min ago
      Where: /snap/maas/11851
       What: snapfuse
      Tasks: 1 (limit: 154328)
     Memory: 1.3M
     CGroup: /system.slice/snap-maas-11851.mount
             └─3301 snapfuse /var/lib/snapd/snaps/maas_11851.snap /snap/maas/11851 -o ro,nodev,allow_other,suid

Mar 30 16:26:32 maas systemd[1]: Mounting Mount unit for maas, revision 11851...
Mar 30 16:26:32 maas systemd[1]: Mounted Mount unit for maas, revision 11851.

**root@maas:~#** /usr/bin/snap run maas.supervisor
cannot write to fd 11: Operation not permitted

**root@maas:~#**  systemctl status network.target
● network.target - Network
     Loaded: loaded (/lib/systemd/system/network.target; static; vendor preset: disabled)
     Active: active since Tue 2021-03-30 16:19:45 UTC; 33min ago
       Docs: man:systemd.special(7)
             https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget

Mar 30 16:19:45 maas systemd[1]: Reached target Network.

**root@maas:~#** systemctl status snapd.apparmor.service
● snapd.apparmor.service - Load AppArmor profiles managed internally by snapd
     Loaded: loaded (/lib/systemd/system/snapd.apparmor.service; enabled; vendor preset: enabled)
     Active: active (exited) since Tue 2021-03-30 16:19:44 UTC; 35min ago
   Main PID: 436 (code=exited, status=0/SUCCESS)
      Tasks: 0 (limit: 154328)
     Memory: 0B
     CGroup: /system.slice/snapd.apparmor.service

Mar 30 16:19:44 maas systemd[1]: Starting Load AppArmor profiles managed internally by snapd...
Mar 30 16:19:44 maas snapd-apparmor[436]: /usr/lib/snapd/snapd-apparmor: 47: ns_stacked: not found
Mar 30 16:19:44 maas snapd-apparmor[436]: /usr/lib/snapd/snapd-apparmor: 48: ns_name: not found
Mar 30 16:19:44 maas systemd[1]: Finished Load AppArmor profiles managed internally by snapd.

> **root@maas:~#** /usr/bin/snap run maas.supervisor
> cannot write to fd 11: Operation not permitted
Summary

This text will be hidden
root@maas:~# /usr/bin/snap run maas.supervisor
cannot write to fd 11: Operation not permitted

I wonder if this is just a permission error (not sure how that would happen).
Does ownership/mode for the supervisord dir match the following on your install?

$ ls -lad  /var/snap/maas/current/supervisord
drwxr-xr-x 1 root root 100 Mar 30 09:55 /var/snap/maas/current/supervisord

root@maas:~# ls -lad /var/snap/maas/current/supervisord
drwxr-xr-x 2 root root 4096 Mar 30 16:27 /var/snap/maas/current/supervisord
root@maas:~# ls -la /var/snap/maas/current/supervisord
total 12
drwxr-xr-x 2 root root 4096 Mar 30 16:27 .
drwxr-xr-x 5 root root 4096 Mar 30 16:29 …
-rw-r–r-- 1 root root 2238 Mar 30 16:29 supervisord.conf

What exactly is the 11th file descriptor opened by mass.supervisor? Is this the unix domain socket that cannot be found? unix:///var/snap/maas/11851/supervisord/sock?