If you’re a user of Ubuntu 18.04, you might have encountered the error message “Problem executing scripts APT::Update::Post-Invoke-Succes” while trying to update your system using
sudo apt-get update. This issue is typically related to a conflict with the Python version on your system. This article will guide you through a step-by-step process to resolve this issue.
To fix the "Problem executing scripts APT::Update::Post-Invoke-Succes" error in Ubuntu 18.04, you need to check the Python version your system is using. If it is set to Python 3, you need to change it back to Python 2 by deleting the existing link and creating a new one that points to
python2.7. After making this change, you should be able to update your system without encountering this error.
Understanding the Issue
Ubuntu 18.04, by default, uses Python 2. However, if you’ve changed the default Python version to Python 3, it can cause problems with packages that rely on Python 2 scripts during their installation process. The error message you’re seeing is a result of this conflict.
Checking the Python Version
The first step in resolving this issue is to verify the Python version your system is using. Open a terminal and run the following command:
$ ls -la /usr/bin/python
This command lists the details of the
/usr/bin/python link. The
-la flag in the
ls command stands for ‘long format’ (
-l) and ‘all’ (
-a), which means it will display all files (including hidden ones) in a detailed format.
If your system is correctly set up, the output should show that the link points to
python2.7, like this:
lrwxrwxrwx 1 root root 9 Jan 24 2017 /usr/bin/python -> python2.7
However, if the link points to any Python 3 executable, it needs to be changed back to Python 2.
Changing the Python Version
To change the Python version, you need to delete the existing link and create a new one that points to
python2.7. Run the following commands:
$ sudo rm -f /usr/bin/python
$ sudo ln -s /usr/bin/python2.7 /usr/bin/python
rm command is used to remove files or directories. The
-f flag stands for ‘force’, which means it will remove the file without prompting for confirmation. The
ln command is used to create links between files and directories. The
-s flag stands for ‘symbolic’, which means it will create a symbolic link.
After making this change, you should be able to run
sudo apt-get update without any errors.
Important Note for Newer Versions
This solution applies to Ubuntu 18.04 and older versions. For Ubuntu 20.04 and newer versions, Python 2 is deprecated, and you need to install it separately using the meta package
python-is-python2. Additionally, the
/usr/bin/python link does not exist if only Python 3 is installed.
This article has provided a step-by-step guide to resolving the “Problem executing scripts APT::Update::Post-Invoke-Succes” error in Ubuntu 18.04. By checking and correcting the Python version, you should be able to update your system without encountering this issue. If none of these solutions work for you, it’s recommended to seek further assistance or consider reinstalling Ubuntu.
sudo apt-get update command is used to update the package lists for upgrades and new package installations on Ubuntu. It retrieves the latest information about available packages from the software repositories.
To open a terminal in Ubuntu 18.04, you can use the keyboard shortcut
Ctrl + Alt + T. Alternatively, you can also open the terminal by searching for "Terminal" in the applications menu.
ls command is used to list files and directories in a directory. By default, it displays the names of files and directories in the current directory.
To delete a file in Ubuntu, you can use the
rm command followed by the file name. For example, to delete a file named "example.txt", you would run
rm example.txt. Be cautious when using the
rm command, as it permanently deletes the file and does not move it to the trash.
To create a symbolic link in Ubuntu, you can use the
ln command with the
-s flag followed by the source file or directory and the target name. For example, to create a symbolic link named "link" that points to a file named "file.txt", you would run
ln -s /path/to/file.txt link.