#1316 PR merged: Set hostname in both /etc/hostname and /etc/HOSTNAME.

Labels: enhancement, cleanup, fixed / solved / done, minor bug

schabrolles opened issue at 2017-04-17 15:27:

Since 201921869e228d301cff7b4500c84e8cc165c539, SLE12 losts its hostname in recovery mode.

The reason seems to be because /etc/hostname file exists in SLE12, but only /etc/HOSTNAME is used to set hostname.

I propose the following simple change to solve this issue.

jsmeix commented at 2017-04-18 09:58:

On my SLES12 and openSUSE Leap 42.1 systems I have:

# ls -l /etc/hostname /etc/HOSTNAME
-rw-r--r-- 1 root root ... /etc/hostname
lrwxrwxrwx 1 root root ... /etc/HOSTNAME -> hostname

In the ReaR recovery system we are free to do it as we like
so that we can also have two regular files /etc/hostname
and /etc/HOSTNAME with identical content.

jsmeix commented at 2017-04-18 10:07:

Perhaps we should even have those two same files
/etc/hostname and /etc/HOSTNAME
in any case in the recovery system like:

# Some Linux distributions use /etc/hostname (e.g. Arch Linux)
# but others use /etc/HOSTNAME (e.g. Red Hat and SUSE)
# so that both are provided in the recovery system to be on the safe side
# cf. https://github.com/rear/rear/pull/1316
# and https://github.com/rear/rear/pull/1286
echo $HOSTNAME >$ROOTFS_DIR/etc/hostname
echo $HOSTNAME >$ROOTFS_DIR/etc/HOSTNAME

schabrolles commented at 2017-04-18 10:34:

@gdha @jsmeix Sure... here it is

jsmeix commented at 2017-04-19 11:13:

@schabrolles
many thanks for finding that issue and for your fix!


[Export of Github issue for rear/rear.]