MycroftAI / mark-ii-sandbox

Image for the Mark II based on Raspberry Pi OS
5 stars 9 forks source link

Failed to start DBus server for hardware access #2

Open fquirin opened 1 year ago

fquirin commented 1 year ago

Describe the bug

After a fresh installation of the 20221108-mark2_base.img image the Raspberry Pi will boot up but cannot start the DBus server. As a result the commands to control fan, LEDs and microphone won't work.

To Reproduce

Steps to reproduce the behavior:

  1. Flash the image to a new SD card
  2. Boot the system
  3. See errors

Expected behavior

DBus server will start as intended.

Log files

systemctl status mark2-hal.service
● mark2-hal.service - DBus server for hardware access
     Loaded: loaded (/etc/systemd/system/mark2-hal.service; enabled; vendor preset: enabled)
     Active: activating (start) since Fri 2023-03-03 09:52:00 GMT; 46s ago
   Main PID: 1004 (python3)
      Tasks: 4 (limit: 1770)
        CPU: 1.578s
     CGroup: /system.slice/mark2-hal.service
             └─1004 /usr/local/mycroft/mark-2/dbus-hal/.venv/bin/python3 -m dbus_hal --websocket

Mar 03 09:52:36 raspberrypi python3[1004]:     self.sock, addrs = connect(url, self.sock_opt, proxy_info(**options),
Mar 03 09:52:36 raspberrypi python3[1004]:   File "/usr/local/mycroft/mark-2/dbus-hal/.venv/lib/python3.9/site-packages/websocket/_http.py", line 130, in connect
Mar 03 09:52:36 raspberrypi python3[1004]:     sock = _open_socket(addrinfo_list, options.sockopt, options.timeout)
Mar 03 09:52:36 raspberrypi python3[1004]:   File "/usr/local/mycroft/mark-2/dbus-hal/.venv/lib/python3.9/site-packages/websocket/_http.py", line 205, in _open_socket
Mar 03 09:52:36 raspberrypi python3[1004]:     raise err
Mar 03 09:52:36 raspberrypi python3[1004]:   File "/usr/local/mycroft/mark-2/dbus-hal/.venv/lib/python3.9/site-packages/websocket/_http.py", line 185, in _open_socket
Mar 03 09:52:36 raspberrypi python3[1004]:     sock.connect(address)
Mar 03 09:52:36 raspberrypi python3[1004]: ConnectionRefusedError: [Errno 111] Connection refused
Mar 03 09:52:36 raspberrypi python3[1004]: ERROR:mycroft_bus_client.client.client:Exception closing websocket: ConnectionRefusedError(111, 'Connection refused')
Mar 03 09:52:36 raspberrypi python3[1004]: WARNING:mycroft_bus_client.client.client:Message Bus Client will reconnect in 40.0 seconds.

Environment (please complete the following information):

Additional context

I think the error is related to user permissions since:

fquirin commented 1 year ago

Probably related error at boot, the userconfig.service fails as well:

systemctl status userconfig.service
● userconfig.service - User configuration dialog
     Loaded: loaded (/lib/systemd/system/userconfig.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Fri 2023-03-03 11:51:23 GMT; 1min 37s ago
    Process: 757 ExecStart=/usr/lib/userconf-pi/userconf-service (code=exited, status=126)
   Main PID: 757 (code=exited, status=126)
        CPU: 66ms

Mar 03 11:51:23 raspberrypi systemd[1]: userconfig.service: Scheduled restart job, restart counter is at 5.
Mar 03 11:51:23 raspberrypi systemd[1]: Stopped User configuration dialog.
Mar 03 11:51:23 raspberrypi systemd[1]: userconfig.service: Start request repeated too quickly.
Mar 03 11:51:23 raspberrypi systemd[1]: userconfig.service: Failed with result 'exit-code'.
Mar 03 11:51:23 raspberrypi systemd[1]: Failed to start User configuration dialog.
fquirin commented 1 year ago

I was able to "fix" the DBus server by removing the --websocket flag from /etc/systemd/system/mark2-hal.service (and reinstalled dbus-hal as root via bash /usr/local/mycroft/mark-2/dbus-hal/install.sh just to make sure).

I'm not sure what the purpose is of the websocket connection as I can't find a server, but at least the tools mark2-fan, led ... work now.

[EDIT] I'm assuming the Websocket server is part of Dinkum's messagebus service but is not installed in the sandbox 🤔