The officially official Devuan Forum!

You are not logged in.

#1 Today 20:13:47

tom
Member
Registered: 2022-02-03
Posts: 16  

machine-id

Hi,

Because of the bad Windows GDID, questions about the "machine-id" came out.   For me, i build a tiny small deb-paket for this, but only one init-script (for sysvrc) is needed.

  $ cat delete-maschine-id
#!/bin/sh
### BEGIN INIT INFO
# Provides:     delete-maschine-id
# Required-Start:
# Required-Stop:
# Default-Start:
# Default-Stop:     0 6
# Short-Description:    Remove machine-id at shutdown
# Description:          Deletes /etc/machine-id and /var/lib/dbus/machine-id
#                       so a new unique ID is generated at next boot.
### END INIT INFO

do_stop() {
    echo "removing machine-id"
    if [ -f /etc/machine-id ]; then
        rm -f /etc/machine-id
    fi
    rm -f /var/lib/dbus/machine-id
}

case "$1" in
    start)  echo "invalid option" ;;
    stop)   do_stop ;;
    *)      do_stop ;;
esac

exit 0

works for me.  When shutting down, the machine-id is removed, after restart dbus creates a new one.

EDIT:
Found it myself in /etc/default/dbus

# IDTYPE: how to deal with /var/lib/dbus/machine-id:
#
# if IDTYPE="RANDOM": regenerate /var/lib/dbus/machine-id at each boot
# else keep it fixed across reboots
IDTYPE="RANDOM"

Sorry for your time to read this, an i can delete my initscript.  smile

Last edited by tom (Today 20:56:47)

Offline

#2 Today 21:05:31

fsmithred
Administrator
Registered: 2016-11-25
Posts: 2,949  

Re: machine-id

In devuan, /var/lib/dbus/machine-id gets replaced on every boot and /etc/machine-id does not exist. (It might be there if you migrated a debian install to devuan, but I'm not certain of that.) See /etc/default/dbus to turn that on or off.

You're not removing the files in your home directory (in ~/.dbus/session-bus/*) and neither does the default devuan installation.  See https://dev1galaxy.org/viewtopic.php?pid=58117#p58117

I just have a single line in /etc/rc.local to remove the ones in my home so they get removed before I log in, and then a new one is created matching the one in /var/lib/dbus.

Offline

Board footer