6

解决orangepi lite刷官网ubuntu-server 不能apt update的方法

 3 years ago
source link: https://www.lujun9972.win/blog/2018/02/06/%E8%A7%A3%E5%86%B3orangepi-lite%E5%88%B7%E5%AE%98%E7%BD%91ubuntu-server-%E4%B8%8D%E8%83%BDapt-update%E7%9A%84%E6%96%B9%E6%B3%95/index.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

解决orangepi lite刷官网ubuntu-server 不能apt update的方法

贪便宜买了个OrangePi Lite,结果发现刷了官网上提供的Ubuntu Server后无法apt update

Reading package lists... Error!
E: Encountered a section with no Package: header
E: Problem with MergeList /var/lib/dpkg/status
E: The package lists or status file could not be parsed or opened.

根据网上说的用 status.old 替换成 status 结果也是不行。查看 status 文件发现文件头多了几行莫名其妙的文字,文件后面出现很多乱码,猜测是文件被损毁了。

status 文件头和尾部的那一串东西删掉后,再运行 apt update 就可以了。

然而,当我尝试通过 apt-get dist-upgrade 升级时又出现新的错误,提示

dpkg: error: parsing file '/var/lib/dpkg/available' near line 2 package 'libustr-1.0-1':  value for `status' field not allowed in this context
E: Sub-process /usr/bin/dpkg returned an error code (2)

很明显 available 也被损坏了,而且使用 available-old 替代 available 也不行,不过这很好办

用root用户执行

dpkg --clear-avail
apt-get update

就可以了,然后运行 apt-get dist-upgrade 升级成功了


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK