manjaro / mdd

Manjaro Data Donor - WIP
MIT License
12 stars 3 forks source link

Traceback on os-prober call with debug logging #14

Open mahlzahn opened 2 weeks ago

mahlzahn commented 2 weeks ago

The detection of Windows Boot Manager with os-prober requires admin rights (sudo), thus running

mdd --dry-run

without sudo does not work. On the other hand, running

sudo mdd --dry-run

works well for the detection of Windows Boot Manager, but it struggles detecting the Display Manager with following error message and output

xset:  unable to open display ""
…
    "desktop": {
        "cli": "/usr/bin/bash",
        "gui": "i3",
        "dm": "",
        "wm": null,
        "display": "unspecified",
        "display_with": "Xwayland"
    }

instead of "display": "x11".

What kind of works, is running any command with sudo before. Then, mdd calls sudo -n os-prober within the timeout of sudo (15 min). But this should not be intended to be used like this.

romangg commented 2 weeks ago

MDD has code to try to use sudo internally if no password is needed to use os-prober, so that should still work even when running the script as user.

In case that doesn't work it should fall back to a partition analysis and hopefully this way find out about Windows dual boot systems.

Can you try to run mdd --dry-run --log DEBUG to get more info on this?

If you run the script as root indeed some data about X11 session might be not available. But this is a different issue.

mahlzahn commented 2 weeks ago

Here, the debug messages:

