summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2020-08-19 17:07:41 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-08-26 14:33:29 +0200
commit7355ac9689e9213e0d4a1f1ed7f41e736842ec5c (patch)
treef78340d8fdca39623383a0301275107bd9fa426a
parent496a71f44483c54a2aa9569d2be5aceaa015664a (diff)
downloadsystemd-7355ac9689e9213e0d4a1f1ed7f41e736842ec5c.tar.gz
machine-id-setup: don't use KVM or container manager supplied uuid if in chroot env
Fixes: #16758 (cherry picked from commit 1f894e682cb34d8d713378d01dc0565b7b5a245f)
-rw-r--r--src/core/machine-id-setup.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/core/machine-id-setup.c b/src/core/machine-id-setup.c
index f76b82a8a4..90f03db680 100644
--- a/src/core/machine-id-setup.c
+++ b/src/core/machine-id-setup.c
@@ -44,7 +44,7 @@ static int generate_machine_id(const char *root, sd_id128_t *ret) {
fd = safe_close(fd);
}
- if (isempty(root)) {
+ if (isempty(root) && running_in_chroot() <= 0) {
/* If that didn't work, see if we are running in a container,
* and a machine ID was passed in via $container_uuid the way
* libvirt/LXC does it */