Ubuntu常见错误合集——持续更新

1、无法打开锁文件/var/lib/apt/lists/lock - open (13: 权限不够)

正在读取软件包列表... 完成
E: 无法打开锁文件 /var/lib/apt/lists/lock - open (13: 权限不够)
E: 无法对目录 /var/lib/apt/lists/ 加锁
W: 用 unlink 删除文件 /var/cache/apt/pkgcache.bin 出错 - RemoveCaches (13: 权限不够)
W: 用 unlink 删除文件 /var/cache/apt/srcpkgcache.bin 出错 - RemoveCaches (13: 权限不够)

出现这类问题是忘记加sudo,如只输了apt-get update,而没输sudo apt-get update

2、dpkg: 错误: 另外一个进程已经为 dpkg frontend 加锁

E: 无法获得锁 /var/lib/dpkg/lock-frontend - open (11: 资源暂时不可用)
E: 无法获取 dpkg前端锁 (/var/lib/dpkg/lock-frontend),是否有其他进程正占用它?

因为没有人为中断什么进程,就怀疑是后台在更新,但是点开软件更新器发现上面写
正在等待unattended -upgr退出,我就知道软件更新器也很无奈
这里尝试了很多种方法,包括常见的删除锁文件:

sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock

删完了还是不行

还有列出进程然后杀死它:

ps -e  |  grep apt 或者 ps  aux
sudo kill  < PID >

但是我的问题是第一个什么都没显示,第二个列出了一堆也没找到apt-get的

直到看到一篇博客说有病不能乱投医提示了我,要看提示的被加锁目录是啥,再删除对应的目录
因此上面删除锁文件的命令应该改成

sudo rm /var/lib/dpkg/lock-frontend

于是错误就换了,变成了

E: 无法获得锁 /var/lib/dpkg/lock - open (11: 资源暂时不可用)
E:无法锁定管理目录(/var/lib/dpkg/),是否有其他进程正占用它?

然后我试图删/var/lib/dpkg/这个目录,但是提示rm: 无法删除'/var/lib/dpkg/': 是一个目录
/var/lib/dpkg/lock,提示rm: 无法删除'/var/lib/dpkg/lock': 没有那个文件或目录
我通过cd进入/var/lib/dpkg/lock,提示bash: cd: var/lib/dpkg/lock: 没有那个文件或目录
我觉得应该是之前删了它没更新过来,因为过一会儿再用apt-get变成了

正在读取软件包列表… 有错误!
E: flAbsPath on /var/lib/dpkg/status failed - realpath (2: 没有那个文件或目录)
E: 无法打开文件 - open (2: 没有那个文件或目录) E: Problem opening E:
无法解析或打开软件包的列表或是状态文件。

然后用这些命令,应该主要是前两句,就大功告成

sudo mkdir -p /var/lib/dpkg/{alternatives,info,parts,triggers,updates}
sudo cp /var/backups/dpkg.status.0 /var/lib/dpkg/status
apt-get download dpkg
sudo dpkg -i dpkg*.deb
apt-get download base-files
sudo dpkg -i base-files*.deb
sudo apt-get update
sudo apt-get check

3、虚拟环境中catkin_make显示Make sure that you have installed “catkin_pkg”, it is up to date and on the PYTHONPATH.

https://blog.csdn.net/qq_33521754/article/details/78829212

4. rosrun rqt_reconfigure rqt_reconfigure时出现PluginManager._load_plugin() could not load plugin

