Ubuntu – How does apt-get upgrade really work

aptcommand lineupgrade

I upgraded my ubuntu 16.04 machine using command sudo apt-get upgrade.
I know it installs all the packages which are needed to be updated.But I want to know the exact proces how this happens.
In short, I want to read the logs & digest it a bit to be more familiar with ubuntu.

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  libbonoboui2-0 libbonoboui2-common libgnomeui-0 libgnomeui-common libidl-2-0
  libkeybinder0 liborbit2 libvte-common libvte9 linux-headers-4.4.0-103
  linux-headers-4.4.0-103-generic linux-image-4.4.0-103-generic
  linux-image-extra-4.4.0-103-generic python-gconf python-gnome2
  python-gobject python-gobject-2 python-gtk2 python-keybinder python-notify
  python-pyorbit python-vte
0 upgraded, 0 newly installed, 22 to remove and 0 not upgraded.
After this operation, 308 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 389016 files and directories currently installed.)
Removing python-gnome2 (2.28.1+dfsg-1.1) ...
Removing libgnomeui-0:amd64 (2.24.5-3.1) ...
Removing libbonoboui2-0:amd64 (2.24.5-3ubuntu1) ...
Removing libbonoboui2-common (2.24.5-3ubuntu1) ...
Removing libgnomeui-common (2.24.5-3.1) ...
Removing python-pyorbit (2.24.0-7.1) ...
Removing liborbit2:amd64 (1:2.14.19-1build1) ...
Removing libidl-2-0:amd64 (0.8.14-4) ...
Removing python-keybinder (0.3.1-1) ...
Removing libkeybinder0 (0.3.1-1) ...
Removing python-vte (1:0.28.2-5ubuntu3) ...
Removing libvte9 (1:0.28.2-5ubuntu3) ...
Removing libvte-common (1:0.28.2-5ubuntu3) ...
Removing linux-headers-4.4.0-103-generic (4.4.0-103.126) ...
Removing linux-headers-4.4.0-103 (4.4.0-103.126) ...
Removing linux-image-extra-4.4.0-103-generic (4.4.0-103.126) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-103-generic /boot/vmlinuz-4.4.0-103-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-103-generic /boot/vmlinuz-4.4.0-103-generic
Error! Your kernel headers for kernel 4.4.0-103-generic cannot be found.
Please install the linux-headers-4.4.0-103-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-103-generic /boot/vmlinuz-4.4.0-103-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-103-generic
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.4.0-103-generic /boot/vmlinuz-4.4.0-103-generic
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.4.0-103-generic /boot/vmlinuz-4.4.0-103-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.4.0-103-generic /boot/vmlinuz-4.4.0-103-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.4.0-103-generic /boot/vmlinuz-4.4.0-103-generic
Generating grub configuration file ...
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Found linux image: /boot/vmlinuz-4.10.0-42-generic
Found initrd image: /boot/initrd.img-4.10.0-42-generic
Found linux image: /boot/vmlinuz-4.10.0-40-generic
Found initrd image: /boot/initrd.img-4.10.0-40-generic
Found linux image: /boot/vmlinuz-4.10.0-35-generic
Found initrd image: /boot/initrd.img-4.10.0-35-generic
Found linux image: /boot/vmlinuz-4.4.0-104-generic
Found initrd image: /boot/initrd.img-4.4.0-104-generic
Found linux image: /boot/vmlinuz-4.4.0-103-generic
Found initrd image: /boot/initrd.img-4.4.0-103-generic
Adding boot menu entry for EFI firmware configuration
done
Removing linux-image-4.4.0-103-generic (4.4.0-103.126) ...
Examining /etc/kernel/prerm.d.
run-parts: executing /etc/kernel/prerm.d/dkms 4.4.0-103-generic /boot/vmlinuz-4.4.0-103-generic
dkms: removing: bcmwl 6.30.223.271+bdcom (4.4.0-103-generic) (x86_64)

-------- Uninstall Beginning --------
Module:  bcmwl
Version: 6.30.223.271+bdcom
Kernel:  4.4.0-103-generic (x86_64)
-------------------------------------

Status: Before uninstall, this module version was ACTIVE on this kernel.

wl.ko:
 - Uninstallation
   - Deleting from: /lib/modules/4.4.0-103-generic/updates/dkms/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.

depmod....

DKMS: uninstall completed.
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.4.0-103-generic /boot/vmlinuz-4.4.0-103-generic
update-initramfs: Deleting /boot/initrd.img-4.4.0-103-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.4.0-103-generic /boot/vmlinuz-4.4.0-103-generic
Generating grub configuration file ...
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Found linux image: /boot/vmlinuz-4.10.0-42-generic
Found initrd image: /boot/initrd.img-4.10.0-42-generic
Found linux image: /boot/vmlinuz-4.10.0-40-generic
Found initrd image: /boot/initrd.img-4.10.0-40-generic
Found linux image: /boot/vmlinuz-4.10.0-35-generic
Found initrd image: /boot/initrd.img-4.10.0-35-generic
Found linux image: /boot/vmlinuz-4.4.0-104-generic
Found initrd image: /boot/initrd.img-4.4.0-104-generic
Adding boot menu entry for EFI firmware configuration
done
Removing python-gconf (2.28.1+dfsg-1.1) ...
Removing python-gobject (3.20.0-0ubuntu1) ...
Removing python-notify (0.1.1-4) ...
Removing python-gtk2 (2.24.0-4ubuntu1) ...
Removing python-gobject-2 (2.28.6-12ubuntu1) ...
Processing triggers for libc-bin (2.23-0ubuntu9) ...

Best Answer

Try to look APT and dpkg logs:

  • /var/log/apt/history.log
  • /var/log/apt/term.log
  • /var/log/dpkg.log

You can simulate the upgrade process with

sudo apt-get upgrade --simulate