可能有更好的输出以进行适当升级?


10

使用apt upgradeapt dist-upgrade非常混乱,因为输出通常看起来像这样。是否有选择或可能性使输出更具可读性?

$ sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  apache2 apache2-bin apache2-data apache2-utils apport apt apt-utils bind9-host bsdutils dnsutils e2fsprogs fdisk grub-common grub-pc grub-pc-bin
  grub2-common irqbalance kmod landscape-common libapt-inst2.0 libapt-pkg5.0 libbind9-160 libblkid1 libcom-err2 libcups2 libcupsimage2
  libdns-export1100 libdns1100 libdrm-common libdrm2 libext2fs2 libfdisk1 libglib2.0-0 libglib2.0-data libirs160 libisc-export169 libisc169
  libisccc160 libisccfg160 libkmod2 libldap-2.4-2 libldap-common liblwres160 liblxc-common liblxc1 libmount1 libnss-systemd libpam-systemd
  libparted2 libpython3-stdlib libpython3.6 libpython3.6-minimal libpython3.6-stdlib libsmartcols1 libss2 libsystemd0 libudev1 libuuid1
  linux-firmware lxcfs lxd lxd-client mount open-iscsi open-vm-tools parted psmisc python-apt-common python3 python3-apport python3-apt
  python3-distupgrade python3-gdbm python3-minimal python3-problem-report python3-software-properties python3-update-manager python3.6
  python3.6-minimal snapd software-properties-common sosreport systemd systemd-sysv tar tmux ubuntu-keyring ubuntu-release-upgrader-core udev
  unattended-upgrades update-manager-core update-notifier-common util-linux uuid-runtime
94 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 115 MB of archives.
After this operation, 14.1 MB of additional disk space will be used.
Do you want to continue? [Y/n]

因此,我必须确定升级是否安全。打包清单很丑陋和令人困惑。我想对要升级的内容有更好的了解。

例如,yum(来自CentOS)在升级时提供了更加清晰的视图。可以轻松查看将要升级的软件包,升级到哪个版本(例如,是小版本升级还是主要版本升级)以及要下载的封装大小。

$ sudo yum update
Loaded plugins: changelog, fastestmirror
Setting up Update Process
Loading mirror speeds from cached hostfile
 * base: centos.mirrors.as250.net
 * epel: ftp.plusline.net
 * extras: ftp.hosteurope.de
 * updates: ftp.plusline.net
Resolving Dependencies
--> Running transaction check
---> Package geoipupdate.x86_64 0:2.2.1-2.el6 will be updated
---> Package geoipupdate.x86_64 0:3.1.1-2.el6 will be an update
---> Package gsoap.x86_64 0:2.7.16-6.el6 will be updated
---> Package gsoap.x86_64 0:2.7.16-7.el6 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================
 Package                     Arch                   Version                      Repository            Size
============================================================================================================
Updating:
 geoipupdate                 x86_64                 3.1.1-2.el6                  epel                  37 k
 gsoap                       x86_64                 2.7.16-7.el6                 epel                 199 k

Transaction Summary
============================================================================================================
Upgrade       2 Package(s)

Total size: 236 k
Is this ok [y/N]:

您有多种选择。1.)自己打补丁2.)向上游询问是否可以解决它。3.)如果您真的非常喜欢百胜,请切换到CentOS。最后,我对您对输出不可读的内容感到好奇(除了它只是一堵墙:p)
j-money

1
另一种选择是使用较窄的终端窗口。人类不太擅长于每行读取超过70个字符。
gboffi

@ j-money正是您所称的“文本墙”,我不喜欢它。对我来说幸运的是,有人提出了开箱即用的解决方案。
masgo

您应该始终升级所有软件包。
fkraiem

@fkraiem你错过了重点。首要任务是运行商务软件。因此,我想知道哪些软件包得到了升级,因为我知道该软件使用了哪些软件包,因此我将检查这些软件包的
变更

Answers:


21

您可以通过询问更详细的版本输出(得到这个更好的输出-V--verbose-versionsapt-get):

# apt upgrade -V
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
   apt (1.6.2 => 1.6.8)
   base-files (10.1ubuntu2 => 10.1ubuntu2.3)
   bsdutils (1:2.31.1-0.4ubuntu3.1 => 1:2.31.1-0.4ubuntu3.3)
   [...]
   util-linux (2.31.1-0.4ubuntu3.1 => 2.31.1-0.4ubuntu3.3)
26 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 8002 kB of archives.
After this operation, 46.1 kB of additional disk space will be used.
Do you want to continue? [Y/n]

另请参阅apt list --upgradable(具有突出显示的输出!):

$ apt list --upgradable
Listing... Done
apt/bionic-updates 1.6.8 amd64 [upgradable from: 1.6.2]
base-files/bionic-updates 10.1ubuntu2.3 amd64 [upgradable from: 10.1ubuntu2]
[...]
util-linux/bionic-updates 2.31.1-0.4ubuntu3.3 amd64 [upgradable from: 2.31.1-0.4ubuntu3.1]

2
这是一个很好的解决方案。yum的输出仍然稍微干净一些,但这是95%。我可以忍受这一点。由于这个问题很可能引起了我的注意,我将再开放一两天,直到接受您的回答。
masgo

6

