看板 Linux 關於我們 聯絡資訊
大家好 我今天想要在我的Raspberry PI進行apt-get update時發生錯誤 所以上來請教大家 系統資訊 $ uname -a Linux raspberrypi 4.4.13-v7+ #894 SMP Mon Jun 13 13:13:27 BST 2016 armv7l GNU/Linux $ apt-get -v apt 1.0.9.8.3 for armhf compiled on Apr 2 2016 16:38:14 Supported modules: *Ver: Standard .deb Pkg: Debian APT solver interface (Priority -1000) *Pkg: Debian dpkg interface (Priority 30) S.L: 'deb' Standard Debian binary tree S.L: 'deb-src' Standard Debian source tree Idx: EDSP scenario file Idx: Debian Source Index Idx: Debian Package Index Idx: Debian Translation Index Idx: Debian dpkg status file 錯誤訊息 $ sudo apt-get update Hit http://archive.raspbian.org jessie InRelease Hit http://archive.raspberrypi.org jessie InRelease Get:1 http://archive.raspbian.org jessie/main Sources [7,745 kB] Get:2 http://archive.raspberrypi.org jessie/ui armhf Packages [53.8 kB] 10% [1 Sources 728 kB/7,745 kB 9%] [2 Packages 28.0 kB/53.8 kB 52%]/usr/lib/apt/methods/gzip: error while loading shared libraries: hf.so.3: cannot open shared object file: No such file or directory E: Method gzip has died unexpectedly! E: Sub-process gzip returned an error code (127) E: Method /usr/lib/apt/methods/gzip did not start correctly 當我要執行sudo apt-get update時,發生找不到hf.so.3這個library的錯誤 我上網尋找hf.so.3,但是都找不到類似情形,甚至根本找不到這個library 而且我用ldd去尋找/usr/lib/apt/methods/gzip的dependency $ ldd /usr/lib/apt/methods/gzip 完全沒有任何結果 我現在完全沒有頭緒 想請問各位前輩有沒有遇過類似的情況 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.113.235.151 ※ 文章網址: https://www.ptt.cc/bbs/Linux/M.1478473189.A.58D.html
Gold740716: gcc ?自己 compile 啊。 11/07 11:33
lantw44: 這是指 ld-linux-armhf.so.3? 11/07 14:43
我也不太確定是不是ld-linux-armhf.so.3 因為他的錯誤訊息只有hf.so.3 假設是ld-linux-armhf.so.3的話 l大知道該怎麼解決嗎 謝謝
Gold740716: ID 而已 ;) 11/07 17:59
※ 編輯: GNUGCC (140.113.235.151), 11/08/2016 04:22:08
lantw44: 有點好奇 file /usr/lib/apt/methods/gzip 會出現什麼 11/09 00:11
$ file /usr/lib/apt/methods/gzip /usr/lib/apt/methods/gzip: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 2.6.32, BuildID[sha1]=5f5c519b9b4384a177a48fcc21b36cf1012de84e, stripped 有什麼線索嗎 ※ 編輯: GNUGCC (140.113.235.151), 11/09/2016 03:22:16
lantw44: 於是 /lib/ld-linux-armhf.so.3 是否真的存在? 11/09 11:15
$ ls -l /lib/ld-linux-armhf.so.3 lrwxrwxrwx 1 root root 30 Apr 2 2016 /lib/ld-linux-armhf.so.3 -> arm-linux-gnueabihf/ld-2.19.so 存在,但是指向另一個檔案 $ file /lib/arm-linux-gnueabihf/ld-2.19.so /lib/arm-linux-gnueabihf/ld-2.19.so: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, BuildID[sha1]=f4650e6d5c7f4ba151204bed56093e6783d03d07, stripped ※ 編輯: GNUGCC (140.113.235.151), 11/09/2016 12:28:19 ※ 編輯: GNUGCC (140.113.235.151), 11/09/2016 12:30:54
lantw44: 那直接執行 /usr/lib/apt/methods/gzip 會動嗎? 11/09 14:21
$ /usr/lib/apt/methods/gzip /usr/lib/apt/methods/gzip: error while loading shared libraries: hf.so.3: cannot open shared object file: No such file or directory 會失敗,跟apt-get update噴一樣的錯誤訊息 ※ 編輯: GNUGCC (140.113.235.151), 11/09/2016 14:57:38
lantw44: /usr/lib/apt/methods/gzip 檔案的 MD5 跟 11/09 15:09
lantw44: /var/lib/dpkg/info/apt.md5sums 裡面寫的一樣嗎? 11/09 15:09
lantw44: 還有 readelf -d /usr/lib/apt/methods/gzip 有出現 11/09 15:10
lantw44: 長得像是 hf.so.3 的東西嗎? 11/09 15:10
兩個md5不一樣,我現在正在重新下載官網的.img檔,抓出裡面的gzip 另外readelf沒有出現類似hf.so.3的東西 其他訊息都是hex形式,所以我只grep library $ readelf -d /usr/lib/apt/methods/gzip | grep library 0x00000001 (NEEDED) Shared library: [libapt-pkg.so.4.12] 0x00000001 (NEEDED) Shared library: [libstdc++.so.6] 0x00000001 (NEEDED) Shared library: [libm.so.6] 0x00000001 (NEEDED) Shared library: [libgcc_s.so.1] 0x00000001 (NEEDED) Shared library: [libc.so.6] ※ 編輯: GNUGCC (140.113.235.151), 11/10/2016 04:29:35 我剛才把官網抓下來的gzip替代原本的就可以正常執行了 我不知道為甚麼原本的gzip會壞掉 感謝lantw44大大幫我發現檔案壞掉 ※ 編輯: GNUGCC (140.113.235.151), 11/10/2016 05:00:02