适合apt升级的更好输出?

分享于 

9分钟阅读

ubuntu

 

问题:

由于输出通常看起来像这样,所以使用 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]



因此,我必须决定升级是否安全。 packagelist只是 plain confusing。 我想对将要升级的内容有一个更好的概述。

例如 yum ( 从 CentOS ) 在升级时提供了更清晰的视图。 一个可以很容易地看到哪些软件包将被升级,哪个版本( 比如,如果它是一个小型或者主要版本跳转) 和pacakge下载的大小。


$ 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:

你可以通过请求更详细的版本输出( -V--verbose-versions,请参见手册 apt-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:

我看到两种解决方案:

  • 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])
    
    
    ...
    
    
    
    
  • 使用交互形式的智能代替普通 apt/apt-get

    Aptitude

    注意:我已经折叠了升级后的软件包,以提高其它部分的可读性。



pos  OUT  输出  APT  
相关文章