News for hackers. Stuff that matters.
Re:Devuan considers machine IDs by mirimir on Saturday March 30, 2019 @11:00AM (#19529730)
OK, from the man page:

> The /etc/machine-id file contains the unique machine ID of the local system that is set during installation. The machine ID is a single newline-terminated, hexadecimal, 32-character, lowercase ID. When decoded from hexadecimal, this corresponds to a 16-byte/128-bit value.

> 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.

So if that works for "stateless systems", why can't all machines be "stateless systems"?

Re:Devuan considers machine IDs by dmurray on Saturday March 30, 2019 @12:10PM (#19530119)
It's not clear that would make anyone happy.

You might really want to track machines in your fleet, in a way that persists across reboots. Let's say you can access a machine remotely but you got all your ethernet cables tangled up, so you don't know which physical machine you SSHed into.

Or if you are being concerned about being tracked by a third party, you don't want this identifier to exist at all, even if it doesn't persist through reboots.

I agree there are other solutions in both cases.

Re:Devuan considers machine IDs by patrickg_zill on Saturday March 30, 2019 @02:10PM (#19530829)
So basically deleting the file as the last step before a shut down or reboot will work, is that correct?
Re:Devuan considers machine IDs by JdeBP on Sunday March 31, 2019 @09:30AM (#19535474)
Incorrect.

Machine IDs are stored in several places, some of which are not even files.

* http://jdebp.uk./Softwares/nosh/guide/commands/machine-id.xm...

They can be resurrected if not all storage locations are dealt with. Moreover, some systems use things like the SMBIOS product UUID.

* http://jdebp.uk./Softwares/nosh/guide/commands/setup-machine...

The correct approach is not deleting files.

* http://jdebp.uk./Softwares/nosh/guide/commands/erase-machine...

* https://lists.debian.org/debian-user/2019/03/msg00550.html

Re:Devuan considers machine IDs by mirimir on Sunday March 31, 2019 @09:59AM (#19535602)
Thanks.

So at boot, one would run "erase-machine-id". Then create a random 30-character hexadecimal number. And then either set "the systemd.machine_id= kernel command line parameter" to it. Or pass it via "the option --machine-id= to systemd".

Re:Devuan considers machine IDs by JdeBP on Sunday March 31, 2019 @10:30AM (#19535750)
No.

    % system-control cat machine-id
    start:#!/bin/nosh
    start:true
    stop:#!/bin/nosh
    stop:envdir env
    stop:erase-machine-id
    run:#!/bin/nosh
    run:#Set up and tear down the machine ID
    run:envdir env
    run:setup-machine-id
    restart:#!/bin/sh
    restart:exec false      # ignore script arguments
    %
Re:Devuan considers machine IDs by mirimir on Sunday March 31, 2019 @11:30AM (#19536076)
OK, thanks.

So "setup-machine-id". Does that generate a value that's unrelated to any preexisting versions, analogs, etc?

I ask because, when I deleted /etc/machine-id and ran "systemd-machine-id-setup", it generated a new machine-id by copying the D-Bus machine ID.

Re:Devuan considers machine IDs by mirimir on Saturday March 30, 2019 @02:41PM (#19530999)
I'll test that.

Edit: OK, so I created a Debian VM, noted /etc/machine-id, deleted it, and rebooted. And found that it was still missing.

Running systemd-machine-id-setup generated a new machine-id from the D-Bus machine ID. And it was the same as the initial one.

But I also see in man machine-id:

> The machine-id may also be set, for example when network booting, by setting the systemd.machine_id= kernel command line parameter or passing the option --machine-id= to systemd. A machine-id may not be set to all zeros.

Re:Devuan considers machine IDs by patrickg_zill on Saturday March 30, 2019 @04:20PM (#19531592)
Does something like

dd if=/dev/urandom bs=1 count=16 | hexdump

Give you something that you can use?

Re:Devuan considers machine IDs by mirimir on Saturday March 30, 2019 @05:13PM (#19531895)
Well, the machine-id of that Debian VM was ...

    38d05397c25548b4f4bda7751b5062
... and ...

    $ FOO=`cat /dev/urandom | tr -dc a-z0-9 | head -c${1:-30}`
    $ echo $FOO
      6we4gvnmx00w208ffty6i11m82rw6d
But I have no clue whether systemd would be happy with that. Maybe later I can test more.

Edit: Oops. Make that ...

    $ FOO=`cat /dev/urandom | tr -dc abcdef0-9 | head -c${1:-30}`
    $ echo $FOO
      b486935dbb9e9fe603328a19e2b5b4
Re:Devuan considers machine IDs by justinclift on Sunday March 31, 2019 @02:00AM (#19534146)
Maybe use pwgen?

Something like:

    $ pwgen -1s 31
    qHfKU46H2RA2WUr0EZ1zBHfIBLKZKuT
Re:Devuan considers machine IDs by mirimir on Sunday March 31, 2019 @07:52AM (#19535130)
I think that it needs to be hexadecimal. But not sure.
Re:Devuan considers machine IDs by justinclift on Sunday March 31, 2019 @08:35AM (#19535264)
No worries. :)
Re:Devuan considers machine IDs by tinus_hn on Saturday March 30, 2019 @04:33PM (#19531667)
Because then Google doesn’t have a persistent identifier to track you, of course.