596. Debian Jessie -- shutdown takes 'forever' (five minutes according to stopwatch!)

I've been annoyed for a couple of months now that shutting down my laptop, which has an SSD, takes up to five minutes. If I wanted that kind of shutdown times I could run Windows Vista...

Either way, it turns out that it's affecting certain systems with samba:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=762002

The issue is illustrated below, which showed that it took five minutes to shut down samba -- and that's what's preventing the system from shutting down:
 
sudo service samba stop
ps aux|grep sam && date

root 2765 0.0 0.0 65468 2100 pts/0 S+ 10:45 0:00 sudo service samba stop
root 2766 0.0 0.0 26252 1172 pts/0 S+ 10:45 0:00 systemctl stop samba.service
root 2785 0.0 0.0 4308 636 ? Ss 10:45 0:00 /bin/sh /etc/init.d/samba stop
Sunday 12 October 10:49:28 AEDT 2014

The solution is pretty simple though -- remove a set of symlinks:

First establish that they are present:
me@oxygen:/etc$ find rc* -name "*samba*"|xargs -I {} ls {} -lah
lrwxrwxrwx 1 root root 15 Sep 16 2013 rc0.d/K01samba -> ../init.d/samba
lrwxrwxrwx 1 root root 21 Sep 15 10:46 rc0.d/K01samba-ad-dc -> ../init.d/samba-ad-dc
lrwxrwxrwx 1 root root 15 Sep 16 2013 rc1.d/K01samba -> ../init.d/samba
lrwxrwxrwx 1 root root 21 Sep 15 10:46 rc1.d/K01samba-ad-dc -> ../init.d/samba-ad-dc
lrwxrwxrwx 1 root root 15 Sep 16 2013 rc2.d/S01samba -> ../init.d/samba
lrwxrwxrwx 1 root root 21 Sep 15 10:46 rc2.d/S01samba-ad-dc -> ../init.d/samba-ad-dc
lrwxrwxrwx 1 root root 15 Sep 16 2013 rc3.d/S01samba -> ../init.d/samba
lrwxrwxrwx 1 root root 21 Sep 15 10:46 rc3.d/S01samba-ad-dc -> ../init.d/samba-ad-dc
lrwxrwxrwx 1 root root 15 Sep 16 2013 rc4.d/S01samba -> ../init.d/samba
lrwxrwxrwx 1 root root 21 Sep 15 10:46 rc4.d/S01samba-ad-dc -> ../init.d/samba-ad-dc
lrwxrwxrwx 1 root root 15 Sep 16 2013 rc5.d/S01samba -> ../init.d/samba
lrwxrwxrwx 1 root root 21 Sep 15 10:46 rc5.d/S01samba-ad-dc -> ../init.d/samba-ad-dc
lrwxrwxrwx 1 root root 15 Sep 16 2013 rc6.d/K01samba -> ../init.d/samba
lrwxrwxrwx 1 root root 21 Sep 15 10:46 rc6.d/K01samba-ad-dc -> ../init.d/samba-ad-dc

Then remove them:
me@oxygen:/etc$ sudo update-rc.d samba remove 
me@oxygen:/etc$ sudo update-rc.d smbd remove
Done!
Previous
Next Post »