diff --git a/changelog/67083.fixed.md b/changelog/67083.fixed.md new file mode 100644 index 000000000000..d869517e68c5 --- /dev/null +++ b/changelog/67083.fixed.md @@ -0,0 +1 @@ +Ubuntu can run salt-master without root diff --git a/salt/grains/core.py b/salt/grains/core.py index 4c8e969ceec6..820cf39c9dad 100644 --- a/salt/grains/core.py +++ b/salt/grains/core.py @@ -1105,9 +1105,14 @@ def _virtual(osdata): if os.path.isdir("/sys/bus/xen/drivers/xenconsole"): # An actual DomU will have the xenconsole driver grains["virtual_subtype"] = "Xen PV DomU" - elif "xen:" in __salt__["cmd.run"]("dmesg").lower(): - # Fallback to parsing dmesg, might not be successful - grains["virtual_subtype"] = "Xen PV DomU" + else: + try: + if "xen:" in __salt__["cmd.run"]("dmesg").lower(): + # Fallback to parsing dmesg, might not be successful + grains["virtual_subtype"] = "Xen PV DomU" + except salt.exceptions.CommandExecutionError as e: + msg = f"Could not detect virtual_subtype with dmesg: {e}" + log.debug(msg) # If a Dom0 or DomU was detected, obviously this is xen if "dom" in grains.get("virtual_subtype", "").lower(): grains["virtual"] = "xen"