在“sudo apt upgrade”(ubuntu 16.04)期间没有名为“uaclient”的模块

Cha*_*Kim 3 upgrade python apt 16.04

我正在尝试将我的桌面从 ubuntu 16.04 升级到 18.04。
(很遗憾没有在ubuntu 16.04 EOL到来之前提前升级。两周前我已经将两个16.04笔记本升级到18.04,尽管是在EOL之后,当时我只能解决一些小问题)。
我做了,sudo apt update但在那apt upgrade之后我收到了下面的错误。

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)
Run Code Online (Sandbox Code Playgroud)

命令 python 链接到 python2.7,python3 链接到 python3.5 使用替代系统。(更新替代)。我接下来可以做什么?

添加:
我看到某处我必须重新安装 opca-client 所以这样做了,

ckim@chan-ubuntu:~$ sudo pip3 install --upgrade opcua-client
Run Code Online (Sandbox Code Playgroud)

然后我看到了关于 pip 版本的警告,所以我做了 sudo pip install
--upgrade pip然后 sudo pip3 install --upgrade opcua-client 但现在看到下面的这个错误:

....
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)
Run Code Online (Sandbox Code Playgroud)

Lei*_*hao 8

对我来说,导致这个问题的原因是我的电脑上安装了额外的 python 发行版/usr/local/bin/python3,它出现/usr/bin/python3在搜索路径之前。我手动修改了 和 中的安装后和预删除脚本/var/lib/dpkg/info/ubuntu-advantage-tools.postinst/var/lib/dpkg/info/ubuntu-advantage-tools.prerm并替换python3为完整路径/usr/bin/python3。这解决了我的问题。


小智 6

@陈金,

Reddit 上的用户也有类似的问题 - 我之前看到了解决方案,即更新 PYTHONPATH 以包含 /usr/lib/python3/dist-packages,然后执行更新。

我在这方面取得了完全的成功。

这是我在我的系统中使用的。

export PYTHONPATH=${PYTHONPATH}:${HOME}:/usr/bin/python:/usr/lib/python3/dist-packages
Run Code Online (Sandbox Code Playgroud)

解决方案@ /r/linux4noobs/ - reddit.com


小智 5

我遇到了类似的问题,这对我有用:

删除uat,过程不会完成,可能缺少uaclient.apt

sudo apt-get remove ubuntu-advantage-tools
Run Code Online (Sandbox Code Playgroud)

然后通过以下方式手动删除uat:

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
Run Code Online (Sandbox Code Playgroud)

然后dist-upgradedo-release-upgrade对我来说很好。升级到 18.04