Arreglando apt upgrade en Ubuntu 22.10 en WSL

Arreglando apt upgrade en Ubuntu 22.10 en WSL

Hoy, quería actualizar mi instalación de Ubuntu WSL corriendo el comando sudo apt upgrade. Desafortunadamente fallaba con el siguiente problema:

sudo apt upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
  golang-1.18 golang-1.18-doc golang-1.18-go golang-1.18-src libarmadillo10 libatk1.0-data libavcodec58 libavdevice58
  libavfilter7 libavformat58 libavutil56 libcharls2 libdav1d5 libdns-export1110 libgdal30 libgeos3.10.2
  libisc-export1105 libllvm13 libpoppler118 libpostproc55 libproj22 libsrt1.4-gnutls libswresample3 libswscale5
  libx264-163 python3-toml
Use 'sudo apt autoremove' to remove them.
E: Could not read response to hello message from hook [ ! -f /usr/lib/ubuntu-advantage/apt-esm-json-hook ] || /usr/lib/ubuntu-advantage/apt-esm-json-hook || true: Success
E: Could not read response to hello message from hook [ ! -f /usr/lib/ubuntu-advantage/apt-esm-json-hook ] || /usr/lib/ubuntu-advantage/apt-esm-json-hook || true: Success

Para arreglar este problema, eliminé los siguientes archivos:

sudo rm /etc/apt/apt.conf.d/51ubuntu-advantage-esm
sudo rm /etc/apt/apt.conf.d/20apt-esm-hook.conf

Luego, corrí sudo apt upgrade nuevamente y esta vez funcionó:

sudo apt upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
  golang-1.18 golang-1.18-doc golang-1.18-go golang-1.18-src libarmadillo10 libatk1.0-data libavcodec58 libavdevice58
  libavfilter7 libavformat58 libavutil56 libcharls2 libdav1d5 libdns-export1110 libgdal30 libgeos3.10.2
  libisc-export1105 libllvm13 libpoppler118 libpostproc55 libproj22 libsrt1.4-gnutls libswresample3 libswscale5
  libx264-163 python3-toml
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
  at-spi2-common xfonts-encodings xfonts-utils
The following packages have been kept back:
  apparmor bash binutils binutils-common binutils-x86-64-linux-gnu cpp g++ gcc gcc-12-base libatomic1 libbinutils
  libboost-atomic1.74-dev libboost-atomic1.74.0 libboost-chrono1.74-dev libboost-chrono1.74.0
  libboost-date-time1.74-dev libboost-date-time1.74.0 libboost-iostreams1.74-dev libboost-iostreams1.74.0
  libboost-regex1.74-dev libboost-regex1.74.0 libboost-serialization1.74-dev libboost-serialization1.74.0
  libboost-system1.74-dev libboost-system1.74.0 libboost-thread1.74-dev libboost-thread1.74.0 libboost1.74-dev
  libc-bin libc-dev-bin libc6 libc6-dev libcc1-0 libctf0 libcups2 libexpat1 libexpat1-dev libgcc-s1 libgfortran5
  libgl1-mesa-dri libglapi-mesa libglx-mesa0 libgomp1 libgprofng0 libitm1 liblsan0 libnss-systemd libobjc4
  libpam-systemd libquadmath0 libstdc++6 libsystemd-dev libsystemd0 libubsan1 libudev1 locales manpages
  mesa-vdpau-drivers mesa-vulkan-drivers openssh-client openssh-server openssh-sftp-server passwd sudo systemd
  systemd-sysv systemd-timesyncd tmux udev
The following packages will be upgraded:
  alsa-ucm-conf apport apt apt-utils at-spi2-core base-files cloud-init curl dbus dbus-bin dbus-daemon
  dbus-session-bus-common dbus-system-bus-common dbus-user-session device-tree-compiler dh-python distro-info
  distro-info-data dnsmasq-base fonts-urw-base35 ghostscript git git-man golang-1.19 golang-1.19-doc golang-1.19-go
  golang-1.19-src icu-devtools isc-dhcp-client isc-dhcp-common klibc-utils libapache2-mod-php8.1 libapparmor1
  libapt-pkg6.0 libatk-bridge2.0-0 libatk1.0-0 libatspi2.0-0 libctf-nobfd0 libcurl3-gnutls libcurl4
  libcurl4-openssl-dev libdbus-1-3 libdrm-amdgpu1 libdrm-common libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libdrm2
  libdw1 libelf1 libfdt1 libgbm1 libglib2.0-0 libglib2.0-bin libglib2.0-data libgnutls-openssl27 libgnutls30 libgs9
  libgs9-common libicu-dev libicu71 libjbig0 libklibc libksba8 libmp3lame0 libmysqlclient-dev libmysqlclient21
  libnginx-mod-http-geoip2 libnginx-mod-http-image-filter libnginx-mod-http-xslt-filter libnginx-mod-mail
  libnginx-mod-stream libnginx-mod-stream-geoip2 libntfs-3g89 libp11-kit0 libparted2 libpcsclite1 libperl5.34
  libpixman-1-0 libpython3.10 libpython3.10-dev libpython3.10-minimal libpython3.10-stdlib libreadline-dev
  libreadline8 libsndio7.0 libsqlite3-0 libssl-dev libssl3 libsubid4 libtiff-tools libtiff5 libxapian30 linux-libc-dev
  login nginx nginx-common nginx-core ntfs-3g openjdk-8-jdk openjdk-8-jdk-headless openjdk-8-jre
  openjdk-8-jre-headless openssl parted perl perl-base perl-modules-5.34 php8.1 php8.1-cli php8.1-common php8.1-mysql
  php8.1-opcache php8.1-readline php8.1-xml python3-apport python3-distro-info python3-distupgrade
  python3-problem-report python3-software-properties python3-unicodedata2 python3-update-manager python3.10
  python3.10-dev python3.10-minimal readline-common runc software-properties-common sosreport tzdata u-boot-tools
  ubuntu-release-upgrader-core ubuntu-standard uidmap update-manager-core update-notifier-common
136 upgraded, 3 newly installed, 0 to remove and 69 not upgraded.
Need to get 227 MB of archives.
After this operation, 1,892 kB of additional disk space will be used.
Do you want to continue? [Y/n]

Estoy corriendo Ubuntu en WSL en modo WSL1. Espero que con remover estos archivos, puedas actualizar tu instalación de Ubuntu exitisamente si encuentras este problema.