How to fix: ubuntu 16.04 hangs (or very slow) on shutdown (or on reboot). Also fix persistent journald

 If you are experiencing problems during reboot/shutdown then most probably you have CUPSD installed or you have custom DE. If you also can't read journald logs of previous boots then most probably you have separate partition for
/var.
  1. To fix persistent journal: add option auto to mount options of /var. Example:
    /dev/sdb2    /var    ext4    defaults,auto, noatime    0 2
    

    Why problem happend:
    systemd-journal-flush.service starts before var.mount (you can check this with (systemd-journal-flush.service)
  2. When you have fixed logging problems you can now check what processes are causing problems during reboot:
    sudo journalctl -b-1|grep 'Stopped'
    
    Examine event timing of stopped processes and you will get insight on what's causing problems during reboot
  3. If you have problems with CUPSD then you can try disabling Browsing for cups: In file /etc/cups/cupsd.conf disable browsing and protocols:
    Browsing Off
    BrowseLocalProtocols none
    
    In file /etc/cups/cups-browsed.conf disable all protocols:
    BrowseRemoteProtocols none
  4. If yoyu still have problems then delete systemd tune shutdown/reboot settings:
    • Kill stale processes faster. To do this edit file /etc/systemd/system.conf:
      [Manager]
      DefaultTimeoutStopSec=5s
      
    • Autokill user processes when user exits (not good for tmux and similar software). To do this edit file /etc/systemd/user.conf:
      [Manager]
      KillUserProcesses=Yes