diff --git a/salt/grains/core.py b/salt/grains/core.py index 7dd350a34536..5ea4c07130c8 100644 --- a/salt/grains/core.py +++ b/salt/grains/core.py @@ -2320,9 +2320,14 @@ def _legacy_linux_distribution_data(grains, os_release, lsb_has_error): log.trace( "Getting OS name, release, and codename from distro id, version, codename" ) - (osname, osrelease, oscodename) = ( - x.strip('"').strip("'") for x in _linux_distribution() - ) + try: + (osname, osrelease, oscodename) = ( + x.strip('"').strip("'") for x in _linux_distribution() + ) + except subprocess.CalledProcessError: + # When running under the salt user, a call to `lsb_release` might raise + # permissin errors. + return grains # Try to assign these three names based on the lsb info, they tend to # be more accurate than what python gets from /etc/DISTRO-release. # It's worth noting that Ubuntu has patched their Python distribution