netplan apply命令报错,提示:undefined symbol: g_spawn_check_wait_status
现象描述
执行netplan apply命令时报错。提示如下:
(base) root@davinci-mini:~/.pip# netplan apply Traceback (most recent call last): File "/usr/sbin/netplan", line 23, in <module> netplan.main() File "/usr/share/netplan/netplan/cli/core.py", line 42, in main self.parse_args() File "/usr/share/netplan/netplan/cli/core.py", line 35, in parse_args import netplan.cli.commands File "/usr/share/netplan/netplan/cli/commands/__init__.py", line 18, in <module> from netplan.cli.commands.apply import NetplanApply File "/usr/share/netplan/netplan/cli/commands/apply.py", line 33, in <module> from netplan.cli.sriov import apply_sriov_config File "/usr/share/netplan/netplan/cli/sriov.py", line 27, in <module> import netplan.libnetplan as libnetplan File "/usr/share/netplan/netplan/libnetplan.py", line 44, in <module> lib = ctypes.CDLL(ctypes.util.find_library('netplan')) File "/usr/lib/python3.10/ctypes/__init__.py", line 374, in __init__ self._handle = _dlopen(self._name, mode) OSError: /lib/aarch64-linux-gnu/libnetplan.so.0.0: undefined symbol: g_spawn_check_wait_status
解决方案
- 执行ldd -r查看so库链接状态和错误信息。
(base) root@davinci-mini:~/.pip# ldd -r /lib/aarch64-linux-gnu/libnetplan.so.0.0 linux-vdso.so.1 (0x0000e7ffeafcc000) libgio-2.0.so.0 => /usr/local/Ascend/mxVision/opensource/lib/libgio-2.0.so.0 (0x0000e7ffead10000) libgobject-2.0.so.0 => /usr/local/Ascend/mxVision/opensource/lib/libgobject-2.0.so.0 (0x0000e7ffeac90000) libglib-2.0.so.0 => /usr/local/Ascend/mxVision/opensource/lib/libglib-2.0.so.0 (0x0000e7ffeab10000) libyaml-0.so.2 => /lib/aarch64-linux-gnu/libyaml-0.so.2 (0x0000e7ffeaae0000) libuuid.so.1 => /lib/aarch64-linux-gnu/libuuid.so.1 (0x0000e7ffeaac0000) libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000e7ffea910000) /lib/ld-linux-aarch64.so.1 (0x0000e7ffeaf93000) libgmodule-2.0.so.0 => /usr/local/Ascend/mxVision/opensource/lib/libgmodule-2.0.so.0 (0x0000e7ffea8e0000) libz.so.1 => /lib/aarch64-linux-gnu/libz.so.1 (0x0000e7ffea8b0000) libselinux.so.1 => /lib/aarch64-linux-gnu/libselinux.so.1 (0x0000e7ffea870000) libresolv.so.2 => /lib/aarch64-linux-gnu/libresolv.so.2 (0x0000e7ffea840000) libffi.so.7 => /usr/local/Ascend/mxVision/opensource/lib/libffi.so.7 (0x0000e7ffea810000) libpthread.so.0 => /lib/aarch64-linux-gnu/libpthread.so.0 (0x0000e7ffea7f0000) libdl.so.2 => /lib/aarch64-linux-gnu/libdl.so.2 (0x0000e7ffea7d0000) libpcre2-8.so.0 => /lib/aarch64-linux-gnu/libpcre2-8.so.0 (0x0000e7ffea730000) undefined symbol: g_spawn_check_wait_status (/lib/aarch64-linux-gnu/libnetplan.so.0.0)
根据以上信息发现系统库/lib/aarch64-linux-gnu/libnetplan.so.0.0链接到多个mxVision第三方开源库,可以推测是mxVision的第三方开源库与系统版本不兼容导致。
需要确定mxVision是否为原生ubuntu 22.04下编译构建。
- 编辑环境变量文件。
~/.bashrc
- 将CANN和mxVision的环境变量注释。
# . /usr/local/Ascend/ascend-toolkit/set_env.sh # . /usr/local/Ascend/mxVision/set_env.sh
- 输入:wq保存退出。
- 使用新的终端登录并再次执行netplan apply。
(base) root@davinci-mini:~# netplan apply (base) root@davinci-mini:~#
命令执行成功。
注意如果是DHCP连接路由器的网口,执行netplan apply后IP可能会改变。
- 重新执行ldd -r发现libnetplan.so.0.0库已经链接到了正常的系统库。
ldd -r /lib/aarch64-linux-gnu/libnetplan.so.0.0 linux-vdso.so.1 (0x0000e7ffd197e000) libgio-2.0.so.0 => /lib/aarch64-linux-gnu/libgio-2.0.so.0 (0x0000e7ffd16f0000) libgobject-2.0.so.0 => /lib/aarch64-linux-gnu/libgobject-2.0.so.0 (0x0000e7ffd1670000) libglib-2.0.so.0 => /lib/aarch64-linux-gnu/libglib-2.0.so.0 (0x0000e7ffd1520000) libyaml-0.so.2 => /lib/aarch64-linux-gnu/libyaml-0.so.2 (0x0000e7ffd14f0000) libuuid.so.1 => /lib/aarch64-linux-gnu/libuuid.so.1 (0x0000e7ffd14d0000) libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000e7ffd1320000) /lib/ld-linux-aarch64.so.1 (0x0000e7ffd1945000) libgmodule-2.0.so.0 => /lib/aarch64-linux-gnu/libgmodule-2.0.so.0 (0x0000e7ffd1300000) libz.so.1 => /lib/aarch64-linux-gnu/libz.so.1 (0x0000e7ffd12d0000) libmount.so.1 => /lib/aarch64-linux-gnu/libmount.so.1 (0x0000e7ffd1270000) libselinux.so.1 => /lib/aarch64-linux-gnu/libselinux.so.1 (0x0000e7ffd1230000) libffi.so.8 => /lib/aarch64-linux-gnu/libffi.so.8 (0x0000e7ffd1210000) libpcre.so.3 => /lib/aarch64-linux-gnu/libpcre.so.3 (0x0000e7ffd1190000) libm.so.6 => /lib/aarch64-linux-gnu/libm.so.6 (0x0000e7ffd10f0000) libblkid.so.1 => /lib/aarch64-linux-gnu/libblkid.so.1 (0x0000e7ffd10a0000) libpcre2-8.so.0 => /lib/aarch64-linux-gnu/libpcre2-8.so.0 (0x0000e7ffd1000000)
- 修改“/home/HwHiAiUser/sample/notebooks/start_notebook.sh jupyter”启动脚本如下:
. /usr/local/Ascend/ascend-toolkit/set_env.sh . /usr/local/Ascend/mxVision/set_env.sh if [ $# -eq 1 ];then jupyter lab --ip $1 --allow-root --no-browser else jupyter lab --ip 192.168.137.100 --allow-root --no-browser fi
父主题: 开发者套件启动、登录与联网