PluginManager._load_plugin() could not load plugin
“rqt_reconfigure/Param”: Traceback (most recent call last): File
“/opt/ros/melodic/lib/python2.7/dist-packages/qt_gui/plugin_handler.py”,
line 102, in load
self._load() File “/opt/ros/melodic/lib/python2.7/dist-packages/qt_gui/plugin_handler_direct.py”,
line 55, in _load
self._plugin = self._plugin_provider.load(self._instance_id.plugin_id, self._context)
File
“/opt/ros/melodic/lib/python2.7/dist-packages/qt_gui/composite_plugin_provider.py”,
line 72, in load
instance = plugin_provider.load(plugin_id, plugin_context) File “/opt/ros/melodic/lib/python2.7/dist-packages/qt_gui/composite_plugin_provider.py”,
line 72, in load
instance = plugin_provider.load(plugin_id, plugin_context) File “/opt/ros/melodic/lib/python2.7/dist-packages/rqt_gui_py/ros_py_plugin_provider.py”,
line 61, in load
return super(RosPyPluginProvider, self).load(plugin_id, plugin_context) File
“/opt/ros/melodic/lib/python2.7/dist-packages/qt_gui/composite_plugin_provider.py”,
line 72, in load
instance = plugin_provider.load(plugin_id, plugin_context) File “/opt/ros/melodic/lib/python2.7/dist-packages/rqt_gui/ros_plugin_provider.py”,
line 106, in load
return class_ref(plugin_context) File “/opt/ros/melodic/lib/python2.7/dist-packages/rqt_reconfigure/param_plugin.py”,
line 51, in init
self._plugin_widget = ParamWidget(context) File “/opt/ros/melodic/lib/python2.7/dist-packages/rqt_reconfigure/param_widget.py”,
line 105, in init
self, rp, self.sig_sysmsg File “/opt/ros/melodic/lib/python2.7/dist-packages/rqt_reconfigure/node_selector_widget.py”,
line 102, in init
self._update_nodetree_pernode() File “/opt/ros/melodic/lib/python2.7/dist-packages/rqt_reconfigure/node_selector_widget.py”,
line 341, in _update_nodetree_pernode
TreenodeQstdItem.NODE_FULLPATH File “/opt/ros/melodic/lib/python2.7/dist-packages/rqt_reconfigure/treenode_qstditem.py”,
line 94, in init
self._set_param_name(grn_current_treenode) File “/opt/ros/melodic/lib/python2.7/dist-packages/rqt_reconfigure/treenode_qstditem.py”,
line 246, in _set_param_name
self._toplevel_treenode_name = self._list_treenode_names[0] IndexError: list index out of range

/opt/ros/melodic/lib/python2.7/dist-packages/rqt_reconfigure/node_selector_widget.py文件中第325行改为if node_name_grn in self._nodeitems or node_name_grn == '':即可

5. gazebo没杀干净导致pid啥啥啥的

killall gzserver

6. rosrun rqt_reconfigure rqt_reconfigure运行后有参数,但是空的,运行rosrun dynamic reconfigure dynparam list也有返回值

像这样
在这里插入图片描述 而不是像正常时右侧有个框
在这里插入图片描述
解决方法

rosrun rqt_gui rqt_gui --clear-config

然后选择plugin -> configuration -> dynamics configuration

7. 桌面卡死

除了ctrl+alt+t调出终端然后reboot之外,还有另一种方法
ctrl+alt+f1进入tty终端,输入sudo pkill Xorg,没反应就sudo restart lightdm,前者基本上会秒回桌面登录界面,但仍然卡住,后者需要等一会儿才回桌面登录界面,同理也是卡住,我试了几次,最后在两个都输入一遍之后,返回登录界面,等了一会儿,最终可以进去.

8.u盘只能读不能写问题(即ubuntu文件无法拷的u盘里,会提示目标目录仅为可读)

参考这篇博客:https://blog.csdn.net/ITBigGod/article/details/79914534
插入u盘,输入:

df -h
sudo umount /media/usrname/u盘name 
sudo dosfsck -v -a /dev/sda1  (根据挂载点修改)

然后重新插入u盘即可

9.重设ubuntu密码

https://jingyan.baidu.com/article/b907e627bfa0b946e7891c0c.html

10. 啥啥啥依赖:啥啥啥但是它将不会被安装,E: 无法修正错误,因为您要求某些软件包保持现状,就是它们破坏了软件包间的依赖关系

