Recently a very annoying and old problem resurfaced in Ubuntu 16.04 which causes the system to hang or freeze completely doing a restart and/or shutdown. I have been trying to fix the problem on/off for the last weak, and I finally seem to have found a solution.
I suspect the problem mainly affects systems installed through the minimal iso file, but I have been unable to confirm this. The reason I think this is the case, is because my old installation, from the full version, was running fine until I decided to re-install on my new SSD with the mini.iso file.
The way I fixed the problem on my current system, was by installing the KDE desktop. I suspect that the problem might be caused by the Gnome Display Manager (GDM), and changing to a different display manager might solve the problem.
Versions of Ubuntu affected
It seems that just about all recent versions of Ubuntu can be affected by this problem. I first tried fixing the problem by installing pre-released updates, thinking that maybe one of the proposed updates would fix it. When this did not work, I even broke my own rule of always using the LTS version, and installed 17.04. This also did not work.
I am now running Ubuntu 17.04 (Zesty Zapus), with the KDE desktop. Installing KDE happened to fix the problem for some reason. I suspect that choosing KDE's display manager (SDDM) was what solved the problem, but I am not entirely sure.
To install the KDE desktop, simply run the below command in a terminal:
sudo apt install kubuntu-desktop
You can also try to install SDDM, to see if this will solve the problem for you.
sudo apt-get install sddm
Doing this will prompt you to choose a display manager. You can always change your desktop or display manager later if you wish to.