<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<atom:link href="https://dev1galaxy.org/extern.php?action=feed&amp;tid=8117&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[Dev1 Galaxy Forum / [SOLVED] machine-id]]></title>
		<link>https://dev1galaxy.org/viewtopic.php?id=8117</link>
		<description><![CDATA[The most recent posts in [SOLVED] machine-id.]]></description>
		<lastBuildDate>Fri, 24 Jul 2026 23:54:47 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[Re: [SOLVED] machine-id]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=64907#p64907</link>
			<description><![CDATA[<p>it is intentional, as i said that initscript specifically targets debian sysvinit-core, not devuan, hence conforming to the file topology from debian, the way the file topology on devuan works is a subset of debian, but having <span class="bbc">/etc/machine-id</span> as a volatile file linked to <span class="bbc">/run</span> which exists only in memory is something that works across both debian and devuan, now if dbus finds a <span class="bbc">/etc/machine-id</span> then <span class="bbc">/var/lib/dbus/machine-id</span> is created as a link pointing to the machine-id file.</p><p>again if i manage to get this polished and accepted on debian all it would require to have the devuan way of a volatile machine id per booth would be just 1 config file, which is a benefit for debian to devuan install migrations</p>]]></description>
			<author><![CDATA[dummy@example.com (EDX-0)]]></author>
			<pubDate>Fri, 24 Jul 2026 23:54:47 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=64907#p64907</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] machine-id]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=64904#p64904</link>
			<description><![CDATA[<div class="quotebox"><blockquote><div><p>EtcMachineID=/etc/machine-id<br />RunMachineID=/run/machine-id</p></div></blockquote></div><p>I do not understand. Both paths seem not be correct.<br />I should be -&gt; /var/lib/dbus/machine-id</p><p>Or maybe i am missing something.</p>]]></description>
			<author><![CDATA[dummy@example.com (tom)]]></author>
			<pubDate>Fri, 24 Jul 2026 21:04:14 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=64904#p64904</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] machine-id]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=64902#p64902</link>
			<description><![CDATA[<p>well i&#039;ve been messing some with greenjeans&#039; initscript for my own machine-id initscript:</p><div class="codebox"><pre class="vscroll"><code>#!/bin/sh
### BEGIN INIT INFO
# Provides:          machine-id
# Required-Start:    $local_fs
# Required-Stop:     $local_fs
# Should-Start:      
# X-Start-Before:    dbus
# Default-Start:     2 3 4 5
# Default-Stop:      0 6
# Short-Description: Handle flexible machine-id modes and session cleanup
# Description:       Controls volatile or static machine-id layout variations
#                    and purges accumulated session bus files on shutdown.
### END INIT INFO

PATH=/sbin:/usr/sbin:/bin:/usr/bin
NAME=machine-id
DESC=&quot;Flexible machine-id and session management&quot;

# Source the standard Debian/Devuan LSB logging utility library
. /lib/lsb/init-functions

CONFIG=&quot;/etc/default/${NAME}&quot;
# Source configuration overrides if the file exists
if [ -f &quot;$CONFIG&quot; ]; then
    . &quot;$CONFIG&quot;
fi

EtcMachineID=/etc/machine-id
RunMachineID=/run/machine-id
BaseDbusSessDir=&quot;.dbus/session-bus&quot;

clean_dir() {
    local target_dir=&quot;$1&quot;
    if [ -d &quot;$target_dir&quot; ] &amp;&amp; [ &quot;$(echo &quot;$target_dir&quot;/*)&quot; != &quot;$target_dir/*&quot; ]; then
        if [ &quot;$DRYRUN&quot; = &quot;yes&quot; ]; then
            for item in &quot;$target_dir&quot;/*; do
                log_action_msg &quot;Dry-run: Would remove $item&quot;
            done
        else
            rm -f -- &quot;$target_dir&quot;/*
        fi
    fi
}

fallback_machine_id_gen() {
    local mac_hex=&quot;&quot;
    local needed_chars=32
    local machine_id_file=&quot;$1&quot;

    local BaseNetDir=&quot;/sys/class/net&quot;
    local net_dir
    local raw_mac
    # Only attempt MAC acquisition if explicitly enabled by the administrator
    if [ &quot;$USE_MAC_FALLBACK&quot; = &quot;yes&quot; ]; then
        for net_dir in &quot;$BaseNetDir&quot;/*; do
            if [ -d &quot;$net_dir&quot; ] &amp;&amp; [ &quot;${net_dir##*/}&quot; != &quot;lo&quot; ] &amp;&amp; [ -f &quot;$net_dir/address&quot; ]; then
                read -r raw_mac &lt; &quot;$net_dir/address&quot;
                mac_hex=$(printf &#039;%s&#039; &quot;$raw_mac&quot; | tr -d &#039;:&#039; | tr &#039;[:upper:]&#039; &#039;[:lower:]&#039;)
                if [ ${#mac_hex} -eq 12 ] &amp;&amp; [ &quot;$mac_hex&quot; != &quot;000000000000&quot; ]; then
                    break
                fi
                mac_hex=&quot;&quot;
            fi
        done
    fi

    # Calculate remainder space (defaults to 32 if MAC loop was bypassed or empty)
    needed_chars=$((32 - ${#mac_hex}))

    # Write out any discovered MAC slice first, then append random entropy
    printf &quot;%s&quot; &quot;$mac_hex&quot; &gt; &quot;$machine_id_file&quot;
    tr -dc &#039;a-f0-8&#039; &lt; /dev/urandom 2&gt;/dev/null | head -c &quot;$needed_chars&quot; &gt;&gt; &quot;$machine_id_file&quot;
    printf &quot;\n&quot; &gt;&gt; &quot;$machine_id_file&quot;
}

machine_id_gen() {
    local target_file=&quot;$1&quot;
    
    if command -v dbus-uuidgen &gt;/dev/null 2&gt;&amp;1; then
        dbus-uuidgen --ensure=&quot;$target_file&quot;
    else
        fallback_machine_id_gen &quot;$target_file&quot;
    fi
}

do_start() {
    # VOLATILE MODE ENGINE
    if [ -n &quot;$VOLATILE_MACHINE_ID&quot; ] &amp;&amp; [ &quot;$VOLATILE_MACHINE_ID&quot; != &quot;no&quot; ]; then
        log_daemon_msg &quot;Setting up volatile machine-id&quot; &quot;$NAME&quot;

        if [ ! -L &quot;$EtcMachineID&quot; ] || [ &quot;$(readlink &quot;$EtcMachineID&quot;)&quot; != &quot;$RunMachineID&quot; ]; then
            rm -f &quot;$EtcMachineID&quot;
            ln -sf &quot;$RunMachineID&quot; &quot;$EtcMachineID&quot;
        fi

        if [ ! -s &quot;$RunMachineID&quot; ]; then
            machine_id_gen &quot;$RunMachineID&quot;
        fi
        log_end_msg 0

    # STATIC PERSISTENT MODE ENGINE
    else
        log_daemon_msg &quot;Checking persistent static machine-id&quot; &quot;$NAME&quot;

        # If it was a volatile symlink, safely capture its contents to disk before destroying it
        if [ -L &quot;$EtcMachineID&quot; ]; then
            if [ -s &quot;$RunMachineID&quot; ]; then
                local temp_id
                temp_id=$(cat &quot;$RunMachineID&quot;)
                rm -f &quot;$EtcMachineID&quot; &quot;$RunMachineID&quot;
                printf &quot;%s\n&quot; &quot;$temp_id&quot; &gt; &quot;$EtcMachineID&quot;
            else
                rm -f &quot;$EtcMachineID&quot;
            fi
        fi

        # Generate a standard static ID ONLY if the static file is genuinely missing or empty
        if [ ! -f &quot;$EtcMachineID&quot; ] || [ ! -s &quot;$EtcMachineID&quot; ]; then
            rm -f &quot;$EtcMachineID&quot;
            machine_id_gen &quot;$EtcMachineID&quot;
        fi
        log_end_msg 0
    fi
}

do_stop() {
    PowerState=&quot;/sys/power/state&quot;
    PowerPMStatus=&quot;/sys/power/pm_status&quot;
    if [ -f &quot;$PowerState&quot; ]; then
        if [ -f &quot;$PowerPMStatus&quot; ] &amp;&amp; grep -q -E &quot;freeze|suspend|hibernate&quot; &quot;$PowerPMStatus&quot; 2&gt;/dev/null; then
            return 0
        fi
    fi

    log_daemon_msg &quot;Removing stale session-bus files&quot; &quot;$NAME&quot;

    clean_dir &quot;/root/${BaseDbusSessDir}&quot;

    getent passwd | cut -d: -f6 | while read -r userhome; do
        if [ -z &quot;$userhome&quot; ] || [ &quot;$userhome&quot; = &quot;/&quot; ]; then
            continue
        fi
        clean_dir &quot;$userhome/${BaseDbusSessDir}&quot;
    done

    log_end_msg 0
}

case &quot;$1&quot; in
    start)
        do_start
        ;;
    stop)
        do_stop
        ;;
    restart|force-reload)
        do_stop
        do_start
        ;;
    status)
        if [ -L &quot;$EtcMachineID&quot; ]; then
            log_success_msg &quot;Machine-ID Mode: Volatile RAM (Value: $(cat &quot;$EtcMachineID&quot;))&quot;
            exit 0
        elif [ -s &quot;$EtcMachineID&quot; ]; then
            log_success_msg &quot;Machine-ID Mode: Persistent Static (Value: $(cat &quot;$EtcMachineID&quot;))&quot;
            exit 0
        else
            log_failure_msg &quot;Machine-ID file missing or uninitialized.&quot;
            exit 3
        fi
        ;;
    *)
        echo &quot;Usage: $NAME {start|stop|restart|force-reload|status}&quot; &gt;&amp;2
        exit 3
        ;;
esac</code></pre></div><p>the idea of this modified version wasn&#039;t so much to &quot;just clean up files in devuan&quot; but rather i intend it as part of the debian&#039;s initscripts package so that a debian sysvinit-core install would be more like a default devuan install as in having a volatile machine id</p><p>worth mentioning i&#039;m still testing the initscript and have not really made full on testing with the different hibernation methods</p><p>tho i&#039;m not sure it is polished enough yet to try to submit it to the debian initscripts package</p>]]></description>
			<author><![CDATA[dummy@example.com (EDX-0)]]></author>
			<pubDate>Fri, 24 Jul 2026 19:44:35 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=64902#p64902</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] machine-id]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=64891#p64891</link>
			<description><![CDATA[<p>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&#039;m not certain of that.) See /etc/default/dbus to turn that on or off.</p><p>You&#039;re not removing the files in your home directory (in ~/.dbus/session-bus/*) and neither does the default devuan installation.&#160; See <a href="https://dev1galaxy.org/viewtopic.php?pid=58117#p58117" rel="nofollow">https://dev1galaxy.org/viewtopic.php?pid=58117#p58117</a></p><p>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.</p>]]></description>
			<author><![CDATA[dummy@example.com (fsmithred)]]></author>
			<pubDate>Thu, 23 Jul 2026 21:05:31 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=64891#p64891</guid>
		</item>
		<item>
			<title><![CDATA[[SOLVED] machine-id]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=64890#p64890</link>
			<description><![CDATA[<p>Hi, </p><p>Because of the bad Windows GDID, questions about the &quot;machine-id&quot; came out.&#160; &#160;For me, i build a tiny small deb-paket for this, but only one init-script (for sysvrc) is needed.</p><p><span class="bbc">&#160; $ cat delete-maschine-id <br />#!/bin/sh<br />### BEGIN INIT INFO<br /># Provides:&#160; &#160; &#160;delete-maschine-id<br /># Required-Start:<br /># Required-Stop:<br /># Default-Start:<br /># Default-Stop:&#160; &#160; &#160;0 6<br /># Short-Description:&#160; &#160; Remove machine-id at shutdown<br /># Description:&#160; &#160; &#160; &#160; &#160; Deletes /etc/machine-id and /var/lib/dbus/machine-id<br />#&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;so a new unique ID is generated at next boot.<br />### END INIT INFO</span></p><p><span class="bbc">do_stop() {<br />&#160; &#160; echo &quot;removing machine-id&quot;<br />&#160; &#160; if [ -f /etc/machine-id ]; then<br />&#160; &#160; &#160; &#160; rm -f /etc/machine-id<br />&#160; &#160; fi<br />&#160; &#160; rm -f /var/lib/dbus/machine-id<br />}</span></p><p><span class="bbc">case &quot;$1&quot; in<br />&#160; &#160; start)&#160; echo &quot;invalid option&quot; ;;<br />&#160; &#160; stop)&#160; &#160;do_stop ;;<br />&#160; &#160; *)&#160; &#160; &#160; do_stop ;;<br />esac</span></p><p><span class="bbc">exit 0</span></p><p>works for me.&#160; When shutting down, the machine-id is removed, after restart dbus creates a new one.</p><p><strong>EDIT:</strong><br />Found it myself in /etc/default/dbus</p><p># IDTYPE: how to deal with /var/lib/dbus/machine-id:<br /># <br /># if IDTYPE=&quot;RANDOM&quot;: regenerate /var/lib/dbus/machine-id at each boot<br /># else keep it fixed across reboots<br />IDTYPE=&quot;RANDOM&quot;</p><p>Sorry for your time to read this, an i can delete my initscript.&#160; <img src="https://dev1galaxy.org/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></description>
			<author><![CDATA[dummy@example.com (tom)]]></author>
			<pubDate>Thu, 23 Jul 2026 20:13:47 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=64890#p64890</guid>
		</item>
	</channel>
</rss>
