gem5 FS mode run as super user fails with "IOError: Can't find a path to system files."

gem5 FS mode run as super user fails with "IOError: Can't find a path to system files."

我正在尝试 运行 FS 模式下的 gem5。它工作正常。但是如果我切换到超级用户(使用 sudo su)然后尝试我得到以下错误-

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/test/gem5/src/python/m5/main.py", line 435, in main
    exec filecode in scope
  File "configs/example/fs.py", line 344, in <module>
    test_sys = build_test_system(np)
  File "configs/example/fs.py", line 99, in build_test_system
    options.ruby, cmdline=cmdline)
  File "/home/test/gem5/configs/common/FSConfig.py", line 637, in makeLinuxX86System
    makeX86System(mem_mode, numCPUs, mdesc, self, Ruby)
  File "/home/test/gem5/configs/common/FSConfig.py", line 562, in makeX86System
    disk0.childImage(mdesc.disk())
  File "/home/test/gem5/configs/common/Benchmarks.py", line 58, in disk
    return disk(self.diskname)
  File "/home/test/gem5/configs/common/SysPaths.py", line 58, in __call__
    raise IOError, "Can't find a path to system files."
IOError: Can't find a path to system files.

有线索吗??

首先,出于与任何其他程序相同的原因,请尽可能避免使用 运行 gem5 和 sudo/as root。

我猜测通过 sudo 的命令没有看到 M5_PATH 环境变量:How to keep environment variables when using sudo 你能确保该变量对可执行文件可见吗?

最后,如 所述,不再需要 M5_PATH,所以我真的永远不会使用它,而只是通过命令行选项明确指向 gem5 需要的文件。