What is snapcraft/snap ?

If you updated to Ubuntu 20.4, you have now Snap coming with it.

Snap is a new way to install and manage the application on your system. Instead of having access to your whole system, the app is launched into a “jail”. The jail is configurable by the developer to have access to your machine.

It’s great for security, and the packaging is easier for the developer.

The problem

It takes forever to stop when shutdown your system, and most of the time it seems systemd kill the service.

I haven’t been able to find why.

Solution

Create an override file for the system service to reduce the timeout, instead of 1m30s, reduce it to 10s.

Use systemd to edit the override file.

sudo systemctl edit snapd.service

Set the timeout in the file.

[Service]
TimeoutSec=10

Just restart the service and you’re good to go.

sudo systemctl restart snapd.service