Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global Config: Unexpected policy file contents message at top of USB Devices window #9433

Open
andrewdavidwong opened this issue Aug 31, 2024 · 11 comments
Labels
affects-4.2 This issue affects Qubes OS 4.2. C: core C: manager/widget needs diagnosis Requires technical diagnosis from developer. Replace with "diagnosed" or remove if otherwise closed. P: default Priority: default. Default priority for new issues, to be replaced given sufficient information. T: bug Type: bug report. A problem or defect resulting in unintended behavior in something that exists. ux User experience

Comments

@andrewdavidwong
Copy link
Member

How to file a helpful issue

Qubes OS release

4.2

Brief summary

When I open Qubes OS Global Config and select USB Devices on the left, there's a red box at the top with a message about Unexpected policy file contents.

Steps to reproduce

  1. Open Qubes OS Global Config.
  2. Select USB Devices in the menu on the left.

Expected behavior

No warnings or errors about unexpected policy file contents (or an explanation of what the problem is and what, if anything, should be done about it).

Actual behavior

1

Text version:

Unexpected policy file contents:
Unexpected policy rule: qubes.InputMouse    *   sys-usb @adminvm deny
Unexpected policy rule: qubes.InputKeyboard *   sys-usb @adminvm deny
Unexpected policy rule: qubes.InputTablet *    sys-usb @adminvm deny

Commentary

It's not obvious to me where these rules came from or what's wrong with them.

Let's try a grep:

$ grep -r 'qubes.InputTablet' /etc/qubes/policy.d/*
/etc/qubes/policy.d/50-config-input.policy:qubes.InputTablet * sys-usb dom0 deny
$

Okay, it looks like qubes.InputTablet is present in only one place: 50-config-input.policy. This appears to be a default policy file that was created by Qubes OS. As far as I know, I've never touched this file. I put all of my custom rules in 30-user.policy. I also don't have any qubes.InputTablet rules of my own, or else they would've shown up in the grep results.

@andrewdavidwong andrewdavidwong added T: bug Type: bug report. A problem or defect resulting in unintended behavior in something that exists. C: core C: manager/widget P: default Priority: default. Default priority for new issues, to be replaced given sufficient information. needs diagnosis Requires technical diagnosis from developer. Replace with "diagnosed" or remove if otherwise closed. affects-4.2 This issue affects Qubes OS 4.2. labels Aug 31, 2024
@alimirjamali
Copy link

It would be helpful if we could see what is below the red box. The screen snapshot does not show that.

@andrewdavidwong
Copy link
Member Author

It would be helpful if we could see what is below the red box. The screen snapshot does not show that.

Why would that be helpful? I excluded it because I thought it was irrelevant.

@alimirjamali
Copy link

Why would that be helpful? I excluded it because I thought it was irrelevant.

GUI Widgets are usually in order (from left to right, top to bottom). Having a clue on the failing widget should allow easier troubleshooting while inspecting the Glade files. It should be something like this:

Global_settings

I would like to know what is failing there. The USB Qube query or the 3 drop-down menus down. I suspect the former. But I want to be sure.

@andrewdavidwong
Copy link
Member Author

I think you might be right. Another reason I didn't want to include this portion is because my USB qube name is not sys-usb, and I don't wish to disclose the name publicly. Here's the text version of what appears in that section:

USB qube            *******
Keyboard:           disable
Mouse:              disable
Touchscreen/tablet: disable

@marmarek
Copy link
Member

marmarek commented Sep 2, 2024

my USB qube name is not sys-usb

I think this is the key information. Yet the rules are about sys-usb (I assume added by the installer, when it created sys-usb which you later removed/renamed).

IMO in this situation (expected set of input-proxy rules for no longer existing USB qube) the message should be different, like "found rules for not existing USB qube, they will be removed when saving changes on this tab", or something like this.

@marmarta what do you think?

@alimirjamali
Copy link

I believe I have a clear idea on what is happening here. The errors belong to usb_input_problem_warn_label GtkLabel widget in Glade file. Which is imported as InputDeviceHandler.warn_label in code. And the errors are appended to the label due to this condition which is commented as non-fatal (minor bug). This makes sense. sys-usb is renamed here.

@alimirjamali
Copy link

Yes. I can reproduce the bug:

global_config2

One approach to fix it would be be to ignore stock policies for sys-usb in the condition.
Another approach would be providing a better message to user to comment-out the stock policies.

@andrewdavidwong andrewdavidwong added P: minor Priority: minor. The lowest priority, below "default." diagnosed Technical diagnosis has been performed (see issue comments). ux User experience and removed P: default Priority: default. Default priority for new issues, to be replaced given sufficient information. needs diagnosis Requires technical diagnosis from developer. Replace with "diagnosed" or remove if otherwise closed. labels Sep 3, 2024
@marmarta
Copy link
Member

marmarta commented Sep 3, 2024

I don't think we should ignore policies completely - but I think the approach with "this contains policies for a non-existent qube" is better. Not sure if we should discard them completely... there could be some interaction with backup/restore that leads to unexpected configuration loss here?

Also, it would be nice to have a single place in the system to define which one is a sys-usb (I know we can't, but a girl can dream, right?)

@alimirjamali
Copy link

Also, it would be nice to have a single place in the system to define which one is a sys-usb (I know we can't, but a girl can dream, right?)

This might be doable. The same mechanism that detects PCI USB Controllers and attaches them to the stock sys-usb could be used to detect qube (or qubes) with attached USB Controllers.

@marmarek
Copy link
Member

marmarek commented Sep 3, 2024

detect qube (or qubes) with attached USB Controllers.

This is more or less what the global config already does to list USB qubes on this screen. It does with multiple of them too (for example I have one per controller on one of my system and it works just fine).

@marmarta
Copy link
Member

marmarta commented Sep 3, 2024

Yeah, but I'd like for things to magically happen when a user connects a USB controller to a qube. Automatically - or with a question - modified policies etc. But I think this could open problems in edge cases.

@andrewdavidwong andrewdavidwong added P: default Priority: default. Default priority for new issues, to be replaced given sufficient information. needs diagnosis Requires technical diagnosis from developer. Replace with "diagnosed" or remove if otherwise closed. and removed P: minor Priority: minor. The lowest priority, below "default." diagnosed Technical diagnosis has been performed (see issue comments). labels Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-4.2 This issue affects Qubes OS 4.2. C: core C: manager/widget needs diagnosis Requires technical diagnosis from developer. Replace with "diagnosed" or remove if otherwise closed. P: default Priority: default. Default priority for new issues, to be replaced given sufficient information. T: bug Type: bug report. A problem or defect resulting in unintended behavior in something that exists. ux User experience
Projects
None yet
Development

No branches or pull requests

4 participants