こんにちは,HAVRMです.
備忘録第3弾はWSLを使っているときの問題の解決法をまとめます.これもバージョンごとに違うと思うので注意してください.
Ubuntu 18.04 LTS
"# apt update","# apt upgrade","# apt install"できない
"dpkg: error processing package libc-bin (--configure):"と表示される
libc-binのパッケージエラーのせいで「apt」がエラーを起こし,何もできなくななります.
この時はgithubのissueにある方法で解決しました.
この「abdilahrf」さんがコメントした方法でうまくいくようになりました.
実際のコードは次のようになります.
sudo mv /var/lib/dpkg/info/libc-bin.* /tmp/ sudo dpkg --remove --force-remove-reinstreq libc-bin sudo dpkg --purge libc-bin sudo apt install libc-bin sudo mv /tmp/libc-bin.* /var/lib/dpkg/info/
なお自分が実行したときは次のようになりました.
$ sudo mv /var/lib/dpkg/info/libc-bin.* /tmp/ $ sudo dpkg --remove --force-remove-reinstreq libc-bin dpkg: error processing package libc-bin (--remove): this is an essential package; it should not be removed Errors were encountered while processing: libc-bin $ sudo dpkg --purge libc-bin dpkg: error processing package libc-bin (--purge): this is an essential package; it should not be removed Errors were encountered while processing: libc-bin $ sudo apt install libc-bin Reading package lists... Done Building dependency tree Reading state information... Done libc-bin is already the newest version (2.27-3ubuntu1.4). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 1 not fully installed or removed. After this operation, 0 B of additional disk space will be used. Do you want to continue? [Y/n] Y Setting up libc-bin (2.27-3ubuntu1.4) ... W: APT had planned for dpkg to do more than it reported back (0 vs 4). Affected packages: libc-bin:amd64 $ sudo mv /tmp/libc-bin.* /var/lib/dpkg/info/
これでアップデートやアップグレード,インストールができるようになりました.
Ubuntu 20.04
GUIを開く際に「error while loading shared libraries: libQt5Core.so.5: cannot open shared object file: No such file or directory」と表示される
次のコマンドでlibQt5Core.so.5を探す.
$ find /usr -name libQt5Core.so.5 /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
表示されたシンボルをオブジェクトファイルから切り捨てる
$ sudo strip --remove-section=.note.ABI-tag <ファイルの場所>
今回の場合だと
sudo strip --remove-section=.note.ABI-tag /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
参考:https://answers.gazebosim.org//question/25531/getting-gazebo-11-running-on-wsl2-on-windows-10/