Ubuntu has a snap service built in, sometimes it is hard to kill when reboot or shutdown. If the progress cannot be killed easily, system will handle some time (default value is 90s).
So one solution is change the killing time for progress.
First, we need to have Administrator Permission on Linux. Execute the command:
Then follow the message on screen to enter your passwords.
Next we need to edit system files:
“Nano” is a text editor built in Ubuntu, so we can use it. Execute the command:
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 effect.
Use your keyboard arrow keys to move cursor down to find a line called:
Delete the # and change the time to be 10s, like below:
You’ll find the color becomes white because it will be effective for the system.
Then press your keyboard with Ctrl+X, 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.
If you are sure there is no error of that file, then you can reboot your system to see the effect, but may be only the second time to reboot will see the effect. You will see the kill time when shutdown will only be 10s. That’s fine.
To reboot quickly, use command:
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 conflict with Virtual Machine software.
For example, while using VirtualBox, I just use snapshot function restored a snapshot for my Ubuntu server, 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 any more after I normally shut down the machine.
Good luck to you!