Ubuntu has a snap service built in, but sometimes it is hard to kill when reboot or shutdown. If the progress cannot be killed easily, the system will handle some time (default value is 90s).
So one solution is to change the killing time for progress.
First, we need to have Administrator Permission on Linux. Execute the command:
sudo su
Then follow the message on the screen to enter your passwords.
Next, we need to edit the system files:
“Nano” is a text editor built in Ubuntu, so we can use it. Execute the command:
nano /etc/systemd/system.conf

Don’t be fear because you will find nearly all the text is blue. Why? Because they all comment out with “#” so that no line is effective for the system. What we need to do is uncomment a line and let that line affect.
Use your keyboard arrow keys to move the cursor down to find a line called:
#DefaultTimeoutStopSec=90s
Delete the # and change the time to 10s, like below:
DefaultTimeoutStopSec=10s
You’ll find the color becomes white because it will be effective for the system.
Then press your keyboard with Ctrl+X, and you will see the message on the screen to remind you to save changes. We press Y on the keyboard. Then it shows that you can change the file name, but we do nothing, just press Enter key directly.
Use cat command to see the contents of the edited file.
cat /etc/systemd/system.conf
If you are sure there is no error in that file, then you can reboot your system to see the effect, but maybe only the second time to reboot will see the effect. You will see the kill time when the shutdown will only be 10s. That’s fine.
To reboot quickly, use the command:
reboot
But why Snap cannot be stopped as usual? If you’re using Virtual Machine, I think the answer should be there: maybe the snap service in Ubuntu has a conflict with Virtual Machine software.
For example, while using VirtualBox, I just use the snapshot function to restore a snapshot for my Ubuntu server, and the conflict will be there. If you just use the console to normally shut down several times, the problem will be gone. To normally shut down, just close the VM window and choose the second option to shut down.
I have changed the system config to 10s once before but I have never seen stuck anymore after I normally shut down the machine.
Good luck to you!
Final solution
Ubuntu is based on Debian but worse than it. Although Ubuntu is very popular among developers, it’s still not a good option.
Ubuntu modifies Debian and preinstalls much software you needn’t. It will take too much RAM and cause trouble. Snap is one of them and causes too much trouble. Linux Mint, a popular Linux desktop distribution based on Ubuntu, disables Snap by default. Installing packages using apt is good enough.
If you feel apt doesn’t satisfy you, you can try to find .deb package. Much software, like Google Chrome and Visual Studio Code, will add its source to .deb package, so that after installing .deb packages, you can use apt update
and apt upgrade
to get the latest version. Also, you can use ppa to install and update the software. Read this article for reference: https://itsfoss.com/ppa-guide/
Also, Snap has a bad mechanism. Every software installed via Snap will account for too much space on your disk and update the software automatically. Software installed via Snap would have different file paths, which means it’s hard for you to find out anything, especially following tutorials written by others.
Switching Ubuntu to Debian would be a nice job, especially for server OS. But Debian also supports the desktop environment and it works better than Ubuntu. You can choose which desktop environment to use while installing Debian.
If you would like to use Desktop Linux and want to enjoy easy installation, out-of-box experience and best compatibility, try Linux Mint. Debian Desktop is suitable for those who want to go deep into Linux and have the skills to configure the system and solve strange problems. Even though I love Debian, I prefer Linux Mint as my daily desktop system. Linux Mint xfce edition takes much less hardware usage. It’s friendly to low-end PCs and Virtual Machines. Linux Mint has tweaked xfce theme and configuration so that it’s out-of-box and easy to use.
However, I found every Debian-based Linux distribution would have “processing triggers for man-db” problem. See the detail: https://jaylinwu.wordpress.com/2021/11/23/processing-triggers-for-man-db-takes-too-much-cpu-time-or-disk-io/
But except for the man-db problem, Debian is very good in my experience.