zoukankan      html  css  js  c++  java
  • 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闪存盘启动),但是根据我的经验,这不是必需的。可能会发生不好的事情,但是无论如何都会通过重新启动来修复发生的不好的事情。

     
  • 相关阅读:
    mysql中json_extract函数的使用?作用是什么?
    python 里面的单下划线与双下划线的区别(私有和保护)
    理解Python的双下划线命名
    python list中append()与extend()用法
    sqlalchemy(二)高级用法 2
    查看python对象的属性
    python map()
    SpringMVC学习系列(3) 之 URL请求到Action的映射规则
    SpringMVC学习系列(2) 之 经典的HelloWorld实现
    SpringMVC学习系列(1) 之 初识SpringMVC
  • 原文地址:https://www.cnblogs.com/arci/p/15048389.html
Copyright © 2011-2022 走看看