Raspbian
安裝 python-rpi.gpio 時出現“EOFError: EOF read where object expected”
在 Raspbian Jessie (Raspberry pi 2) 的全新安裝中,第一次嘗試升級時出現錯誤:
Preparing to unpack .../python-rpi.gpio_0.6.1-1_armhf.deb ... Traceback (most recent call last): File "/usr/bin/pyclean", line 31, in <module> from debpython import files as dpf EOFError: EOF read where object expected dpkg: warning: subprocess old pre-removal script returned error exit status 1 dpkg: trying script from the new package instead ... Traceback (most recent call last): File "/usr/bin/pyclean", line 31, in <module> from debpython import files as dpf EOFError: EOF read where object expected dpkg: error processing archive /var/cache/apt/archives/python-rpi.gpio_0.6.1-1_armhf.deb (--unpack): subprocess new pre-removal script returned error exit status 1 Traceback (most recent call last): File "/usr/bin/pycompile", line 37, in <module> from debpython import files as dpf EOFError: EOF read where object expected dpkg: error while cleaning up: subprocess installed post-installation script returned error exit status 1 Preparing to unpack .../python3-rpi.gpio_0.6.1-1_armhf.deb ... Unpacking python3-rpi.gpio (0.6.1-1) over (0.6.0a3-1) ... Preparing to unpack .../raspi-config_20160108_all.deb ... Unpacking raspi-config (20160108) over (20151117) ... Preparing to unpack .../rc-gui_0.4-1_armhf.deb ... Unpacking rc-gui (0.4-1) over (0.3-2) ... Preparing to unpack .../sudo_1.8.10p3-1+deb8u3_armhf.deb ... Unpacking sudo (1.8.10p3-1+deb8u3) over (1.8.10p3-1+deb8u2) ... Preparing to unpack .../sonic-pi_1%3a2.9.0-1_armhf.deb ... Unpacking sonic-pi (1:2.9.0-1) over (1:2.7.0-1) ... Processing triggers for man-db (2.7.0.2-5) ... Processing triggers for systemd (215-17+deb8u2) ... Processing triggers for gnome-menus (3.13.3-6) ... Processing triggers for desktop-file-utils (0.22-1) ... Processing triggers for mime-support (3.58) ... Processing triggers for gnome-icon-theme (3.12.0-1) ... Errors were encountered while processing: /var/cache/apt/archives/python-rpi.gpio_0.6.1-1_armhf.deb E: Sub-process /usr/bin/dpkg returned an error code (1)
閱讀此內容後,問題似乎出在 python-rpi.gpio 上。如何克服它的問題。最重要的是,因為現在無法進行其他安裝。
apt-get clean
類似或不幸的常見建議dpkg --configure -a
無濟於事。ldconfig /sbin/ldconfig.real: /usr/lib/arm-linux-gnueabihf/libatomic.so.1.1.0 is not an ELF file - it has the wrong magic bytes at the start. /sbin/ldconfig.real: /usr/lib/arm-linux-gnueabihf/libatomic.so.1 is not an ELF file - it has the wrong magic bytes at the start.
除了降級到 Raspbian Wheezy 還能做什麼?
實際原因是 SD 卡故障,刪除功能實施不正確,在升級期間刪除也更改了其他文件。
手動獲取
sonic-pi
並重試….wget http://sonic-pi.net/files/releases/v2.9.0/Sonic-Pi-for-RPi-Jessie-v2.9.0.tgz tar -xvzf Sonic-Pi-for-RPi-Jessie-v2.9.0.tgz