17 October 2014

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!

10 October 2014

595. Issue upgrading debian jessie -- stuck at systemd

Doing a dist-upgrade yesterday (9th of October 2014) it failed because of issues with configuring systemd. In the end my troubleshooting didn't help, but google did.

Dead-end troubleshooting:

Trying to work through it:
sudo apt-get dist-upgrade Reading package lists... Done Building dependency tree Reading state information... Done You might want to run 'apt-get -f install' to correct these. The following packages have unmet dependencies: systemd-sysv : Depends: systemd (= 208-8) but 215-5+b1 is installed E: Unmet dependencies. Try using -f.
Checking why systemd-sysv is mentioning 208-8 instead of 215-5:
apt-cache policy systemd-sysv systemd-sysv: Installed: 208-8 Candidate: 215-5+b1 Version table: 215-5+b1 0 500 http://ftp.iinet.net.au/debian/debian/ testing/main amd64 Packages *** 208-8 0 100 /var/lib/dpkg/status
Let's try forcing 215-5:
sudo apt-get install systemd-sysv=215-5+b1 Reading package lists... Done Building dependency tree Reading state information... Done [..] The following packages will be upgraded: systemd-sysv 1 upgraded, 0 newly installed, 0 to remove and 531 not upgraded. 422 not fully installed or removed. Need to get 0 B/29.1 kB of archives. After this operation, 3,072 B of additional disk space will be used. Retrieving bug reports... Done Parsing Found/Fixed information... Done Setting up systemd (215-5+b1) ... dpkg: error processing package systemd (--configure): subprocess installed post-installation script returned error exit status 1 Errors were encountered while processing: systemd E: Sub-process /usr/bin/dpkg returned an error code (1)
OK, let's try working on systemd:
sudo dpkg -D2 --configure systemd Setting up systemd (215-5+b1) ... D000002: fork/exec /var/lib/dpkg/info/systemd.postinst ( configure 208-8 ) dpkg: error processing package systemd (--configure): subprocess installed post-installation script returned error exit status 1 Errors were encountered while processing: systemd

Solving it:
No luck. Google wasn't too helpful initially, until I came across https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=762275
sudo delgroup systemd-journal Removing group `systemd-journal' ... Done.
Then tried
sudo dpkg -D2 --configure systemd Setting up systemd (215-5+b1) ... D000002: fork/exec /var/lib/dpkg/info/systemd.postinst ( configure 208-8 ) /var/lib/dpkg/info/systemd.postinst: 128: /var/lib/dpkg/info/systemd.postinst: cannot open /run/systemd/was-enabled: No such file
and
sudo apt-get install -f [..] Do you want to continue? [Y/n] Y Retrieving bug reports... Done Parsing Found/Fixed information... Done (Reading database ... 462023 files and directories currently installed.) Preparing to unpack .../systemd-sysv_215-5+b1_amd64.deb ... Unpacking systemd-sysv (215-5+b1) over (208-8) ... Processing triggers for man-db (2.6.7.1-1) ... Setting up systemd-sysv (215-5+b1) ... [..]
and then
sudo apt-get dist-upgrade
works again!

Many reasons to dislike systemd, although in this case I guess it's poor packaging.

15 September 2014

594. Very, very briefly: Speedtest your WLAN

As shown here: http://firstin-lastout.com/2013/07/how-to-test-wifi-speed/

Install iperf: sudo apt-get install iperf

Open two terminal windows on the same computer:

Terminal 1$ iperf -s -u -i1
------------------------------------------------------------
Server listening on UDP port 5001
Receiving 1470 byte datagrams
UDP buffer size:  208 KByte (default)
------------------------------------------------------------
Terminal 2$ iperf -c 192.168.2.1 -u -i1 -l 1300 -b 100m -t 600
------------------------------------------------------------
Client connecting to 192.168.2.1, UDP port 5001
Sending 1300 byte datagrams
UDP buffer size:  208 KByte (default)
------------------------------------------------------------
[  3] local 192.168.2.110 port 56520 connected with 192.168.2.1 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0- 1.0 sec  4.46 MBytes  37.4 Mbits/sec
[  3]  1.0- 2.0 sec  4.45 MBytes  37.3 Mbits/sec
[  3]  2.0- 3.0 sec  4.28 MBytes  35.9 Mbits/sec
[  3]  3.0- 4.0 sec  4.32 MBytes  36.2 Mbits/sec
[  3]  4.0- 5.0 sec  4.42 MBytes  37.1 Mbits/sec
[  3]  5.0- 6.0 sec  4.35 MBytes  36.5 Mbits/sec
[  3]  6.0- 7.0 sec  4.39 MBytes  36.8 Mbits/sec
[  3]  7.0- 8.0 sec  4.35 MBytes  36.5 Mbits/sec
[  3]  8.0- 9.0 sec  4.41 MBytes  37.0 Mbits/sec

Where 192.168.2.1 is my wireless router.