:: Re: [DNG] new freedesktop "standard…
Inizio della pagina
Delete this message
Reply to this message
Autore: Nate Bargmann
Data:  
To: dng
Oggetto: Re: [DNG] new freedesktop "standard": /etc/machine-id
* On 2019 09 Mar 18:09 -0600, Olaf Meeuwissen wrote:
> All the info I have seen on this topic in the thread is consistent with
> hostid returning the "mangled" IP address belonging to the machine's
> current hostname. This is normally set from /etc/hostname. That file
> is created during installation. The IP address is in /etc/hosts.
>
> Taking 007f0100 as an example, swapping bytes in pairs gives 7f000001
> which gives 127.0.0.1. For 007f0101 you get 127.0.1.1.
>
> I just tried the following on my machine
>
>   $ sudo hostname yoda   # anything different from what you have now
>   $ hostid               # this is silent for a while and then says
>   00000000

>
> Presumably, DNS times out and then you get whatever the code used to
> initialize the return value.
>
> Trying to revert my change
>
> $ sudo hostname quark # this ponders things for a while and says
> sudo: unable to resolve host yoda
> $ hostid
> 007f0101
>
> Please note that the hostname command does *not* modify the contents of
> /etc/hostname. To persist changes across reboots you'll need to edit
> /etc/hostname yourself.


It looks like I have an exception:

pi@aprxpi:~$ cat /etc/os-release 
PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
NAME="Raspbian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
pi@aprxpi:~$ ip address
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether b8:27:eb:8b:f3:1c brd ff:ff:ff:ff:ff:ff
    inet 192.168.25.61/24 brd 192.168.25.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fd5d:beb2:2c86:0:ba27:ebff:fe8b:f31c/64 scope global mngtmpaddr dynamic 
       valid_lft forever preferred_lft forever
    inet6 2001:470:1f0f:9fa:ba27:ebff:fe8b:f31c/64 scope global mngtmpaddr dynamic 
       valid_lft forever preferred_lft forever
    inet6 fe80::ba27:ebff:fe8b:f31c/64 scope link 
       valid_lft forever preferred_lft forever
4: ax0: <BROADCAST,NOARP,UP,LOWER_UP> mtu 512 qdisc pfifo_fast state UNKNOWN group default qlen 10
    link/ax25 9c:60:9c:84:40:40:74 brd a2:a6:a8:40:40:40:00
pi@aprxpi:~$ hostid 
a8c03d19
pi@aprxpi:~$ hostname 
aprxpi.lan
pi@aprxpi:~$ cat /etc/hosts
127.0.0.1    localhost
127.0.1.1    aprxpi
pi@aprxpi:~$ ll /etc/host*
-rw-r--r-- 1 root root   9 Aug  7  2006 /etc/host.conf
-rw-r--r-- 1 root root  11 Mar 11  2018 /etc/hostname
-rw-r--r-- 1 root root  37 Jun 18  2018 /etc/hosts
-rw-r--r-- 1 root root 411 Mar 11  2016 /etc/hosts.allow
-rw-r--r-- 1 root root 711 Mar 11  2016 /etc/hosts.deny



On this particular machine the hostid is consistent with the IPv4 address of eth0.

- Nate

--

"The optimist proclaims that we live in the best of all
possible worlds. The pessimist fears this is true."

Web: http://www.n0nb.us GPG key: D55A8819 GitHub: N0NB