OpenInterpreter / 01

The #1 open-source voice interface for desktop, mobile, and ESP32 chips.
https://01.openinterpreter.com/
GNU Affero General Public License v3.0
4.97k stars 527 forks source link

Access Issue with Linux `dmesg` #226

Open rbrisita opened 7 months ago

rbrisita commented 7 months ago

Describe the bug The software\source\server\utils\kernel.py function get_kernel_messages is trying to access a file that doesn't exist on some Linux distros (all?) like Arch, Debian, and Fedora. Unfortunately, similar logs like /var/log/syslog and /var/log/kern.log have access restrictions. This is a security concern.

To Reproduce Run poetry run 01 on any Linux distro based on Arch, Debian, Fedora.

Expected behavior A clean boot into 01OS.

Desktop (please complete the following information):

Additional context

Task exception was never retrieved
future: <Task finished name='Task-6' coro=<put_kernel_messages_into_queue() done, defined at /home/rb/projects/Open>
Traceback (most recent call last):
 File "/home/rb/projects/OpenInterpreter/01/software/source/server/utils/kernel.py", line 65, in put_kernel_messag>
   text = check_filtered_kernel()
 File "/home/rb/projects/OpenInterpreter/01/software/source/server/utils/kernel.py", line 47, in check_filtered_ke>
   messages = get_kernel_messages()
 File "/home/rb/projects/OpenInterpreter/01/software/source/server/utils/kernel.py", line 23, in get_kernel_messag>
   with open('/var/log/dmesg', 'r') as file:
FileNotFoundError: [Errno 2] No such file or directory: '/var/log/dmesg'
rbrisita commented 7 months ago

To resolve quickly simply touch /var/log/dmesg, you might need elevated privileges.

The user has access to the dmesg command and can run without elevated privileges and there is also a readable /dev/kmsg file that is kernel messages but I don't know exactly why 01OS needs access or what messages it will act on.

Proposed PR solution:

  1. Test for the existence of binary dmesg
  2. Pipe dmesg to /tmp/dmesg
  3. Return the path /tmp/dmesg to be used in get_kernel_messages function or None