** Description changed: Presently, systemd triggered collection on WSL will fail to get the WSL version, leaving that part of the report blank. Typically, this is gotten using interop by running `wsl.exe --version` and then parsing the output with regex. From initial investigations, this seems to be due to the systemd sandboxing being too restrictive, causing `UtilBindVsockAnyPort: socket failed 97` failures. === SRU (Resolute - 26.04) === [ Impact ] Presently, automated collection via systemd on WSL is not properly collecting the WSL version, even when it should. The result is that the vast majority of collected reports from WSL instances do not include the WSL version, which is something we expect to collect. As the root cause of this is the systemd unit sandboxing being too restrictive, it is a fairly simple fix involving simply adding `AF_VSOCK` to the collection unit. However, this alone is an incomplete fix, as we still rely on assumptions that the C drive is the Windows system drive, and that the Windows mount paths are available, which in some early states, such as at `wsl-setup`, is not the case. Thus, in addition to this, we use `wslinfo --version` as a new primary method of getting the version, which has the advantage of being a Linux process. Given that we don't know exactly when `wslinfo --version` was introduced, though, with the legacy flag of equivalent function `--wsl- version` being introduced only in April of 2024, it's still safer to keep the interop-based `wsl.exe -v` method that requires `AF_VSOCK` as a final fallback. [ Test Plan ] 1. Start from a WSL 2 Ubuntu instance of an appropriate version with interop and systemd enabled. 2. Clear out any existing reports from `~/.cache/ubuntu- insights/linux/local` and the more recent report from `~/.cache/ubuntu- insights/linux/uploaded`. 3. Ensure you are opted-in to collection using `ubuntu-insights consent linux -s=true` 4. Manually trigger a collection via the systemd unit, `systemctl --user restart ubuntu-insights-collect.service` 5. Check the output `~/.cache/ubuntu-insights/linux/local`. Before, platform.wsl.version would be missing, but now, it should be present and have a reasonable output. -- Regression tests -- 1. From a non-WSL environment, run `ubuntu-insights collect -d`, and - ensure that the output remains the same as before. + ensure that the output remains the same as before. Check with both + consent true (`ubuntu-insights consent linux -s=true`) and false + (`ubuntu-insights consent linux -s=false`). [ Where problems could occur ] * While the overall regression risk is low as we are loosening the sandboxing, the primary risk is that this fix allows insights to access something it should not have access to, especially for non-WSL situations. * Certain versions of WSL may implement `wslinfo` in an unexpected manner. While we try to filter for this, it might get past it, such that we generate reports with bad data. [ Other Info ] * PPA: https://launchpad.net/~kkuo/+archive/ubuntu/ubuntu-insights/+packages * Upstream repo: https://github.com/ubuntu/ubuntu-insights
-- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/2168785 Title: Systemd based collection fails to get WSL version To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/ubuntu-insights/+bug/2168785/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
