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**

(Updated, 2020 Jun) Prevent Debian Linux randomly reboot on Biostar NM70I-847

Disclaimer: The article here is provided “as is” without any warranties. The article may not suit your situation. Use at your own risk.


I have a NM70I-847 motherboard, and I installed Debian 9 Stretch on it recently. After installation, the system began to reboot randomly without any warning.

I used to run Debian 7 Wheezy on this motherboard, the RC6 sleep feature of the CPU’s graphics need to be disabled to prevent such issue. It should be very easy to fix just need to add parameter i915.i915_enable_rc6=0to grub boot option.

But the method seems not working (or deprecated) — after applied the fix computer still keep rebooting on its own. Message like the following can be observed from dmesg:

i915: unknown parameter 'i915_enable_rc6' ignored

Yep, that’s why this fix is not working, because this parameter has been ignored by system. Continue reading (Updated, 2020 Jun) Prevent Debian Linux randomly reboot on Biostar NM70I-847

Ubuntu, SSH login very slow

Server: Ubuntu 14.04

It’s very slow when SSH into the server.
After type the password and press enter, I have to wait about 5 secs before I can see the command prompt. Finally I found there was a process

python3 /usr/lib/update-notifier/apt-check --human-readable

holding the login procedure.

This script is used to display package updates info when you login (like “XXX packages can be updated”). And it’s called by “/etc/update-motd.d/90-updates-available” during the login procedure.

So in order to speed up the login procedure, I commented out all lines in

/etc/update-motd.d/90-updates-available

no talloc stackframe at ../source3/param/loadparm.c:4864, leaking memory

Newly installed Ubuntu 14.04 server and samba on a new PC.
When I was trying to create an array by execute the mdadm command with sudo, I got this error message:

no talloc stackframe at ../source3/param/loadparm.c:4864, leaking memory

Somehow, the sudo command was successfully completed, but the error message is annoying. I was thinking this maybe a mdadm bug, but after tried some other commands – I found each time when I was execute a command with sudo I got this error message. Weird! After googling around I found some pages relating to this problem. Looks like this seems to be a issue with samba and libpam-smbpass?
Continue reading no talloc stackframe at ../source3/param/loadparm.c:4864, leaking memory