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

`sudo apt upgrade` 期间没有名为“uaclient”的模块(ubuntu 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)

使用替代系统 (update-alternatives),命令 python 链接到 python2.7,python3 链接到 python3.5。我接下来该做什么?

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

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

然后我看到有关 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)

答案1

对我来说,导致此问题的原因是我在计算机上安装了额外的 Python 发行版/usr/local/bin/python3,该发行版位于搜索路径之前。我手动修改了和中的安装后和/usr/bin/python3删除前脚本,并将其替换为完整路径。这解决了我的问题。/var/lib/dpkg/info/ubuntu-advantage-tools.postinst/var/lib/dpkg/info/ubuntu-advantage-tools.prermpython3/usr/bin/python3

答案2

@Chan Kim,

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

我在这方面取得了圆满成功。

这是我在系统中使用的。

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

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

答案3

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

删除 uat,过程将无法完成,可能缺少 uaclient.apt

sudo apt-get remove ubuntu-advantage-tools

然后通过以下方式手动删除 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

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

答案4

sudo mv /var/lib/dpkg/info /var/lib/dpkg/info_old

sudo mkdir /var/lib/dpkg/info

sudo apt-get 更新

对我有用

相关内容