3

I'm trying to upgrade my desktop from ubuntu 16.04 to 18.04.
(I regret not having upgraded it earlier before the ubuntu 16.04 EOL arrived. Two weeks ago I have upgraded two 16.04 notebooks to 18.04 though eventhough it was after the EOL, at that time there was just small problems I could solve).
I did sudo apt update but I'm getting the error below during apt upgrade after that.

ckim@chan-ubuntu:~/prj/abdsn$ sudo apt upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
  cpp-5-aarch64-linux-gnu cpp-aarch64-linux-gnu cuda-command-line-tools-10-0 cuda-compiler-10-0 cuda-cublas-10-0 cuda-cublas-dev-10-0 cuda-cudart-10-0
  cuda-cudart-dev-10-0 cuda-cufft-10-0 cuda-cufft-dev-10-0 cuda-cuobjdump-10-0 cuda-cupti-10-0 cuda-curand-10-0 cuda-curand-dev-10-0 cuda-cusolver-10-0
  cuda-cusolver-dev-10-0 cuda-cusparse-10-0 cuda-cusparse-dev-10-0 cuda-documentation-10-0 cuda-driver-dev-10-0 cuda-gdb-10-0
  cuda-gpu-library-advisor-10-0 cuda-libraries-10-0 cuda-libraries-dev-10-0 cuda-license-10-0 cuda-memcheck-10-0 cuda-misc-headers-10-0 cuda-npp-10-0
  cuda-npp-dev-10-0 cuda-nsight-10-0 cuda-nsight-compute-10-0 cuda-nvcc-10-0 cuda-nvdisasm-10-0 cuda-nvgraph-10-0 cuda-nvgraph-dev-10-0 cuda-nvjpeg-10-0
  cuda-nvjpeg-dev-10-0 cuda-nvml-dev-10-0 cuda-nvprof-10-0 cuda-nvprune-10-0 cuda-nvrtc-10-0 cuda-nvrtc-dev-10-0 cuda-nvtx-10-0 cuda-nvvp-10-0
  cuda-samples-10-0 cuda-toolkit-10-0 cuda-tools-10-0 cuda-visual-tools-10-0 gcc-5-aarch64-linux-gnu-base gcc-5-cross-base libasan2-arm64-cross
  libatomic1-arm64-cross libc6-arm64-cross libc6-dev-arm64-cross libclang1-3.6 libgcc-5-dev-arm64-cross libgcc1-arm64-cross libgomp1-arm64-cross libgsoap8
  libitm1-arm64-cross libllvm3.6v5 libnunit-cil-dev libnunit-console-runner2.6.3-cil libnunit-core-interfaces2.6.3-cil libnunit-core2.6.3-cil
  libnunit-framework2.6.3-cil libnunit-mocks2.6.3-cil libnunit-util2.6.3-cil libpng16-16 libpython-dbg libpython2.7-dbg libstdc++-5-dev-arm64-cross
  libstdc++6-arm64-cross libubsan0-arm64-cross libvncserver1 libxmu-dev libxmu-headers linux-libc-dev-arm64-cross python-dbg python-kerberos python2.7-dbg
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] 
Setting up ubuntu-advantage-tools (27.0~16.04.1) ...
Traceback (most recent call last):
  File "<string>", line 2, in <module>
ModuleNotFoundError: No module named 'uaclient'
dpkg: error processing package ubuntu-advantage-tools (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 ubuntu-advantage-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)

The command python is linked to python2.7 and python3 is linked to python3.5 using alternative system.(update-alternatives). What can I do next?

ADD :
I saw somewhere I have to reinstall opca-client so did this,

ckim@chan-ubuntu:~$ sudo pip3 install --upgrade opcua-client

and then I saw a warning about pip version, so I did sudo pip install --upgrade pip
and then sudo pip3 install --upgrade opcua-client but now see this error below :

....
Do you want to continue? [Y/n] 
Setting up ubuntu-advantage-tools (27.0~16.04.1) ...
Traceback (most recent call last):
  File "<string>", line 2, in <module>
ModuleNotFoundError: No module named 'uaclient.entitlements'
dpkg: error processing package ubuntu-advantage-tools (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 ubuntu-advantage-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)
8
  • Force remove ubuntu-advantage-tools, it is not available for 16.04. sudo dpkg --purge --force-all ubuntu-advantage-tools.
    – pLumo
    May 6 at 7:46
  • @pLumo Execuse me, but why should I purge the package? Will it solve the problem?
    – Chan Kim
    May 6 at 7:53
  • After upgrading you can reinstall it. But before, you need to fix it.
    – pLumo
    May 6 at 7:54
  • Ah.. I tried you suggestion, but it also gives me : No module named 'uaclient.apt'
    – Chan Kim
    May 6 at 7:55
  • Okay, sorry. Then I don't know how to fix the issue :-(
    – pLumo
    May 6 at 7:58
3

@Chan-Kim,

A user on Reddit had a similar issue - I saw the solution earlier, which was to update the PYTHONPATH to include /usr/lib/python3/dist-packages and then perform the updates.

I have had complete success with this.

This is what I used in my system.

export PYTHONPATH=${PYTHONPATH}:${HOME}:/usr/bin/python:/usr/lib/python3/dist-packages

the solution @ /r/linux4noobs/ - reddit.com

2
  • Hi! I have upgrade to ubuntu 20.04 so I can't check what my case was. but I chose your answer because you're a new contributor. Welcome!
    – Chan Kim
    May 16 at 2:52
  • Can confirm it works, I have tested on my Ubuntu 16.04. The only difference is that I switched to the root bash (sudo su) before running the export command. Jul 20 at 13:03
8

For me, the reason to cause this problem is that I have additional python distribution installed on my computer /usr/local/bin/python3, which comes before /usr/bin/python3 in the search path. I modified manually the post-installation and pre-remove script in /var/lib/dpkg/info/ubuntu-advantage-tools.postinst and /var/lib/dpkg/info/ubuntu-advantage-tools.prerm and replace python3 with the complete path /usr/bin/python3. This solved my problem.

2
  • 1
    This is the better fix than any of the above. Jame's solution would bugger up the python paths potentially for a long running bash terminal that can't just be turned off. Permanently fixing the bash profile too would bugger up python3 programs reliant on the local version. Thus just editing the configuration script for this package, which should have done in the first place, by fully qualifying the path instead of relying on an environment variable, is the proper fix. Developers for the package should fully qualify the usage of "python3" commands within the script! That's best practice! May 15 at 4:25
  • this might have worked for my case, but I have since then upgraded to ubuntu 20.04 and cannot test it. thanks for the good info though.
    – Chan Kim
    May 16 at 2:53
5

I got similar problem and this worked for me:

Removing the uat, process will not complete, maybe missing uaclient.apt

sudo apt-get remove ubuntu-advantage-tools

Then manually remove the uat by:

sudo mv /var/lib/dpkg/info/ubuntu-advantage-tools.* /tmp/
sudo dpkg --force-remove-reinstreq --purge ubuntu-advantage-tools
sudo dpkg --remove --force-remove-reinstreq ubuntu-advantage-tools

Then dist-upgrade or do-release-upgrade works fine for me. Upgraded to 18.04

1
  • 1
    the root as the problem is wrong system python3 version that is not compatible with ubuntu-advantage-tool, if possible upgrade system python3 should be done. After upgraded to ubuntu 18.04, the system suggest to runautoremove but this can break applications that still rely on old python (the outdated 3.5)
    – Tin Pham
    May 15 at 17:49
0

You should install opcua and opcua-client with default python command:

python -m pip install --upgrade opcua

python -m pip install --upgrade opcua-client

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.