Reverting yay and pacman packages

Having trouble with the current version of a package? Time to revert.

Preface: the below commands can be easily executed with the downgrade AUR package. If you want to do the commands manually, continue reading.

Pacman

If you want to do this with pacman packages, look in the directory of /var/cache/pacman/pkg. Let's use obs-studio as an example.

Listing out all the previously downloaded versions in the cache:

$ ls /var/cache/pacman/pkg/obs-studio*.pkg.tar.zst
/var/cache/pacman/pkg/obs-studio-27.2.4-1-x86_64.pkg.tar.zst
/var/cache/pacman/pkg/obs-studio-27.2.4-2-x86_64.pkg.tar.zst
/var/cache/pacman/pkg/obs-studio-28.0.2-1-x86_64.pkg.tar.zst
/var/cache/pacman/pkg/obs-studio-28.0.2-2-x86_64.pkg.tar.zst
/var/cache/pacman/pkg/obs-studio-28.0.3-1-x86_64.pkg.tar.zst
/var/cache/pacman/pkg/obs-studio-28.0.3-2-x86_64.pkg.tar.zst
/var/cache/pacman/pkg/obs-studio-28.1.2-1-x86_64.pkg.tar.zst
/var/cache/pacman/pkg/obs-studio-28.1.2-2-x86_64.pkg.tar.zst
/var/cache/pacman/pkg/obs-studio-29.0.0-1-x86_64.pkg.tar.zst

To revert to 27.2.4-1, we simply do the command below, and everything should work out.

sudo pacman -U /var/cache/pacman/pkg/obs-studio-27.2.4-1-x86_64.pkg.tar.zst

Yay

The current release of vscode at the time of writing this post is 1.75, which was released on February 2nd, 2023.

Due to broken features such as non-functioning version control, amongst other things, we can revert to 1.74.

Make sure there are previous versions in your cache. List out items within .cache/yay/visual-studio-code-bin, and hopefully some are still sitting around. If not, this post won't help beyond this point.

$ ls .cache/yay/visual-studio-code-bin/*.pkg.tar.zst
.cache/yay/visual-studio-code-bin/visual-studio-code-bin-1.73.1-1-x86_64.pkg.tar.zst
.cache/yay/visual-studio-code-bin/visual-studio-code-bin-1.73.1-2-x86_64.pkg.tar.zst
.cache/yay/visual-studio-code-bin/visual-studio-code-bin-1.74.1-1-x86_64.pkg.tar.zst
.cache/yay/visual-studio-code-bin/visual-studio-code-bin-1.74.2-1-x86_64.pkg.tar.zst
.cache/yay/visual-studio-code-bin/visual-studio-code-bin-1.74.3-1-x86_64.pkg.tar.zst
.cache/yay/visual-studio-code-bin/visual-studio-code-bin-1.75.0-1-x86_64.pkg.tar.zst

To revert to 1.74.3-1, the second to last item in the list, we simply execute the following:

yay -U .cache/yay/visual-studio-code-bin/visual-studio-code-bin-1.74.3-1-x86_64.pkg.tar.zst

Restart vscode, and you will have the latest working version.