Snap.d error: cannot communicate with server connection refused

Based on other threads I’ve found that for some it might be SELinux related. For this I needed to add the following:

Frist create a module:

cat <<EOF >snapd-selinux.te
module snapd-selinux 1.0;

require {
  type timedatex_t;
  type snappy_t;
  class dbus send_msg;
}

#============= snappy_t ==============
allow snappy_t timedatex_t:dbus send_msg;

#============= timedatex_t ==============
allow timedatex_t snappy_t:dbus send_msg;
EOF

Then run:

checkmodule -M -m -o snapd-selinux.mod snapd-selinux.te

And:

semodule_package -o snapd-selinux.pp -m snapd-selinux.mod

And:

semodule -i snapd-selinux.pp

After this you should be able to restart:

systemctl restart snapd snapd.socket