• GNU Linux Boot ID Machine ID


    https://dwaves.de/2017/06/29/gnu-linux-boot-id-machine-id/

    While the Boot ID

    /proc/sys/kernel/random/boot_id

    is newly generated with every reboot – the Machine ID uniquely identifies the host.

    It should be considered “confidential”, and must not be exposed in untrusted environments, in particular on the network.

    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.

    The machine ID does not change based on local or network configuration or when hardware is replaced. Due to this and its greater length, it is a more useful replacement for the gethostid(3) call that POSIX specifies.

    This machine ID adheres to the same format and logic as the D-Bus machine ID.

    src: https://www.freedesktop.org/software/systemd/man/machine-id.html

    http://0pointer.de/blog/projects/ids.html

    http://www.jinbuguo.com/systemd/machine-id.html

    https://man7.org/linux/man-pages/man5/machine-id.5.html

    尽管systemd-machine-id-setup并且systemd-firstboot非常适合使用systemd的系统/etc/machine-id,但尽管有标签,它也不是systemd文件。它也用于不使用systemd的系统上。因此,您可以使用以下dbus-uuidgen工具:

    rm -f /etc/machine-id
    

    然后

    dbus-uuidgen --ensure=/etc/machine-id
    

    正如Stephen Kitt所提到的,Debian系统可能同时具有/etc/machine-id/var/lib/dbus/machine-id文件。如果两者都作为常规文件存在,则它们的内容应该匹配,因此,也请删除/var/lib/dbus/machine-id

    rm /var/lib/dbus/machine-id
    

    并重新创建它:

    dbus-uuidgen --ensure
    

    最后一个命令隐式地/var/lib/dbus/machine-id用作文件名,并将从新生成的中复制机器ID /etc/machine-id

    dbus-uuidgen调用可能会或可能不会已经正常引导序列的一部分。如果它是引导顺序的一部分,那么删除文件并重新引导就足够了。如果需要运行dbus-uuidgen自己,请注意手册页中的警告:

    如果尝试更改正在运行的系统上的现有机器ID,则可能会导致发生不良情况。不要尝试更改此文件。另外,不要在两个不同的系统上使它相同。只要有两个不同的内核在运行,它就必须有所不同。

    因此,执行此操作后,一定不要在不重新引导的情况下继续使用系统。作为额外的预防措施,您可以先重新启动进入救援模式(或者按照您的建议,从活动的USB闪存盘启动),但是根据我的经验,这不是必需的。可能会发生不好的事情,但是无论如何都会通过重新启动来修复发生的不好的事情。

     
  • 相关阅读:
    复习一些奇怪的题目
    NOIP 考前 KMP练习
    NOIP 考前 并查集复习
    NOIP 考前 Tarjan复习
    NOIP 考前 图论练习
    BZOJ 1468 树分治
    Codeforces Round #376 (Div. 2)
    CodeVS 线段覆盖1~5
    Luogu 3396 权值分块
    BZOJ 2743 树状数组
  • 原文地址:https://www.cnblogs.com/arci/p/15048389.html
Copyright © 2020-2023  润新知