eclipse-volttron / volttron-core

Other
5 stars 9 forks source link

Volttron fails to start due to FileNotFoundError #35

Open bonicim opened 2 years ago

bonicim commented 2 years ago

After following the README instructions to start volttron, I received the following error:

 File "/usr/local/Cellar/python@3.9/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/Cellar/python@3.9/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/Users/boni407/Workplace/volttron-project/volttron-core/volttron/server/__main__.py", line 1029, in <module>
    _main()
  File "/Users/boni407/Workplace/volttron-project/volttron-core/volttron/server/__main__.py", line 1023, in _main
    sys.exit(main())
  File "/Users/boni407/Workplace/volttron-project/volttron-core/volttron/server/__main__.py", line 1017, in main
    start_volttron_process(opts)
  File "/Users/boni407/Workplace/volttron-project/volttron-core/volttron/server/__main__.py", line 286, in start_volttron_process
    opts.aip.setup()
  File "/Users/boni407/Workplace/volttron-project/volttron-core/volttron/server/aip.py", line 422, in setup
    Certs()
  File "/Users/boni407/Workplace/volttron-project/volttron-core/volttron/utils/certs.py", line 326, in __init__
    self.default_root_ca_cn = f"{get_hostname()} {self.root_ca_name}"
  File "/Users/boni407/Workplace/volttron-project/volttron-core/volttron/utils/network.py", line 70, in get_hostname
    with open("/etc/hostname") as fp:
FileNotFoundError: [Errno 2] No such file or directory: '/etc/hostname'

[1]  + 92519 exit 1     python3 -m volttron.server -vv -l volttron.log

Environement:

OS: MacOS 10.15.7 Python: 3.9.10 Poetry: 1.1.13

Steps to reproduce:

  1. Install all dependencies
  2. Activate environment
  3. Run the following command to start volttron: python3 -m volttron.server -vv -l volttron.log &
craig8 commented 2 years ago

please add a /etc/hostname file with your system name in it. I will look into this however.

schandrika commented 2 years ago

@bonicim @craig8 This is on a MacOS. We have not officially tested VOLTTRON on mac and sure not the RMQ setup with certs.

@bonicim Does you machine have a hostname assigned. Does mac even have a hostname file or is it all read from /etc/hosts. We could do if Mac read from /etc/hosts but doubt if that is readable by all. Might need admin access to read that file. Could you check

bonicim commented 2 years ago

@bonicim @craig8 This is on a MacOS. We have not officially tested VOLTTRON on mac and sure not the RMQ setup with certs.

@bonicim Does you machine have a hostname assigned. Does mac even have a hostname file or is it all read from /etc/hosts. We could do if Mac read from /etc/hosts but doubt if that is readable by all. Might need admin access to read that file. Could you check

@schandrika MacOS has /etc/hosts but no /etc/hostname. I think MacOS doesn't have a /etc/hostname.

➜ ls -lh /etc/hosts
-rw-r--r--  1 root  wheel   365B Apr 26 09:50 /etc/hosts
➜ ls -lh /etc/hostname
ls: /etc/hostname: No such file or directory
craig8 commented 2 years ago

True, though we do have some code where we do some special stuff with sockets, as unix (mac) sockets don't have an @ in them or the other way around. We could easily detect if that's the only change. But it is not on the radar as a necessary thing at present.