[SOLVED] Openhabian-config will not let me change hostname

openhabian-config v1.5-522 gives me the following error in option ‘31 | Change Hostname’: ‘The hostname you’ve entered is not a valid hostname. Please try again.’
and it will not accept any host name at all.
Worked fine last time I tried a rebuild which was with v1.5-520.

What OS?

Same issue for me with 1.5-522, after a new install with the Raspbian Buster openHABian image on a Raspberry Pi 4.

raspbian-201908050414 (which is Buster) but I have the same problem when I tried the previous release of raspbian from 2018.
Tried on RaspberryPi Model 3B. Also tried on a Model 2B.

The OpenHABian devs insist on removing raspi-config rather than work around any conflicts… Those developers need to insure they replicate ALL the functionality they remove.

I have located the source of the problem.
In openhabian-config v1.5-520, there is a line in file /opt/openhabian/functions/system.bash which reads:

new_hostname=$(whiptail --title "Change Hostname" --inputbox "Please enter the new system hostname (no special characters, no spaces):" 10 60 3>&1 1>&2 2>&3)
if [ $? -ne 0 ]; then return 1; fi
if ( echo "$new_hostname" | grep -q ' ' ) || [ -z "$new_hostname" ]; then
  whiptail --title "Change Hostname" --msgbox "The hostname you've entered is not a valid hostname. Please try again." 10 60

but in openhabian-config v1.5-522 it reads:

if ! whiptail --title "Change Hostname" --inputbox "Please enter the new system hostname (no special characters, no spaces):" 10 60 3>&1 1>&2 2>&3; then return 1; fi
if ( echo "$new_hostname" | grep -q ' ' ) || [ -z "$new_hostname" ]; then
  whiptail --title "Change Hostname" --msgbox "The hostname you've entered is not a valid hostname. Please try again." 10 60

So the new version of this script refers to the variable $new_hostname which has not been set to anything and hence is invalid.

@mljbr4 Nice.
Can you create an Issue and PR on GitHub?

Done. Created Issue #732

1 Like

I feel quite foolish. I have never used GIT before to contribute but I can’t seem to successfully create a Pull Request.
e.g. I have created my own fork from openhab/openhabian and I have modified system.bash but I do not know how to create the pull request so my change can be considered for inclusion in the master. Any idea what I should be doing?

Follow the steps documented here:

1 Like

@mljbr4 I had the same issue don’t feel silly. The interface is not the most obvious. I am still not sure I could do it again fast.

1 Like

Ops, this indicates that we (the community) did not do a good job helping users to get started contributing :confused: Sorry for that.
If you need help let me know.

It’s easiest if you use the Github GUI and edit the file online. With CLI git it is a bit of fiddling.
Create a Github repo (using Web GUI) and on your box, git add remote URL yourrepo, then git push yourrepo. It’ll return you a link, follow that to create the PR.

1 Like