Skip to content

Instantly share code, notes, and snippets.

@kamlekar
Last active March 31, 2022 18:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kamlekar/3f77a934e0343d7489d3d8d5bc798e27 to your computer and use it in GitHub Desktop.
Save kamlekar/3f77a934e0343d7489d3d8d5bc798e27 to your computer and use it in GitHub Desktop.
Steps to do to avoid any issues while updating Ubuntu distro on WSL, windows 10

Sometimes Ubuntu fails to install some services which probably can be fixed by updating the Ubuntu distro, which was my case.

My case was aws-vault was throwing strange errors. Updating Ubuntu fixed it.

Here are the steps I did to make the Ubuntu update go smooth.

Note: Make sure you are running it as a non-root user

Note: $PATH resets when the terminal is reopened. To avoid this, register the $PATH changes in ~/.bashrc file. As mentioned here: stackoverflow. Example: echo 'export PATH=$PATH: /path/to/bin' >> ~/.bashrc or add export PATH=$PATH: /path/to/bin at the end of the .bashrc by opening it in a editor, sudo vi ~/.bashrc.

Update the jessie services in /etc/apt/sources.list (sudo vi /etc/apt/sources.list) to the following:

deb http://deb.debian.org/debian bullseye main contrib
deb-src http://deb.debian.org/debian bullseye main contrib

deb http://deb.debian.org/debian-security/ bullseye-security main contrib
deb-src http://deb.debian.org/debian-security/ bullseye-security main contrib

deb http://deb.debian.org/debian bullseye-updates main contrib
deb-src http://deb.debian.org/debian bullseye-updates main contrib

Run the command:

sudo apt update && sudo apt upgrade

It might complain some service keys are invalid or expired while running the above update command. In such cases, it is better to run those following invalid/expired keys with this command:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys {key1} {key2} {key3}

The key1, key2, key3 are 16 digit invalid/expired keys. These keys can be one or many.

If this too doesn't work, I am not sure but try checking the invalid/expired keys for each package by running this command: sudo apt-key list. Usually, the key will be last 16 digit key in each package, for example:

pub   rsa4096 2013-08-17 [SC] [expired: 2021-08-15]
      75DD C3C4 A499 F1A1 8CB5  F3C8 CBF8 D6FD 518E 17E1  // These last 16 digits i.e CBF8D6FD518E17E1 (spaces removed)
uid           [ expired] Jessie Stable Release Key <debian-release@lists.debian.org>

Sometimes these keys are invalid/expired from the provider itself as happened with Google before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment