3

/etc/machine-id changes at each boot on my recent Debian Jessie install.

The docs say it shouldn't:

The machine ID is usually generated from a random source during system installation and stays constant for all subsequent boots. Optionally, for stateless systems, it is generated during runtime at early boot if it is found to be empty.

(Unless my system is "stateless". Not sure what that is.)

I realized it because it creates a log entry everyday in my /etc repository using etckeeper.

mount command confirms it is not persistent:

# mount | grep machine-id
tmpfs on /etc/machine-id type tmpfs (ro,relatime,size=811524k,mode=755)

Is this an issue? Should I do anything about it?

I could add it to .gitignore to avoid the useless commits, but I'd be interested to know why it happens in the first place.

Edit: df and mount output

Not sure it matters at all but here it is:

I'm using a software RAID1. /dev/sda and /dev/sdc are mirrored into a 3 partition volume: /dev/md0p1 is swap, /dev/md0p2 is / and /dev/md0p3 is /home.

/dev/sdb is an old HD used for backups.

$ df
Sys. de fichiers blocs de 1K   Utilisé Disponible Uti% Monté sur
/dev/md0p2          28703672   5011248   22211316  19% /
udev                   10240         0      10240   0% /dev
tmpfs                 811524      9360     802164   2% /run
tmpfs                2028804       836    2027968   1% /dev/shm
tmpfs                   5120         4       5116   1% /run/lock
tmpfs                2028804         0    2028804   0% /sys/fs/cgroup
/dev/sdb1          615189496 506132424   77784164  87% /mnt/bak
/dev/md0p3         928490588 506207060  375095888  58% /home
tmpfs                 405764         4     405760   1% /run/user/119
tmpfs                 405764        16     405748   1% /run/user/1000

$ mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,relatime,size=10240k,nr_inodes=504119,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,relatime,size=811524k,mode=755)
/dev/md0p2 on / type ext4 (rw,relatime,errors=remount-ro,data=ordered)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
tmpfs on /etc/machine-id type tmpfs (ro,relatime,size=811524k,mode=755)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=22,pgrp=1,timeout=300,minproto=5,maxproto=5,direct)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime)
mqueue on /dev/mqueue type mqueue (rw,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
/dev/sdb1 on /mnt/bak type ext4 (rw,relatime,errors=remount-ro,data=ordered)
/dev/md0p3 on /home type ext4 (rw,relatime,data=ordered)
rpc_pipefs on /run/rpc_pipefs type rpc_pipefs (rw,relatime)
tmpfs on /run/user/119 type tmpfs (rw,nosuid,nodev,relatime,size=405764k,mode=700,uid=119,gid=127)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=405764k,mode=700,uid=1000,gid=1000)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,relatime)
Jérôme
  • 1,898
  • 3
  • 26
  • 47

1 Answers1

1

Try this to make your current machine ID permanent:

# mount --bind / /mnt
# cp /etc/machine-id /mnt/etc/machine-id
# reboot

This should get rid of the tmpfs mount over /etc/machine-id.

Ferenc Wágner
  • 5,027
  • 17
  • 25
  • 1
    Thanks, I'll do that. Any idea why this would happen in the first place? – Jérôme Feb 07 '16 at 15:23
  • Check out the [link](http://www.lgqyc.com/why-is-my-systemd-journal-not-persistent-across-reboots/) suggested by don_crissti. – Ferenc Wágner Feb 07 '16 at 18:53
  • This link is a copy of a Unix & Linux StackExchange page I linked to myself (http://unix.stackexchange.com/questions/191313/). It says how to fix it (what you copied here in your answer). And it says this could be due to `/etc/machine-id` being empty in the filesystem image used for installation. Maybe this is the case in the Debian installer found in Debian Live. Note sure if and where I should file a bug. – Jérôme Feb 07 '16 at 19:29
  • 1
    It's acceptable behavior (at least) for a live system, and if you installed from Debian Live, it might be reasonable to report a bug there. Especially if you can reproduce it. And thanks for accepting an answer already known to you. :) – Ferenc Wágner Feb 07 '16 at 19:54
  • 1
    I contacted Debian Live team through the mailing list: https://lists.debian.org/debian-live/2016/02/msg00006.html – Jérôme Feb 07 '16 at 21:02