Wednesday, 20 February 2019

Ubuntu upgrade from 16.04 to 18.04 LTS python3 fix

Ubuntu complains:

Your python3 installation is corrupted. Please fix /usr/bin/python3 symlink.

This is because do-release-upgrade script check the symlink of /usr/bin/python3. But update-alternatives generally point this symlink to another link /etc/alternatives/python**.

The solution is simple. Make sure you have python default version installed. For 16.04, normally it is 3.5. Otherwise, we have to  check the log of /var/log/dist-upgrade/main.log.

2019-02-20 21:15:02,296 DEBUG python3 symlink points to: '/usr/bin/python3.7', but expected is 'python3.5' or '/usr/bin/python3.5'

If similar statement found, congratulations. We got the root cause of "python corrupted" issue.

We can simply issue command as below:

sudo rm /usr/bin/python3
sudo ln /usr/bin/python3 -s /usr/bin/python3.5

After upgrading, we can run update-alternatives --install python3 again if we really want python3.6 or higher.

No comments: