Package: base-files Version: 7.2 Severity: normal Tags: patch D-Bus, systemd and other programs use /etc/machine-id. Given that this file is per-machine and very central, it should live in base-files.
The attached patch creates the file unless it already exists. The patch works on Linux and should work (untested) on kFreeBSD (since linprocfs emulates the uuid file). The uuid file should be present in all Linux kernels since it lives in the same source code file that provides /dev/{u,}random :). On platforms where the uuid file does not exist we just do nothing for now. -- System Information: Debian Release: jessie/sid APT prefers testing APT policy: (990, 'testing') Architecture: amd64 (x86_64) Foreign Architectures: armel i386 Kernel: Linux 3.13-1-amd64 (SMP w/8 CPU cores) Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages base-files depends on: ii gawk [awk] 1:4.0.1+dfsg-2.1 ii mawk [awk] 1.3.3-17 base-files recommends no packages. base-files suggests no packages. -- no debconf information
>From aaea1b768923ef7453207590fd250cc0e7f739b9 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg <stapelb...@debian.org> Date: Sat, 26 Apr 2014 11:20:52 +0200 Subject: [PATCH] Generate /etc/machine-id if it does not yet exist. --- debian/postinst.in | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/postinst.in b/debian/postinst.in index 778a698..c82f941 100644 --- a/debian/postinst.in +++ b/debian/postinst.in @@ -122,3 +122,9 @@ if dpkg --compare-versions "$2" lt-nl "6.10"; then install_from_default /usr/share/base-files/staff-group-for-usr-local \ /etc/staff-group-for-usr-local fi + +# D-Bus, systemd and other programs want a static machine identifier in +# /etc/machine-id, so create one if it does not exist. +if [ ! -e /etc/machine-id ] && [ -e /proc/sys/kernel/random/uuid ]; then + sed 's/-//g' /proc/sys/kernel/random/uuid > /etc/machine-id +fi -- 1.9.0