A Solution for “No module named ‘apt_pkg’” Error in Ubuntu 22.04

If you encounter the “No module named ‘apt_pkg’” error while trying to use the apt update command in Ubuntu 22.04, it might be because the default python3 version in the system is too new. In this case, the default version is 3.11, and changing it to 3.10 solved the problem.

Here are the steps to do this:

  1. Check the current Python 3 version by running the following command:
python3 --version
  1. If the version is 3.11, try using the following command to change it:
sudo update-alternatives --config python3
  1. If the above command returns an error like “update-alternatives: error: no alternatives for python3,” it means there are no alternatives set for Python 3. Ensure that Python 3.10 is installed on your system. It’s usually located at /usr/bin/python3.10
  1. Add Python 3.10 as an alternative using the following command:
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 2
  1. Run the update-alternatives command again to choose Python 3.10 as the default:
sudo update-alternatives --config python3

This solution sets Python 3.10 as the default Python 3 version in your system, which should resolve the issue with the apt update command.

A regular BIOS update turned into a pain in the a**

Just found out that my 3-year-old Intel NUC8 has got a new BIOS release 0090 recently. I downloaded and upgraded it without think twice (which is going to waste some of my time later.)

I have two OS installed and dual boot configured on the hard drive. Windows 10 alongside with Ubuntu Desktop. By default, it will boot into GRUB menu by default, where I can choose whether or not to boot into Windows.

I have done BIOS update for this NUC several times before. But this time, after the new BIOS update, the machine boot directly into Windows without showing the GRUB menu. I tried to hit F10 on-boot to bring up the Boot selection menu to choose another EFI boot-loader — but something weird is: There is only one “Windows Boot Manager” up there, the “ubuntu” boot entry is missing.

Continue reading A regular BIOS update turned into a pain in the a**