![软件包安装问题](https://linux22.com/image/923319/%E8%BD%AF%E4%BB%B6%E5%8C%85%E5%AE%89%E8%A3%85%E9%97%AE%E9%A2%98.png)
我试图在 lubuntu 上安装 libglu1-mesa-dev freeglut3-dev 和 mesa-common-dev,因为在线课程需要 opengl 来运行练习代码,最初由于某些依赖关系引发了错误,但我最终持有损坏的软件包,因为我不知道如何解决它,我在谷歌上搜索并发现有人说这样做:
1 sudo apt-get --fix-broken install
2 sudo rm /var/lib/apt/lists/* -vf
3 sudo aptitude safe-upgrade
但是我仍然持有损坏的软件包,但无法清除它们,因为它说它们没有安装,我不知道这是因为我删除了文件(我犯了一个错误:我在没有先备份 /var/lib/apt/lists 上的文件也没有先寻找其他解决方案的情况下这样做了)或者我之前可以清除它,我试图使用 testdisk 恢复文件,但是“取消删除”选项没有出现。我还尝试使用 gparted 在“设备”上选择“尝试数据救援”,它找到了这个文件系统:“#1. ext2/3/4,ReiserFS 或 XFS(我的硬盘大小)”当我单击查看时,它显示一条错误消息:“由于文件系统不一致,无法安装文件系统(作为交换)。”命令历史记录的输出(在相关行上 - 即:自从我开始尝试安装软件包以来的那些行)如下:
242 sudo apt-get 安装 libglu1-mesa-dev freeglut3-dev mesa-common-dev
243 sudo apt-get 安装 libglu1-mesa-dev freeglut3-dev mesa-common-dev libgll-mesa-dev libxext-dev libxt-dev libxll-dev
244 sudo apt-get 安装 libglu1-mesa-dev freeglut3-dev mesa-common-dev libgll-dev libxext-dev libxt-dev libxll-dev
245 sudo apt-get 安装 libglu1-mesa-dev freeglut3-dev mesa-common-dev libgl-dev libxext-dev libxt-dev libxll-dev
246 sudo apt-get 安装 libglu1-mesa-dev freeglut3-dev mesa-common-dev libgl-dev libxext-dev libxt-dev libx11-dev
247 sudo apt-get install -f libglu1-mesa-dev freeglut3-dev mesa-common-dev
248 sudo apt-get --fix-broken install -f libglu1-mesa-dev freeglut3-dev mesa-common-dev
249 sudo apt-get --fix-broken install
250 rm /var/lib/apt/lists/* -vf
251 sudo rm /var/lib/apt/lists/* -vf
252 sudo apt-get update
253 aptitude safe-upgrade
254 sudo aptitude safe-upgrade
255 sudo aptitude install --force libglu1-mesa-dev freeglut3-dev mesa-common-dev
256 sudo aptitude install -f libglu1-mesa-dev freeglut3-dev mesa-common-dev
257 sudo apt-get install -f libglu1-mesa-dev freeglut3-dev mesa-common-dev
258 sudo apt-get purge -f libglu1-mesa-dev freeglut3-dev mesa-common-dev
259 重启
260 sudo apt-get install -f libglu1-mesa-dev freeglut3-dev mesa-common-dev
261 sudo apt-get purge -f libglu1-mesa-dev freeglut3-dev
262 sudo apt-get clean
263 sudo apt-get update
264 sudo apt-get install -f libglu1-mesa-dev freeglut3-dev mesa-common-dev
265 sudo dpkg --configure -a
266 sudo apt-get install -f libglu1-mesa-dev freeglut3-dev mesa-common-dev
267 sudo apt-get autoremove
268 sudo apt-get install -f libglu1-mesa-dev freeglut3-dev mesa-common-dev
269 sudo aptitude -f install libglu1-mesa-dev freeglut3-dev mesa-common-dev
270 sudo aptitude -f purge libglu1-mesa-dev freeglut3-dev mesa-common-dev
271 sudo aptitude -f purge libglu1-mesa-dev freeglut3-dev mesa-common-dev libgl-dev libxext-dev libxt-dev libx11-dev
272 sudo apt-get --fix-missing update
273 sudo apt-get install -f libglu1-mesa-dev freeglut3-dev mesa-common-dev
274 sudo apt-get update
275 sudo apt-get autoclean
276* sudo apt-get
277 sudo dpkg --configure -a
278 sudo dpkg -l | grep ^..r
279 sudo -i gedit /var/lib/dpkg/status
280 sudo -i leafpad /var/lib/dpkg/status
281 sudo cat /var/lib/dpkg/status | grep "状态:"
282 sudo cat /var/lib/dpkg/status | grep "状态:[^install ok install]"
283 sudo cat /var/lib/dpkg/status | grep "状态:[^sgdk]"
284 sudo cat /var/lib/dpkg/status | grep "状态:[^"install ok install"]"
285 sudo cat /var/lib/dpkg/status | grep "状态:^[install ok install]"
286 sudo cat /var/lib/dpkg/status | grep "状态:^install ok install"
287 sudo cat /var/lib/dpkg/status | grep "状态:" | grep -v "install ok install"
288 sudo cat /var/lib/dpkg/status | grep "状态:" | grep -v "ok"
289 sudo cat /var/lib/dpkg/status | grep -n "状态:" | grep -v "ok"
290 sudo cat /var/lib/dpkg/status | grep -n "状态:" | grep -v "install ok mounted"
291 sudo -i leafpad /var/lib/dpkg/status
292 sudo aptitude install testdisk
293 testdisk
294 sudo aptitude install gpart
295 dpkg --get-selections | grep "hold"
296 dpkg --get-selections | grep hold
297 synaptic
298 sudo synaptic
299 sudo ls -l /var/lib/apt/lists/
300 testdisk
301 history
答案1
我已经解决了这个问题,我只需要使用 aptitude,但我很困惑,因为它向我显示的第一个选项是不执行任何操作,所以当我在它什么都不做之前运行它时,我只需要不接受第一个选项而是选择第二个选项,感谢你们所有人。