mdd --dry-run --log DEBUG ``` [2024-11-07T13:59:40] INFO ...get system info [2024-11-07T13:59:40] INFO ...get boot info [2024-11-07T13:59:40] INFO ...get cpu info [2024-11-07T13:59:40] INFO ...get memory info [2024-11-07T13:59:40] INFO ...get graphics info [2024-11-07T13:59:40] INFO ...get audio info [2024-11-07T13:59:40] INFO ...get disk info [2024-11-07T13:59:40] INFO ...check for Windows dualboot [2024-11-07T13:59:40] INFO Attempting to use os-prober... [2024-11-07T13:59:40] INFO ...check for Windows with os-prober [2024-11-07T13:59:40] INFO os-prober call failed, trying elevated [2024-11-07T13:59:40] INFO os-prober failed: can not elevate os-prober call [2024-11-07T13:59:40] INFO Falling back to partition analysis... [2024-11-07T13:59:40] INFO ...check for Windows dualboot with lsblk [2024-11-07T13:59:40] INFO No partition found with Windows characteristics. Assuming single-boot system. [2024-11-07T13:59:40] INFO ...get locale info [2024-11-07T13:59:40] DEBUG /etc/timezone found, contents: Europe/Rome [2024-11-07T13:59:40] DEBUG /etc/localtime found [2024-11-07T13:59:40] DEBUG 2 found: {'/etc/timezone': 'Europe/Rome', '/etc/localtime is a symlink to': 'Europe/Rome'} [2024-11-07T13:59:40] INFO ...get package info [2024-11-07T13:59:47] INFO ...get pacman-mirrors info [2024-11-07T13:59:48] INFO ...get desktop info ```
sudo mdd --dry-run --log DEBUG ``` [2024-11-07T14:04:46] INFO ...get system info [2024-11-07T14:04:46] INFO ...get boot info [2024-11-07T14:04:46] INFO ...get cpu info [2024-11-07T14:04:46] INFO ...get memory info [2024-11-07T14:04:46] INFO ...get graphics info [2024-11-07T14:04:46] INFO ...get audio info xset: unable to open display "" xset: unable to open display "" xset: unable to open display "" [2024-11-07T14:04:46] INFO ...get disk info [2024-11-07T14:04:46] INFO ...check for Windows dualboot [2024-11-07T14:04:46] INFO Attempting to use os-prober... [2024-11-07T14:04:46] INFO ...check for Windows with os-prober --- Logging error --- Traceback (most recent call last): File "/usr/lib/python3.12/logging/__init__.py", line 1160, in emit msg = self.format(record) ^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/logging/__init__.py", line 999, in format return fmt.format(record) ^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/logging/__init__.py", line 703, in format record.message = record.getMessage() ^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/logging/__init__.py", line 392, in getMessage msg = msg % self.args ~~~~^~~~~~~~~~~ TypeError: not all arguments converted during string formatting Call stack: File "/usr/bin/mdd", line 843, in main() File "/usr/bin/mdd", line 808, in main data = get_device_data(args.telemetry) File "/usr/bin/mdd", line 754, in get_device_data "disk": get_disk_info(), File "/usr/bin/mdd", line 597, in get_disk_info "windows": check_windows_dualboot(), File "/usr/bin/mdd", line 187, in check_windows_dualboot return dualboot_os_prober_check() File "/usr/bin/mdd", line 126, in dualboot_os_prober_check logging.info("Found Windows with os-prober:", line) Message: 'Found Windows with os-prober:' Arguments: ('/dev/sda1@/EFI/Microsoft/Boot/bootmgfw.efi:Windows Boot Manager:Windows:efi',) [2024-11-07T14:04:48] INFO ...get locale info [2024-11-07T14:04:48] DEBUG /etc/timezone found, contents: Europe/Rome [2024-11-07T14:04:48] DEBUG /etc/localtime found [2024-11-07T14:04:48] DEBUG 2 found: {'/etc/timezone': 'Europe/Rome', '/etc/localtime is a symlink to': 'Europe/Rome'} [2024-11-07T14:04:48] INFO ...get package info [2024-11-07T14:04:54] INFO ...get pacman-mirrors info [2024-11-07T14:04:56] INFO ...get desktop info ```
mdd --dry-run --log DEBUG(again without sudo, but within sudo timeout) ``` [2024-11-07T14:07:37] INFO ...get system info [2024-11-07T14:07:37] INFO ...get boot info [2024-11-07T14:07:37] INFO ...get cpu info [2024-11-07T14:07:37] INFO ...get memory info [2024-11-07T14:07:37] INFO ...get graphics info [2024-11-07T14:07:38] INFO ...get audio info [2024-11-07T14:07:38] INFO ...get disk info [2024-11-07T14:07:38] INFO ...check for Windows dualboot [2024-11-07T14:07:38] INFO Attempting to use os-prober... [2024-11-07T14:07:38] INFO ...check for Windows with os-prober [2024-11-07T14:07:38] INFO os-prober call failed, trying elevated --- Logging error --- Traceback (most recent call last): File "/usr/lib/python3.12/logging/__init__.py", line 1160, in emit msg = self.format(record) ^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/logging/__init__.py", line 999, in format return fmt.format(record) ^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/logging/__init__.py", line 703, in format record.message = record.getMessage() ^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/logging/__init__.py", line 392, in getMessage msg = msg % self.args ~~~~^~~~~~~~~~~ TypeError: not all arguments converted during string formatting Call stack: File "/usr/bin/mdd", line 843, in main() File "/usr/bin/mdd", line 808, in main data = get_device_data(args.telemetry) File "/usr/bin/mdd", line 754, in get_device_data "disk": get_disk_info(), File "/usr/bin/mdd", line 597, in get_disk_info "windows": check_windows_dualboot(), File "/usr/bin/mdd", line 187, in check_windows_dualboot return dualboot_os_prober_check() File "/usr/bin/mdd", line 126, in dualboot_os_prober_check logging.info("Found Windows with os-prober:", line) Message: 'Found Windows with os-prober:' Arguments: ('/dev/sda1@/EFI/Microsoft/Boot/bootmgfw.efi:Windows Boot Manager:Windows:efi',) [2024-11-07T14:07:39] INFO ...get locale info [2024-11-07T14:07:39] DEBUG /etc/timezone found, contents: Europe/Rome [2024-11-07T14:07:39] DEBUG /etc/localtime found [2024-11-07T14:07:39] DEBUG 2 found: {'/etc/timezone': 'Europe/Rome', '/etc/localtime is a symlink to': 'Europe/Rome'} [2024-11-07T14:07:39] INFO ...get package info [2024-11-07T14:07:45] INFO ...get pacman-mirrors info [2024-11-07T14:07:46] INFO ...get desktop info ```

Fyi, actually, indeed I have still the Windows boot manager entry but the partition with windows deleted, so it makes sense that lsblk does not detect Windows, while os-prober does.

romangg commented 2 weeks ago

I have still the Windows boot manager entry but the partition with windows deleted

Ok, then this seems to be a very special case and the outcome is to be expected. I don't think there are many people with this kind of setup, so we can probably ignore it.

There is still this traceback in the log though. We should look into that.