QubesOS / qubes-issues

The Qubes OS Project issue tracker
https://www.qubes-os.org/doc/issue-tracking/
534 stars 46 forks source link

Device Information: Failed to Load System Data #8777

Open nobugsdev opened 8 months ago

nobugsdev commented 8 months ago

Qubes OS release

4.2 - with all updates.

Brief summary

The Device Information section is displaying the message "Failed to load system data: Command ’ [ ‘qubes-hcl-report’, ‘-y’ ] ’ returns non-zero exit status 1.

Steps to reproduce

Open Qubes Global Config -------> This Device, or Run qubes-hcl-report in Terminal.

I ran the qubes-hcl-report command in the terminal and got the following return: “Duplicate Header Chassis Information”

Expected behavior

View information about System and HCL

Actual behavior

All System Information is "unknown"

UndeadDevel commented 8 months ago

Can't reproduce on my system (NV41 running 4.2rc5), with the exception of the "Xen" part, which does state "unknown". All other info is correctly shown.

nobugsdev commented 8 months ago

After doing a little research on my system, I was able to identify and solve the problem.

The output of the qubes-hcl-reportcommand is correct because my computer actually has 2 chassis information (laptop and docking station).

I discovered this fact by running the sudo dmidecode -t 3 command on Dom0.

I concluded that "qubes-hcl-report" was performing some validation on duplicate items.

I made a backup copy of the "qubes-hcl-report" script and, analyzing the script, discovered that there is a "check_duplicate" validation function.

To test this, I commented out this function and all its calls. I saved the script and opened Qubes Config Global. All the information was displayed, except for "Xen" which was set to "Unknown".

Doing some more research, I found that the problem with displaying "Xen" was in the "thisdevice_handler.py" file. It was just a typo. Instead of "Xen" it said "Xes". So it didn't display the value of the "Xen" variable.

All information is being displayed now.

andrewdavidwong commented 8 months ago

@nobugsdev: I'm confused. So is this actually a bug in Qubes code or just something inadvertently introduced on your own system?

nobugsdev commented 8 months ago

@andrewdavidwong,

In my opinion, it can be considered a Bug in the Qubes Code.

The author of "qubes-hcl-report" was aware of the existence of duplicate values for Hardware, because he created a Function to perform this check. He called the function "check_duplicate". This function is part of the "qubes-hcl-report" code:

function check_duplicate(k) if (k in seen_header) fail("Duplicate header " k); seen_headers[k] =1;

The problem is that if this Function finds any duplicate information, which in my case was "chassis information", it produces the error " Failed to load system data: Command ' [ 'qubes-hcl-report', '-y' ] ' returns non-zero exit status 1", which is displayed in "This Device". So all the information is displayed as "Unknown".

This_Device_Error

When I commented out the "check_duplicate" function and the calls to this function, in the "qubes-hcl-report" code, the information was displayed correctly, with the exception of "Xen", which remains as "Unknown".

In the case of "Xen" being displayed as "Unknown", as also mentioned by @UndeadDevel , it is an error in the "thisdevice_handler.py" code. In the code, the variable is "Xes", the correct one is "Xen", which is why it displays that Xen is "Unknown":

xen_ver=self._get_version('xes')) . This code is in: https://github.com/QubesOS/qubes-desktop-linux-manager/blob/main/qubes_config/global_config/thisdevice_handler.py

After commenting out the "check_duplicate" function and the calls to this function in the "qubes-hcl-report" code, and correcting the name of the "Xen" variable in the "thisdevice_handler.py" code, all the information is displayed correctly.

This_Device_Correct

JesseHelm commented 7 months ago

@andrewdavidwong,

In my opinion, it can be considered a Bug in the Qubes Code.

The author of "qubes-hcl-report" was aware of the existence of duplicate values for Hardware, because he created a Function to perform this check. He called the function "check_duplicate". This function is part of the "qubes-hcl-report" code:

function check_duplicate(k) if (k in seen_header) fail("Duplicate header " k); seen_headers[k] =1;

The problem is that if this Function finds any duplicate information, which in my case was "chassis information", it produces the error " Failed to load system data: Command ' [ 'qubes-hcl-report', '-y' ] ' returns non-zero exit status 1", which is displayed in "This Device". So all the information is displayed as "Unknown".

This_Device_Error

When I commented out the "check_duplicate" function and the calls to this function, in the "qubes-hcl-report" code, the information was displayed correctly, with the exception of "Xen", which remains as "Unknown".

In the case of "Xen" being displayed as "Unknown", as also mentioned by @UndeadDevel , it is an error in the "thisdevice_handler.py" code. In the code, the variable is "Xes", the correct one is "Xen", which is why it displays that Xen is "Unknown":

xen_ver=self._get_version('xes')) . This code is in: https://github.com/QubesOS/qubes-desktop-linux-manager/blob/main/qubes_config/global_config/thisdevice_handler.py

After commenting out the "check_duplicate" function and the calls to this function in the "qubes-hcl-report" code, and correcting the name of the "Xen" variable in the "thisdevice_handler.py" code, all the information is displayed correctly.

Hey there, I'm having this same issue and was just wondering where I actually make the edits? How do I access that code on my system. Sorry, bit of a newb here...

Thanks!

UndeadDevel commented 7 months ago

Hey there, I'm having this same issue and was just wondering where I actually make the edits? How do I access that code on my system. Sorry, bit of a newb here...

In the future, please make such requests in the forum, as this issue tracker exists to help the developers solve issues; it is not meant for user support, such as Linux tutorials etc.

In your case using the find program helps you out: in dom0 run: find / -type f -name thisdevice_handler.py | grep -v "Permission denied" > result and then cat result and you'll get the file location.

JesseHelm commented 7 months ago

Hey there, I'm having this same issue and was just wondering where I actually make the edits? How do I access that code on my system. Sorry, bit of a newb here...

In the future, please make such requests in the forum, as this issue tracker exists to help the developers solve issues; it is not meant for user support, such as Linux tutorials etc.

In your case using the find program helps you out: in dom0 run: find / -type f -name thisdevice_handler.py | grep -v "Permission denied" > result and then cat result and you'll get the file location.

Shoot, sorry about that, thanks for taking the time to reply with the answer though :)