[master/f20/rhel7] Generate missing machine-id

Brian C. Lane bcl at redhat.com
Tue Nov 26 17:53:32 UTC 2013


From: "Brian C. Lane" <bcl at redhat.com>

systemd needs /etc/machine-id to boot. In live installs we don't copy
the host's over for obvious reasons, and if something else doesn't
generate it we need to make sure it is there.
---
 pyanaconda/packaging/livepayload.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/pyanaconda/packaging/livepayload.py b/pyanaconda/packaging/livepayload.py
index 9c2f264..48c154f 100644
--- a/pyanaconda/packaging/livepayload.py
+++ b/pyanaconda/packaging/livepayload.py
@@ -154,6 +154,10 @@ class LiveImagePayload(ImagePayload):
                                    ["--rpmposttrans", kernel],
                                    root=ROOT_PATH)
 
+        # Make sure the new system has a machine-id, it won't boot without it
+        if not os.path.exists(ROOT_PATH+"/etc/machine-id"):
+            iutil.execWithRedirect("systemd-machine-id-setup", [], root=ROOT_PATH)
+
     @property
     def spaceRequired(self):
         return Size(bytes=iutil.getDirSize("/")*1024)
-- 
1.8.3.1



More information about the anaconda-patches mailing list