这是我第三次使用完全相同的方法在全新安装的 Ubuntu 上安装所有软件包。前两次都成功了。但这次dselect-upgrade
返回一个空列表,没有任何可安装的内容...
在此之前我确实重新安装了所有 PPA。
我从之前工作的计算机上的 bash 脚本中获得了要在新计算机上安装的软件包列表:
# apt install packages
dpkg --get-selections | grep install > $distrib_release_name.Package.List.install.$machine'.log'
输出是正确的,每行都有包名称,install
右边有关键字,下面是摘录:
aaphoto install
我在新的主目录中创建了一个 tmp 文件夹并将包列表移动到那里。
为了在 Xenial 16.04 中重新安装(从 Xenial 16.04),我在新机器上输入了以下 cmd. 行:
$ sudo apt-get install dselect
$ sudo dselect update
$ cd /home/ubuntu-xenial/user/tmp
$ sudo dpkg --set-selections < Xenial.16.04.Package.List.install.Julius-PC.log
随后出现了一长串警告。但与其他时候不同,我发现警告列表中的所有软件包(减去新安装中已经存在的软件包)。这些行如下所示:
dpkg: warning: package not in database at line 2: aaphoto
dpkg: warning: package not in database at line 2: abiword
dpkg: warning: package not in database at line 2: abiword-common
dpkg: warning: package not in database at line 2: abiword-plugin-grammar
dpkg: warning: package not in database at line 2: account-plugin-aim
dpkg: warning: package not in database at line 4: account-plugin-foursquare
[...]
dpkg: warning: package not in database at line 1825: zint-qt-devel
dpkg: warning: package not in database at line 1827: zlib1g:i386
dpkg: warning: package not in database at line 1827: zlib1g-dev:amd64
dpkg: warning: package not in database at line 1827: zsh
dpkg: warning: package not in database at line 1827: zsh-common
dpkg: warning: found unknown packages; this might mean the available database
is outdated, and needs to be updated through a frontend method
$
此外,行号表明安装软件包的 cmd 是“落后”构建的,因为几个软件包名称与预期一样位于同一行。但错误阻止了任何操作...
我在名为的文件中收到这些警告,我相信这是对当前新安装dpkg--set-selections-warnings.log
的引用?apt database
然后获取文本文件中要安装的软件包列表:
$ echo n | sudo apt-get dselect-upgrade > dselect-upgrade.packages.list.to.be.installed.log
然后执行升级:
$ sudo apt-get dselect-upgrade
Reading package lists...
Building dependency tree...
Reading state information...
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
前两次都运行正常,但是现在文件的内容dselect-upgrade.packages.list.to.be.installed.log
也相当空(正如预期的那样,与上面的 cmd. 行输出相匹配):
Reading package lists...
Building dependency tree...
Reading state information...
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
我不知道为什么要安装的软件包是一个空列表。
[NOTE]:
发布后将近 1 个月,仍然没有答复。我原本希望“官方” Ubuntu 团队能有所回应,因为看起来一些系统软件包的配置 / 行为确实随着时间的推移而发生了变化。我没有看到任何其他解释,因为此命令适用于“全新安装”的 Ubuntu LTS...当然,也有一些绕过解决方案,这些解决方案一点也不优雅...比如强制安装所有软件包apt
,但所有软件包都不适合只用一个命令,我不得不限制每个 cmd 的软件包数量在 500/1000 之间。最后,一些软件包是依赖项,之前已经安装过。为什么这个伟大的UNIX
功能完全坏了Ubuntu
?
答案1
好的。在研究了Debian
错误之后,我发现了这个页关于此人抱怨的新行为dselect-upgrade
被维护者视为“正统”。但看起来手册页让用户完全被这种变化蒙蔽了双眼。热烈欢迎自由软件 :)
现在解决方案已经很清楚了。你需要安装这个dctrl-tools
包:
$ sudo apt-get install dctrl-tools
然后您需要同步数据库,否则的新行为dselect-upgrade
只会让它知道中的当前包集apt database
。
$ sudo sync-available
Merging available database in /tmp/apt-available.80qLJ6...done.
Replacing available packages info, using /tmp/apt-available.80qLJ6.
Information about 88311 packages was updated.
$
然后照常进行:
$ sudo dpkg --set-selections < Xenial.16.04.Installed.Packages.GA-Z370-AORUS-G7.log
dpkg: warning: package not in database at line 29: adobereader-enu:i386
[...]
dpkg: warning: package not in database at line 7929: zint-qt
dpkg: warning: package not in database at line 7929: zint-qt-devel
dpkg: warning: found unknown packages; this might mean the available database
is outdated, and needs to be updated through a frontend method
$
这次它完全正常工作了,因为我只有 32 个包未在数据库中找到,因为它们是在本地构建的,或者直接从不同的供应商处获得。
$ sudo apt-get dselect-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
libavcodec-ffmpeg56
The following NEW packages will be installed:
aaphoto abiword abiword-common abiword-plugin-grammar account-plugin-aim account-plugin-foursquare
account-plugin-identica account-plugin-instagram account-plugin-jabber account-plugin-salut account-plugin-twitter
account-plugin-yahoo acetoneiso acpica-tools acpidump activity-log-manager-control-center adequate advancecomp
[...]
xsel xserver-xephyr xsltproc xtightvncviewer xtrans-dev xubuntu-icon-theme xutils-dev xvfb xvid4conf xzdec xzgv
y-ppa-manager yad yasm yelp-tools youtube-dl zeitgeist zim zlib1g:i386 zlib1g-dev zsh zsh-common
0 upgraded, 6074 newly installed, 1 to remove and 0 not upgraded.
Need to get 7,138 MB/7,140 MB of archives.
After this operation, 24.2 GB of additional disk space will be used.
Do you want to continue? [Y/n] n
$
为了记录这个 Ask Ubuntu 问题,我回答了“否”。稍后我将使用上面问题中描述的过程来保留升级的文件跟踪。但这一次它终于按预期工作了!