Ubuntu apt-get update && upgrade 问题修复记录
Question1. apt-get update 失效或者Err
solution:
- 对于失效的源进行更新
- 对Err的源,往往是外部添加的源,根据报错提示,找到并删除
cd /etc/apt/sources.list.d
ls
rm ...
rm ... .save(有两个文件,后缀带有.save的一起删除)
Question2. apt-get AppStream问题
- Situation1.
AppStream system cache was updated, but problems were found: Metadata files have errors: /var/cache/app-info/xmls/fwupd.xml
Reading package lists... Done
E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/cache/app-info -a -e /usr/bin/appstreamcli; then appstreamcli refresh-cache > /dev/null; fi'
E: Sub-process returned an error code
solution: apt-get autoremove
- Situation2.
Symbol lookup error: ****.so.*:undefined symbol: g_strv_contains
solution1: 寻找这个动态连接的位置,找到合适的版本在~/.bashrc中修改环境变量 (第一次修复完了可能会反复报错,建议采用Sol2)
export LD_LIBRARY_PATH="/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH"
solution2:apt-get autoremove 或者 apt-get remove name
Question3:apt-get version’****'not found
libstdc++.so.6: version `GLIBCXX_3.4.20' not found
- Solution
strings /usr/lib64/libstdc++.so.6 | grep GLIBCXX
确认一下目前连接的最高版本是否低于要求
find / -name libstdc++.so.6*
找到所有版本的动态连接
strings /usr/local/lib64/libstdc++.so.6.0.20 | grep
对某个符合要求的版本查看一下是否支持
cp /usr/local/lib64/libstdc++.so.6.0.20 /usr/lib64/libstdc++.so.6.0.20
rm -f /usr/lib64/libstdc++.so.6
ln -s /usr/lib64/libstdc++.so.6.0.20 /usr/lib64/libstdc++.so.6
把其中对应的文件换成需要替换的对应位置的版本
Question4:apt-upgrade依赖问题
dpkg-maintscript-helper: error: directory '/usr/share/javascript/jquery-ui/css/smoothness' contains files not owned by package libjs-jquery-ui:all, cannot switch to symlink
dpkg: error processing archive /var/cache/apt/archives/libjs-jquery-ui_1.12.1+dfsg-5_all.deb (--unpack):
subprocess new pre-installation script returned error exit status 1
Errors were encountered while processing:
/var/cache/apt/archives/libjs-jquery-ui_1.12.1+dfsg-5_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
- Solution
sudo dpkg --force depends -P thename
sudo apt-get -f install
Reference:
Question1 Ref
Question2 Ref
Question3 Ref
Question4 Ref