可以使用aptitude:sudo aptitude install ...,如果没装终端会提示安装的命令

11. 还是安装的时候,依赖于啥但啥没装因此出错

用命令安装所有依赖:

sudo apt-get -f install

12. Could not find a package configuration file provided by “OpenCV” with any of the following names:

OpenCVConfig.cmake
opencv-config.cmake
locate OpenCVConfig.cmake

找到目的路径下的CMakeList.txt打开修改如下语句,保存即可

  set(OpenCV_DIR /usr/share/OpenCV/)  #自己的opencv路径

13. pip install时出现ModuleNotFoundError: No module named ‘pip._internal’

强制重新安装

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py --force-reinstall

效果应该和升级差不多

python -m ensurepip
python -m pip install --upgrade pip

14. ERROR: No matching distribution found for cv2

当遇到ModuleNotFoundError: No module named 'cv2'
应该用pip3 install opencv-python而不是pip3 install cv2

15. pip install – error: [Errno 13] Permission denied

ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 /home/dudu/.local/lib/python3.6/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /tmp/tmpwjzb8gck
cwd: /home/dudu/puma
Complete output (2 lines):
running egg_info
error: [Errno 13] Permission denied
----------------------------------------
WARNING: Discarding file:///home/dudu/puma. Command errored out with exit status 1: /usr/bin/python3 /home/dudu/.local/lib/python3.6/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /tmp/tmpwjzb8gck Check the logs for full command output.
ERROR: Command errored out with exit status 1: /usr/bin/python3 /home/dudu/.local/lib/python3.6/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /tmp/tmpwjzb8gck Check the logs for full command output.

加个sudo

16. 这可能意味着这个缺失的软件包可能已被废弃, 或者只能在其他发布源中找到

sudo apt-get update

或者先换源再update

18. terminator终端终结者运行时报错except (KeyError,ValueError), ex:SyntaxError: invalid syntax

File “/usr/bin/terminator”, line 123
except (KeyError,ValueError), ex:
^
SyntaxError: invalid syntax

terminator貌似是只能用python,或者是保持了安装时系统默认的python版本,因此要么将系统默认版本改为python2,要么更改sudogedit /usr/bin/terminator,将第一行改为#!/usr/bin/python2,指定使用python

19. 装了anaconda的小伙伴可能在cmake时遇到warning: runtime library [libz.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in: /home/dell/anaconda3/lib

虽然大部分warning不用管,但这个warning可能还是需要处理一下,主要就是anaconda的path覆盖了一些path,但将bashrc里conda init的部分注释掉后还是没有用,看到有的博客说找到libuuid删掉啥的,但这样不方便恢复,其实简单粗暴的将anaconda3文件夹改个名字即可,如anaconda3-1,其他路径问题同样也可以借鉴这个思路.

CMake Warning at applications/surfel_meshing/CMakeLists.txt:38
(add_executable): Cannot generate a safe runtime search path for
target SurfelMeshing_Octree_Test because files in some directories
may conflict with libraries in implicit directories:

runtime library [libz.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
  /home/dell/anaconda3/lib

Some of these libraries may not be found correctly.

CMake Warning at applications/surfel_meshing/CMakeLists.txt:1
(add_executable): Cannot generate a safe runtime search path for
target SurfelMeshing because files in some directories may conflict
with libraries in implicit directories:

runtime library [libz.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
  /home/dell/anaconda3/lib

Some of these libraries may not be found correctly.

CMake Warning at applications/surfel_meshing/CMakeLists.txt:57
(add_executable): Cannot generate a safe runtime search path for
target SurfelMeshing_Triangulation_Test because files in some
directories may conflict with libraries in implicit directories:

runtime library [libz.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
  /home/dell/anaconda3/lib

Some of these libraries may not be found correctly.

20. WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.

python3 -m pip install xxx

https://blog.csdn.net/qq_45859188/article/details/106845800

评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值