apt-get install ubuntu-desktop报错broken package的解决办法

参考https://blog.youkuaiyun.com/zxysjk/article/details/126607040?spm=1001.2014.3001.5506

装ns3的时候手贱把原装的python删了,导致图形化界面崩了,重启后只能进tty。捣鼓了一下午,终于找到一个解决问题的博客,照着一个一个补上缺失的包,最后一个reboot好了,直接进桌面。

  1. 重启进入tty后先输入用户名和密码登录。

  2. 更改语言,这样解决命令行中出现方块、乱码的问题。

sudo vi /etc/default/locale
#将原来的配置内容修改为
LANG=”en_US.UTF-8″
LANGUAGE=”en_US:en”

输入reboot命令重启后生效

  1. 输入指令
ping www.baidu.com

检测是否连的上网,我能连上就没搞,连不上可以看看其他博客,很多都有写联网的办法。

接下来根据这个博客的第四步和第五步安装ubuntu-desktop

https://blog.youkuaiyun.com/qq_42643629/article/details/136007063?ops_request_misc=&request_id=&biz_id=102&utm_term=%E5%8D%B8%E8%BD%BDpython%E5%90%8E%E6%97%A0%E6%B3%95%E8%BF%9B%E5%8E%BB%E5%9B%BE%E5%BD%A2%E7%95%8C%E9%9D%A2&utm_medium=distribute.pc_search_result.none-task-blog-2allsobaiduweb~default-1-136007063.nonecase&spm=1018.2226.3001.4187

在这里插入图片描述

下面进入正题,我在执行sudo apt-get install ubuntu-desktop命令时失败,报错是……broken package,后来知道这是ubuntu-desktop所需要的一些包被删除了,导致这里不能安装。

再看眼报错

缺少依赖包 package xxx is not installed
缺少依赖包 package xxx is not installed
缺少依赖包 package xxx is not installed
……

接下来一个一个装就好了,提前把这些缺失的依赖包记下来,因为之后可能出现想要装A包但是缺失B包,于是装B包,又报错缺失C包的情况,次数多了可能会忘之前要装哪个包。

sudo apt-get install xxx(要装的包)

在这个过程中会出现想装A包但是缺失B、C两个包,但是执行

sudo apt-get install B
sudo apt-get install C

的时候又提示B、C没有更新,意思是B、C已经装过了,此时继续

sudo apt-get install A

还报错说缺失B、C两个包

那么直接执行(这里需要先装下aptitude,执行命令sudo apt-get install aptitude)

sudo aptitude install A

aptitude 会提供一些安装A包的方案,第一个方案基本没用,所以第一个选项输入n
输入后他会给出第二个方案,一般是将B或者C降级(downgrade),这里选择y,让他执行。

然后A包就被安装好了,我们再次执行

sudo apt-get install A

看到A包没有更新,说明A已经被装好了。

没遇到这种情况就直接

sudo apt-get install xxx(要装的包)

就这样一直把最开始安装ubuntu-desktop时报错的缺失的包全部安装完后执行reboot命令重启,看到屏幕上有鼠标了,然后就直接进入熟悉的桌面了。

deepcar@ubuntu:~/Desktop$ apt-get apt 2.0.10 (arm64) Usage: apt-get [options] command apt-get [options] install|remove pkg1 [pkg2 ...] apt-get [options] source pkg1 [pkg2 ...] apt-get is a command line interface for retrieval of packages and information about them from authenticated sources and for installation, upgrade and removal of packages together with their dependencies. Most used commands: update - Retrieve new lists of packages upgrade - Perform an upgrade install - Install new packages (pkg is libc6 not libc6.deb) reinstall - Reinstall packages (pkg is libc6 not libc6.deb) remove - Remove packages purge - Remove packages and config files autoremove - Remove automatically all unused packages dist-upgrade - Distribution upgrade, see apt-get(8) dselect-upgrade - Follow dselect selections build-dep - Configure build-dependencies for source packages satisfy - Satisfy dependency strings clean - Erase downloaded archive files autoclean - Erase old downloaded archive files check - Verify that there are no broken dependencies source - Download source archives download - Download the binary package into the current directory changelog - Download and display the changelog for the given package See apt-get(8) for more information about the available commands. Configuration options and syntax is detailed in apt.conf(5). Information about how to configure sources can be found in sources.list(5). Package and version choices can be expressed via apt_preferences(5). Security details are available in apt-secure(8). This APT has Super Cow Powers.有什么问题
03-09
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值