我看到两种解决方案:

  1. apt/中使用模拟apt-get

    $ sudo apt dist-upgrade --simulate
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Calculating upgrade... Done
    The following packages were automatically installed and are no longer required:
      linux-headers-4.15.0-20 linux-headers-4.15.0-20-generic linux-image-4.15.0-20-generic linux-modules-4.15.0-20-generic
      linux-modules-extra-4.15.0-20-generic
    Use 'sudo apt autoremove' to remove them.
    The following NEW packages will be installed:
      libllvm7 libwayland-egl1
    The following packages will be upgraded:
      apt apt-utils bsdutils cups cups-bsd cups-client cups-common cups-core-drivers cups-daemon cups-ipp-utils cups-ppdc cups-server-common
      deja-dup e2fsprogs fdisk gir1.2-nma-1.0 gir1.2-totem-1.0 gjs gnome-shell-extension-ubuntu-dock grub-common grub-pc grub-pc-bin
      grub2-common gvfs gvfs-backends gvfs-bin gvfs-common gvfs-daemons gvfs-fuse gvfs-libs irqbalance kmod libapt-inst2.0 libapt-pkg5.0
      libasound2 libasound2-data libblkid1 libcairo-gobject2 libcairo2 libcom-err2 libcups2 libcupscgi1 libcupsimage2 libcupsmime1 libcupsppdc1
      libdrm-amdgpu1 libdrm-common libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libdrm2 libegl-mesa0 libegl1-mesa libext2fs2 libfdisk1 libgbm1
      libgjs0g libgl1-mesa-dri libgl1-mesa-glx libglapi-mesa libglx-mesa0 libkmod2 libmount1 libnma0 libnss-myhostname libnss-systemd
      libpam-systemd libsmartcols1 libsmbclient libss2 libsystemd0 libtotem0 libudev1 libuuid1 libwayland-client0 libwayland-cursor0
      libwayland-egl1-mesa libwayland-server0 libwbclient0 libxatracker2 linux-firmware mesa-va-drivers mesa-vdpau-drivers mount
      network-manager-gnome python-apt-common python3-apt python3-distupgrade python3-update-manager rfkill samba-libs snapd systemd
      systemd-sysv tar thermald totem totem-common totem-plugins ubuntu-release-upgrader-core ubuntu-release-upgrader-gtk udev update-manager
      update-manager-core update-notifier update-notifier-common util-linux uuid-runtime
    108 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
    Inst bsdutils [1:2.31.1-0.4ubuntu3.2] (1:2.31.1-0.4ubuntu3.3 Ubuntu:18.04/bionic-updates [amd64])
    Conf bsdutils (1:2.31.1-0.4ubuntu3.3 Ubuntu:18.04/bionic-updates [amd64])
    Inst libext2fs2 [1.44.1-1ubuntu1] (1.44.1-1ubuntu1.1 Ubuntu:18.04/bionic-updates [amd64]) [e2fsprogs:amd64 on libext2fs2:amd64] [e2fsprogs:amd64 ]
    Conf libext2fs2 (1.44.1-1ubuntu1.1 Ubuntu:18.04/bionic-updates [amd64]) [e2fsprogs:amd64 ]
    Inst e2fsprogs [1.44.1-1ubuntu1] (1.44.1-1ubuntu1.1 Ubuntu:18.04/bionic-updates [amd64])
    ...
    
  2. 使用互动式的Aptitude代替简单的apt/apt-get

    才智

    注意:为了使其他部分易于阅读,我折叠了“ 要升级软件包”部分。


感谢您的建议。Aptitude很不错,但是在过去,当事情变得混乱时,我遇到了一些问题(简而言之:依赖关系实际上是无法实现的。aptitude虽然可以满足并完成升级;但是破坏了系统)。但是在桌子上有多个选择仍然很好。
masgo

如果要先进行空运行(模拟),则可以将输出通过管道传输到awksed,等等,配置为使输出看起来像您想要的那样。

2

我正在使用这个

apt list --upgradable | column -t | awk '{print $1"\t"$2"\t"$6}' | column -t | tr -d "]"

groot@debian:~# apt list --upgradable | column -t | awk '{print $1"\t"$2"\t"$6}' | column -t | tr -d "]"

Listing...
e2fslibs/stable                    1.44.5-1+deb10u2                     1.44.5-1+deb10u1
e2fsprogs-l10n/stable              1.44.5-1+deb10u2                     1.44.5-1+deb10u1
e2fsprogs/stable                   1.44.5-1+deb10u2                     1.44.5-1+deb10u1
gir1.2-ibus-1.0/stable             1.5.19-4+deb10u1                     1.5.19-4
libcom-err2/stable                 1.44.5-1+deb10u2                     1.44.5-1+deb10u1
libexpat1/stable                   2.2.6-2+deb10u1                      2.2.6-2
libext2fs2/stable                  1.44.5-1+deb10u2                     1.44.5-1+deb10u1
libibus-1.0-5/stable               1.5.19-4+deb10u1                     1.5.19-4
libibus-1.0-dev/stable             1.5.19-4+deb10u1                     1.5.19-4
libss2/stable                      1.44.5-1+deb10u2                     1.44.5-1+deb10u1
libssl1.1/stable                   1.1.1d-0+deb10u2                     1.1.1c-1
linux-image-4.19.0-6-amd64/stable  4.19.67-2+deb10u1                    4.19.67-2
linux-libc-dev/stable              4.19.67-2+deb10u1                    4.19.67-2
openssh-client/stable              1:7.9p1-10+deb10u1                   1:7.9p1-10
openssh-server/stable              1:7.9p1-10+deb10u1                   1:7.9p1-10
openssh-sftp-server/stable         1:7.9p1-10+deb10u1                   1:7.9p1-10
openssl/stable                     1.1.1d-0+deb10u2                     1.1.1c-1
tzdata/stable-updates              2019c-0+deb10u1                      2019b-0+deb10u1
wpasupplicant/stable               2:2.7+git20190128+0c1e29f-6+deb10u1  2:2.7+git20190128+0c1e29f-6

您好,欢迎来到AskUbuntu。请提供一些解释,该命令正在做什么。
西蒙·苏德勒
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.