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

     
  • 相关阅读:
    2020学习 04 python 爬取某政府网站信件
    2020学习03
    2020学习02
    阅读笔记--《一线架构师实践指南》--Pre-architecture阶段
    重构“信息领域热词分析”,实现六种质量属性战术
    pycharm错误:Error updating package list: connect timed out解决
    python连接mysql数据库——编码问题
    阅读笔记--《大型网站技术架构》—02架构
    python查询MySQL数据库的表以及所有字段
    python连接mysql数据库——版本问题
  • 原文地址:https://www.cnblogs.com/arci/p/15048389.html
Copyright © 2011-2022 走看看