Bug#745840: live-build: please truncate /etc/machine-id instead of deleting it
Package: live-build
Version: 4.0~alpha33-1
Severity: wishlist
Tags: patch
systemd-journald (at least in the version in wheezy) requires
/etc/machine-id to exist and have contents.
live-build currently deletes that file if it exists. If the root filesystem
is read/write, systemd automatically re-creates it during early boot -
no problem so far.
The problem comes if you're creating an image that does not use
/live/filesystem.* and an overlay, but boots into a normal ext* image
(the second use-case I mentioned on #745816) which is initially mounted
read-only. systemd cannot create /etc/machine-id here. However, if
/etc/machine-id exists and is empty, systemd will generate /run/machine-id
and bind-mount that over /etc/machine-id, providing a suitable machine ID
that will let systemd-journald start.
Proposed patch attached.
Regards,
S
-- Package-specific info:
-- System Information:
Debian Release: jessie/sid
APT prefers proposed-updates
APT policy: (500, 'proposed-updates'), (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 3.13-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.utf8, LC_CTYPE=en_GB.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages live-build depends on:
ii cdebootstrap 0.5.10
ii debootstrap 1.0.59
ii python3 3.3.4-1
Versions of packages live-build recommends:
ii cpio 2.11+dfsg-2
ii live-boot-doc 4.0~alpha21-1
ii live-config-doc 4.0~alpha32-1
ii live-manual-html [live-manual] 1:4.0~alpha11-1
live-build suggests no packages.
-- no debconf information
>From 62c15ae4c586c66ee942274529746c6305bae8be Mon Sep 17 00:00:00 2001
From: Simon McVittie <simon.mcvittie@collabora.co.uk>
Date: Fri, 25 Apr 2014 18:02:06 +0100
Subject: [PATCH] Truncate /etc/machine-id instead of deleting it
If /etc/machine-id exists but is empty, systemd will do tricks
with bind-mounts to ensure that a valid transient UUID is bind-mounted
over it, which is exactly what we want for a live system.
If /etc/machine-id does not exist, systemd-journald
will just fail, which is undesirable.
---
share/hooks/0180-remove-systemd-machine-id.hook.chroot | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/share/hooks/0180-remove-systemd-machine-id.hook.chroot b/share/hooks/0180-remove-systemd-machine-id.hook.chroot
index 52ba38f..ed5d6bf 100755
--- a/share/hooks/0180-remove-systemd-machine-id.hook.chroot
+++ b/share/hooks/0180-remove-systemd-machine-id.hook.chroot
@@ -2,8 +2,12 @@
set -e
-# Remove systemd machine id.
-#
-# This removes systemd machine id that cache that makes each system unique.
+# Blank out systemd machine id. If it does not exist, systemd-journald
+# will fail, but if it exists and is empty, systemd will automatically
+# set up a new unique ID.
-rm -f /etc/machine-id
+if [ -e /etc/machine-id ]
+then
+ rm -f /etc/machine-id
+ : > /etc/machine-id
+fi
--
2.0.0.rc0
Reply to: