Search code examples
gem5

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


I am trying to run gem5 in FS mode. It works fine. But If I switch to super user(using sudo su) and then try then I get below error-

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.

Any lead??


Solution

  • First, avoid running gem5 as with sudo/as root if you can, for the same reasons as any other programs.

    I would guess that the command through sudo is not seeing the M5_PATH environment variable: How to keep environment variables when using sudo Can you ensure that the variable is visible to the executable?

    Finally, as mentioned at Gem 5 IOError: Can't find a path to system files. Full System X86 simulation setup M5_PATH is not needed anymore, so I would really just never use it, and just explicitly point to the files gem5 needs with the command line options.