One of my raspberry pi's is hanging whenever I try to install or update anything using apt-get.
Running Raspbian 7 (wheezy).
Symptoms (using watchdog as an example as it has no dependencies):
# apt-get install watchdog
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
watchdog
0 upgraded, 1 newly installed, 0 to remove and 129 not upgraded.
Need to get 0 B/81.7 kB of archives.
After this operation, 209 kB of additional disk space will be used.
Preconfiguring packages ...
Selecting previously unselected package watchdog.
(Reading database ...
... at which point it hangs. Ctrl-C doesn't even work to kill it; I've been using Ctrl-Z and then kill %1
to get rid of it.
By hanging, I mean nothing happens for over 24 hours wall clock time.
Running with strace ends with the last 2 lines endlessly repeating:
wait4(6254, 0xbee07570, WNOHANG, NULL) = 0
pselect6(18, [0 15 17], NULL, NULL, {1, 0}, {[], 8}) = 1 (in [17], left {0, 448307553})
read(17, "Selecting previously unselected "..., 1024) = 49
write(1, "Selecting previously unselected "..., 49Selecting previously unselected package watchdog.) = 49
write(4, "Selecting previously unselected "..., 49) = 49
wait4(6254, 0xbee07570, WNOHANG, NULL) = 0
pselect6(18, [0 15 17], NULL, NULL, {1, 0}, {[], 8}) = 1 (in [17], left {0, 999814003})
read(17, "\r\n", 1024) = 2
write(1, "\r\n", 2^M ) = 2
write(4, "\r\n", 2) = 2
wait4(6254, 0xbee07570, WNOHANG, NULL) = 0
pselect6(18, [0 15 17], NULL, NULL, {1, 0}, {[], 8}) = 1 (in [17], left {0, 999947001})
read(17, "(Reading database ... \r", 1024) = 23
write(1, "(Reading database ... \r", 23(Reading database ... ^M) = 23
write(4, "(Reading database ... \r", 23) = 23
wait4(6254, 0xbee07570, WNOHANG, NULL) = 0
pselect6(18, [0 15 17], NULL, NULL, {1, 0}, {[], 8}) = 0 (Timeout)
wait4(6254, 0xbee07570, WNOHANG, NULL) = 0
pselect6(18, [0 15 17], NULL, NULL, {1, 0}, {[], 8}) = 0 (Timeout)
wait4(6254, 0xbee07570, WNOHANG, NULL) = 0
pselect6(18, [0 15 17], NULL, NULL, {1, 0}, {[], 8}) = 0 (Timeout)
wait4(6254, 0xbee07570, WNOHANG, NULL) = 0
Top indicates the pi is 98% idle (the 2% active is basically the top command itself). This is a headless pi not running X so has plenty of free memory. Status lines from top (during a "hang") are:
Tasks: 104 total, 1 running, 103 sleeping, 0 stopped, 0 zombie
%Cpu(s): 1.0 us, 1.3 sy, 0.0 ni, 97.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0
KiB Mem: 184900 total, 158188 used, 26712 free, 28336 buffers
KiB Swap: 102396 total, 0 used, 102396 free, 67240 cached
There is sufficient free disk space. df -h gives:
Filesystem Size Used Avail Use% Mounted on
/dev/root 3.4G 2.5G 757M 77% /
devtmpfs 87M 0 87M 0% /dev
tmpfs 19M 264K 18M 2% /run
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 37M 0 37M 0% /run/shm
/dev/mmcblk0p5 60M 21M 39M 36% /boot
Things I have tried which don't make any difference:
rpi-update
(Suggested by a similar issue here)apt-get update
(which works) followed byapt-get upgrade
(which hangs)Copying the status-old file over the existing status file in /var/lib/dpkg
apt-get install -f
(hangs)dpkg --configure -a
dpkg --clear-avail