hostname change = no boot

Having issues with your DietPi installation, or, found a bug? Post it here.
Post Reply
gbb
Posts: 7
Joined: Sun Jun 25, 2017 1:46 am

hostname change = no boot

Post by gbb »

I installed, did an update, selected the HiFiBerry Pro board and was working my way down the settings list.

I changed the hostname (RoonPlayLiving) and upon reboot, the boot list displays, the diskcheck completes and a couple more lines display (too quickly to read) and then the screen blanks.

The system is NOT visible via lanscan, but the lights are on.

Any suggestions?
User avatar
WarHawk
Posts: 608
Joined: Thu Jul 20, 2017 8:55 am

Re: hostname change = no boot

Post by WarHawk »

You are going to have to pull the card, plug it into a Linux machine...then manually change 2 files with correct hostname...then use dietpi-config to change the hostname where it changes those files itself (on a running machine). Due to the mismatch in what dietpi.txt says and what is written in those files causes it to lock..only way to edit them is have a Linux machine that can mount then edit as root the files you need to file

I believe the files are /etc/hostname and /etc/hosts

However the dev's of the script can tell you exactly which files need to be updated
gbb
Posts: 7
Joined: Sun Jun 25, 2017 1:46 am

Re: hostname change = no boot

Post by gbb »

Thanks. That seems like a major bug......
User avatar
MichaIng
Site Admin
Posts: 2293
Joined: Sat Nov 18, 2017 6:21 pm

Re: hostname change = no boot

Post by MichaIng »

@gbb
Just so be sure:
- Your device is actually an RPi, right?
- This is a fresh DietPi image? Just flashed, started, wait for first run setup to update to current DietPi version, reboot and finish first run dietpi-software setup. Then you configured the DAC and hostname?
- You used dietpi-config to change the hostname, or directly within dietpi.txt (which should just have an effect before first boot)?

The script behind this is quite trivial: https://github.com/Fourdee/DietPi/blob/ ... e_hostname
Indeed the new hostname is added to /etc/hostname and /etc/hosts to the default internal host IP 127.0.1.1.
This is a quite trivial and should not break any reboot.

Did you change other settings. Especially if you choose (on RPi) screen resolution "headless" or set "CONFIG_HDMI_OUTPUT=0" to dietpi.txt, then on boot the screen will blank. This is for SSH-only setups. But this should not effect network connectivity.

Your router/DHCP server cannot see the device at all? After changing hostname, of course potentially assigned IPs can be lost and you might need to re-add the device respectively re-assign an IP to it. It depends a bid I think, sometimes the hostname is just handled visually and if it's about IP reservation etc. just the MAC counts.
gbb
Posts: 7
Joined: Sun Jun 25, 2017 1:46 am

Re: hostname change = no boot

Post by gbb »

MichaIng wrote: Thu Aug 09, 2018 12:43 am @gbb
Just so be sure:
- Your device is actually an RPi, right?

Yup

- This is a fresh DietPi image? Just flashed, started, wait for first run setup to update to current DietPi version, reboot and finish first run dietpi-software setup. Then you configured the DAC and hostname?

I ran through the settings in order on the setup menu. Turns out I had selected the worng version of HIFIBerry, but that shouldn't matter.....

- You used dietpi-config to change the hostname, or directly within dietpi.txt (which should just have an effect before first boot)?

The former. I did notice that (seems like an odd place to have it and is IMHO easy to miss) setting the noise to low, switches off HDMI. It is POSSIBLE that I miss-set that instead of escaping back as-is.

The script behind this is quite trivial: https://github.com/Fourdee/DietPi/blob/ ... e_hostname
Indeed the new hostname is added to /etc/hostname and /etc/hosts to the default internal host IP 127.0.1.1.
This is a quite trivial and should not break any reboot.

Did you change other settings. Especially if you choose (on RPi) screen resolution "headless" or set "CONFIG_HDMI_OUTPUT=0" to dietpi.txt, then on boot the screen will blank. This is for SSH-only setups. But this should not effect network connectivity.

See above. The Pi wasn't appearing (with either wired or wireless IP) in Lanscan at all.


Your router/DHCP server cannot see the device at all? After changing hostname, of course potentially assigned IPs can be lost and you might need to re-add the device respectively re-assign an IP to it. It depends a bid I think, sometimes the hostname is just handled visually and if it's about IP reservation etc. just the MAC counts.
I did try editing the hosts files, as in the earlier suggestion. I removed the line form each, but no change.

