WSL下,BMC Studio启动报错

在wsl下,环境配置完毕,可以正常出包,但启动BMC Studio,会有报错提示:

网上找到一个方案,如下,在powersehll下,直接输入:

&([ScriptBlock]::Create((irm https://gist.githubusercontent.com/emilwojcik93/6f337453a482f15dde4959d0b032ae0e/raw/Fix-WSLInterop.ps1))) -Verbose

即可解决红色字体的那个出错提示。

再次启动后,还是有一个出错提示,不知道是不是正常:

就是这个:Failed to auto-open in WSL

WSL Interoperability is disabled. Please enable it before using WSL.这个报错的意思是您的WSL环境中,互操作功能被禁用了,即 WSL 无法与 Windows 环境交互(访问 C 盘文件、或使用 Windows 命令)。一般不影响BMC Studio功能。

关于下一个报错,这是因为您的xdg-utils执行出错了,不知道您的web前端页面是否可以正常自动打开?如果无法打开的话,需要您手动在浏览器中输入http://localhost:10000打开。

此外能否请您在bmc studio后端启动的时候,执行一下xdg-open "http://localhost:10000"这个命令看看回显,确认一下是什么报错信息?

web前端页面是否可以正常自动打开,根据您说的:

/usr/share/bmc_studio/bmc_studio.sh start backend(后台启动)
然后输入:

xdg-open "http://localhost:10000"

显示信息如下:

感觉可能是您wsl没有挂载上/mnt,一般来说执行windows的程序是通过/mnt/c/xxx的路径来的,但是您这里是/root/c/xxx。

如果需要临时方案的话,请您打开/usr/share/bmc_studio文件夹,找到一个叫bmc_studio.sh的文件,将第68行修改为

/mnt/c/Windows/System32/cmd.exe /C start "${url}" 2>/dev/null || echo "Failed to auto-open in WSL" >&2

然后重新运行bingo studio打开studio即可

/mnt是挂在上了:

image

ls /mnt/c/Windows/System32 | head 命令输出:

我的环境,workspace为了节省C盘空间,是安装到linux系统内部空间的,如下所示:

image

是不是这个原因引起的?

应该不是工作空间放在linux中导致的,是wsl本身的设置不太对,如果急用的话先用之前给您的临时方案启动吧。

请您打开/usr/share/bmc_studio文件夹,找到一个叫bmc_studio.sh的文件,将第68行修改为

/mnt/c/Windows/System32/cmd.exe /C start "${url}" 2>/dev/null || echo "Failed to auto-open in WSL" >&2

然后可能需要您执行一下这两个命令帮忙调试:

strace -e openat xdg-open http://localhost:10000
echo $PATH

因为回显结果可能比较长,能不能麻烦您贴上文字版的回显结果?

回显信息如下:

root@DESKTOP-MLN0FMA:~# strace -e openat xdg-open http://localhost:10000
echo $PATH
openat(AT_FDCWD, “/etc/ld.so.cache”, O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, “/lib/x86_64-linux-gnu/libtinfo.so.6”, O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, “/lib/x86_64-linux-gnu/libc.so.6”, O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, “/dev/tty”, O_RDWR|O_NONBLOCK) = 3
openat(AT_FDCWD, “/usr/lib/locale/locale-archive”, O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, “/usr/share/locale/locale.alias”, O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, “/usr/lib/locale/C.UTF-8/LC_IDENTIFICATION”, O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, “/usr/lib/locale/C.utf8/LC_IDENTIFICATION”, O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, “/usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache”, O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, “/usr/lib/locale/C.UTF-8/LC_MEASUREMENT”, O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, “/usr/lib/locale/C.utf8/LC_MEASUREMENT”, O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, “/usr/lib/locale/C.UTF-8/LC_TELEPHONE”, O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, “/usr/lib/locale/C.utf8/LC_TELEPHONE”, O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, “/usr/lib/locale/C.UTF-8/LC_ADDRESS”, O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, “/usr/lib/locale/C.utf8/LC_ADDRESS”, O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, “/usr/lib/locale/C.UTF-8/LC_NAME”, O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, “/usr/lib/locale/C.utf8/LC_NAME”, O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, “/usr/lib/locale/C.UTF-8/LC_PAPER”, O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, “/usr/lib/locale/C.utf8/LC_PAPER”, O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, “/usr/lib/locale/C.UTF-8/LC_MESSAGES”, O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, “/usr/lib/locale/C.utf8/LC_MESSAGES”, O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, “/usr/lib/locale/C.utf8/LC_MESSAGES/SYS_LC_MESSAGES”, O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, “/usr/lib/locale/C.UTF-8/LC_MONETARY”, O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, “/usr/lib/locale/C.utf8/LC_MONETARY”, O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, “/usr/lib/locale/C.UTF-8/LC_COLLATE”, O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, “/usr/lib/locale/C.utf8/LC_COLLATE”, O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, “/usr/lib/locale/C.UTF-8/LC_TIME”, O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, “/usr/lib/locale/C.utf8/LC_TIME”, O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, “/usr/lib/locale/C.UTF-8/LC_NUMERIC”, O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, “/usr/lib/locale/C.utf8/LC_NUMERIC”, O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, “/usr/lib/locale/C.UTF-8/LC_CTYPE”, O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, “/usr/lib/locale/C.utf8/LC_CTYPE”, O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, “/usr/bin/xdg-open”, O_RDONLY) = 3
— SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=688, si_uid=0, si_status=1, si_utime=0, si_stime=0} —
— SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=690, si_uid=0, si_status=0, si_utime=0, si_stime=0} —
— SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=692, si_uid=0, si_status=0, si_utime=0, si_stime=0} —
— SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=694, si_uid=0, si_status=0, si_utime=0, si_stime=0} —
— SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=696, si_uid=0, si_status=0, si_utime=0, si_stime=0} —
— SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=698, si_uid=0, si_status=0, si_utime=0, si_stime=0} —
— SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=700, si_uid=0, si_status=0, si_utime=0, si_stime=0} —
— SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=702, si_uid=0, si_status=0, si_utime=0, si_stime=0} —
— SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=705, si_uid=0, si_status=0, si_utime=0, si_stime=0} —
— SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=744, si_uid=0, si_status=0, si_utime=0, si_stime=0} —
— SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=747, si_uid=0, si_status=0, si_utime=0, si_stime=0} —
openat(AT_FDCWD, “/root/.local/share/applications//”, O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or directory)
— SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=750, si_uid=0, si_status=0, si_utime=0, si_stime=0} —
openat(AT_FDCWD, “/usr/local/share/applications//”, O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or directory)
— SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=753, si_uid=0, si_status=0, si_utime=0, si_stime=0} —
— SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=758, si_uid=0, si_status=0, si_utime=0, si_stime=0} —
— SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=760, si_uid=0, si_status=0, si_utime=0, si_stime=0} —
— SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=763, si_uid=0, si_status=0, si_utime=0, si_stime=0} —
— SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=766, si_uid=0, si_status=0, si_utime=0, si_stime=0} —
— SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=771, si_uid=0, si_status=0, si_utime=0, si_stime=0} —
ls: cannot access ‘root/’: No such file or directory
/usr/bin/wslview: line 216: root/c/Windows/System32/reg.exe: No such file or directory
ls: cannot access ‘root/’: No such file or directory
/usr/bin/wslview: line 149: root/c/Windows/System32/chcp.com: No such file or directory
ls: cannot access ‘root/’: No such file or directory
/usr/bin/wslview: line 156: root/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe: No such file or directory
ls: cannot access ‘root/’: No such file or directory
/usr/bin/wslview: line 149: root/c/Windows/System32/chcp.com: No such file or directory
— SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=774, si_uid=0, si_status=127, si_utime=0, si_stime=0} —
+++ exited with 4 +++
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Program Files (x86)/VMware/VMware Workstation/bin/:/mnt/c/Windows/system32:/mnt/c/Windows:/mnt/c/Windows/System32/Wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0/:/mnt/c/Windows/System32/OpenSSH/:/mnt/c/Program Files/dotnet/:/mnt/d/C_ToolChain/WinAVR-20100110/bin:/mnt/d/C_ToolChain/WinAVR-20100110/utils/bin:/mnt/d/C_ToolChain/MinGW/bin:/mnt/d/C_ToolChain/MinGW/mingw32/bin:/mnt/d/C_ToolChain/WATCOM/BINNT64:/mnt/d/C_ToolChain/WATCOM/BINNT:/mnt/d/C_ToolChain/WATCOM/NASM:/mnt/c/Program Files (x86)/Microsoft SQL Server/100/Tools/Binn/:/mnt/c/Program Files (x86)/Microsoft SQL Server/100/DTS/Binn/:/mnt/c/Program Files (x86)/Ixia/Tcl/8.5.17.0/bin:/mnt/c/pango/PDS_2023.2-SP2/arch/lib/P1735/openssl:/mnt/c/Program Files/Microsoft VS Code/bin:/mnt/c/Program Files/Mellanox/WinMFT/:/mnt/c/Program Files (x86)/Ixia/Perl/site/bin:/mnt/c/Program Files (x86)/Ixia/Perl/bin:/mnt/c/Users/hushu/.local/bin:/mnt/c/Users/hushu/AppData/Local/Programs/Python/Launcher/:/mnt/c/Python/Python312/Scripts/:/mnt/c/Python/Python312/:/mnt/c/Cadence/SPB_16.6/openaccess/bin/win32/opt:/mnt/c/Cadence/SPB_16.6/tools/capture:/mnt/c/Cadence/SPB_16.6/tools/pspice:/mnt/c/Cadence/SPB_16.6/tools/specctra/bin:/mnt/c/Cadence/SPB_16.6/tools/fet/bin:/mnt/c/Cadence/SPB_16.6/tools/libutil/bin:/mnt/c/Cadence/SPB_16.6/tools/bin:/mnt/c/Cadence/SPB_16.6/tools/pcb/bin:/mnt/c/Users/hushu/AppData/Local/Microsoft/WindowsApps:/mnt/c/modeltech64_2020.4/win64:/mnt/c/iverilog/bin:/mnt/c/iverilog/gtkwave/bin:/snap/bin