I ended up reinstalling from the .img and running through the setup again.
User avatar
MichaIng
Site Admin
Posts: 2293
Joined: Sat Nov 18, 2017 6:21 pm

Re: hostname change = no boot

Post by MichaIng »

Removing the lines will definitely cause problem. You always need to have a /etc/hostname assigned and a related entry within /etc/hosts. This IP there can be changed, if the client has a fixed IP, but leaving as 127.0.1.1 is an always working default.

On first boot, if for some reasons you want to revert, the entries are:
/etc/hostname => DietPi
/etc/hosts =>
127.0.0.1 localhost
127.0.1.1 DietPi

The hostname itself can be changed without major effect, but the lines always need to be present.

Just not sure if SSH keys need or should be recreated when changing the hostname? However I never faced an issue, besides PuTTY asked me to again trust the host. I guess regeneration is done automatically, if after reboot (SSH service start) hostname and keys do not match. And anyway this should never break network connectivity.
gbb
Posts: 7
Joined: Sun Jun 25, 2017 1:46 am

Re: hostname change = no boot

Post by gbb »

MichaIng wrote: Thu Aug 09, 2018 3:11 pm Removing the lines will definitely cause problem. You always need to have a /etc/hostname assigned and a related entry within /etc/hosts. This IP there can be changed, if the client has a fixed IP, but leaving as 127.0.1.1 is an always working default.

On first boot, if for some reasons you want to revert, the entries are:
/etc/hostname => DietPi
/etc/hosts =>
127.0.0.1 localhost
127.0.1.1 DietPi

The hostname itself can be changed without major effect, but the lines always need to be present.

Just not sure if SSH keys need or should be recreated when changing the hostname? However I never faced an issue, besides PuTTY asked me to again trust the host. I guess regeneration is done automatically, if after reboot (SSH service start) hostname and keys do not match. And anyway this should never break network connectivity.
OK, I left localhost in.

I'll have to redo more as I cannot update my existing Roon endpoints (dietpi tells me they are too old). Hmm.

Cheers
gbb
Posts: 7
Joined: Sun Jun 25, 2017 1:46 am

Re: hostname change = no boot

Post by gbb »

Interestingly, I just hit this exact same problem again on a new install on Rpi 3B+ and DietPi_v6.17_RPi-ARMv6-Stretch.

Here are the /etc/hostname file:
127.0.0.1 localhost
127.0.1.1 RPiDAC
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters


and hosts:
RPiDAC

The name is changed as I wanted, but the boot starts, then I get a 'No Signal' message on the screen and the light stays on but no network activity.

Seems like a hard bug!
User avatar
WarHawk
Posts: 608
Joined: Thu Jul 20, 2017 8:55 am

Re: hostname change = no boot

Post by WarHawk »

I think you have to change it in two places or it causes issues

Code: Select all

Core networking

    Update /etc/hostname

    Update /etc/hosts, so local address(es) resolves with the new system name.
    Reload the network configuration. You have two options:
        Reload configuration files

        <!> This will temporarily disconnect your system from the network (ssh usually resists short disconnection)

        <!> This might definitively disconnect your system from the network because networking might not restore connections; please reboot, which is not lazy, but ensures that your setup is really correct

        invoke-rc.d hostname.sh start
        invoke-rc.d networking force-reload
        invoke-rc.d network-manager force-reload

        ToDo: is it useful to reload network-manager?

        or the lazy way: Restart the system. 
https://wiki.debian.org/HowTo/ChangeHostname
gbb
Posts: 7
Joined: Sun Jun 25, 2017 1:46 am

Re: hostname change = no boot

Post by gbb »

Well, I believe that I've found the problem. Somehow the deitpi-config script is ALSO setting the display to headless under some circumstances.

I did not explicitly change that. However my way of working IS to step through each of the options in the menu, slecting and changing those I need to change as appropriate.

I've now experienced this problem twice, months apart, and the only consistent thing is my methodology in seting up a new installation.

Thanks to @WarHawk for the comment. I now have a [nother] working Roon endpoint to sub for my blownup Freya preamp (don't ask :-(((( ).

As a PS, I would sya that the networking setup in this release is a significant step backwards. It used to be simple to set up wireless and rto determine what was going on. This display is frankly awful and doen't detect SSIDs a all. The only way I got wireless to work at all was to edit the files before booting.
Post Reply