另外,按您的指导,直接修改bmc_studio.sh,问题可以解决!!

很高兴您可以成功打开BMC Studio。感觉您遇到的情况应该是/usr/bin/wslview这个文件出了问题,在执行的时候错误地把windows的路径加载为了/root/c而非/mnt/c。能否请您再提供一下您的这个文件帮忙定位?

当然可以,请看附件:

wslview.txt (11.6 KB)

谢谢。

可以看到这个文件里是用interop_prefix这个函数获取windows系统的路径的,并且默认情况下是

win_location="/mnt/"

但是它还会去/etc/wsl.conf这个文件里读取参数,读取带“root”的行并且读取“=”后面的字符

tmp="$(awk -F '=' '/root/ {print $2}' /etc/wsl.conf | awk '{$1=$1;print}')"

现在的情况应该是这里出了问题,可能是您的/etc/wsl.conf里有这么一行

root = /root/

请检查一下

不知道有没有解决您的问题?如果解决了的话帮忙点个解决方案吧

查看了这个文件,没有发现这行,wsl.conf内容如下:

那您将以下代码复制粘贴进wsl.conf里,手动添加一下路径试试看?

[automount]
root = /mnt/
options = “metadata”

直接放在最后就行

这样还是一样,我感觉这是wsl的bug,我修改默认用户为非root用户,然后登陆后,su到root即可。

这样测试就没问题了。

最近发现了是wslu的bug

tmp="$(awk -F '=' '/root/ {print $2}' /etc/wsl.conf | awk '{$1=$1;print}')"

这行代码的/root/其实是正则表达式,也就是说wslu会去识别您的/etc/wsl.conf配置中所有带root的行(我之前疏忽了,以为是会去匹配含有”/root/”的行),然后您的

default=root

不幸被wslu识别为windows挂载点配置,认为您配置了地址为/root而非/mnt。

要解决这个问题的话,您可以将/usr/bin/wslview这个文件的114行至119行删除以避免出现bug。

如果后续有需要配置windows挂载点,请将这几行加回。