Static IP before first boot

  • Platform information:
    • Hardware: RP3+
    • OS: openhabian
    • openHAB version: latest one

Is there any way to setup static ip address please?
I have no dhcp and no access to ext partition, also no HDMI device.

I can add line to



but it stop on

2018-03-13_22:53:34_UTC [openHABian] Starting the openHABian initial setup.
2018-03-13_22:53:34_UTC [openHABian] Storing configuration… OK
2018-03-13_22:53:34_UTC [openHABian] Changing default username and password… OK
2018-03-13_22:53:34_UTC [openHABian] Setting up Ethernet connection… OK
2018-03-13_22:53:34_UTC [openHABian] Ensuring network connectivity…

any solution for that please? raspbian works perfect but openhab stop.
Any solution for that?

Not really. You’ll need internet connectivity at that stage.
There’s hints in the README how to build your custom image, but it’s for sure easier to attach a Router/DHCP server, openHABian isn’t meant to work without one.

I understand it has to be connected to internet, but waiting for stable connection for how long…? I was waiting 5H.
Trust me it would be easier to ask user about ip address or take it from openhab.config.

Ensuring network connectivity…

For million years for connection, why openhabian do not ask me after 5 minutes:

I have no connection to internet.
Do you want set up IP manual?

Nice and easy, and user friendly.

I would be grateful if you will give me link to setup openhab image.

Select the image Raspberry Pi image: openhabianpi-raspbian-201804031720-gitdba76f6-crc9e93c3eb.img.xz

Then use Etcher to flash onto your SD card, then pop it in the RPI, power on and wait 15 or so minuets.

EDIT: This is for installing openhabian to run headless and nothing else. Using this you will not have a GUI, will need to connect via ssh or samba.

excuse me?!


Sorry if I misunderstood what you were looking for.

Nope. You need inet connectivity to install openHABian, and if you have that, you will also have a DHCP server as well (well except in very weird homemade setups, but in these cases you should know yourself how to handle those, e.g. by temporarily firing up such a server).
openHABian requires DHCP or it cannot boot without raising questions to be answered (which doesn’t work on headless systems).
That is nice and easy and user friendly, so that’s why openHABian works THAT way.
If you don’t like that, feel free to edit the scripts and insert your manual interface setup somewhere and/or build a custom image to have that included.

I already wrote:

Here’s a link with tutorial for setting up openhabian, as well as other tutorials, if needed.

so I have to find router then connect router to internet then connect pi, find what ip it has, then log on, edit dhcp.conf then I can connect to proper network, and then I will be able to use? am I right?

No, if the router/dhcp server properly selects and assigns an ip then openHABian will use that one. No need to logon, edit etc. And you don’t have to “find” the router. openHABian will send broadcasts and router will respond if it’s in the same subnet and properly configured .

as I said

One question, if you program the static do you then have an internet connection? Are you on a network that does not have a dhcp server but has internet?

@anon89326932 I have an idea if so. I will type it up on my laptop by tomorrow. Need to look something up though.

Yes, there is internet connection and I have ip mask everything. DHCP is disabled.
Thank you very much.

What is the purpose of disabling the DHCP?

Definitely no. As Rich answered you’re the probably only person so far to “require” this and clearly to rework openHABian just for you is NOT easier than you to enable a DHCP server.
The IP can’t be taken from openhab.config either as that’s not yet configured at that boot stage and there is no (working) default.

And you do have a DHCP server. Why don’t you just enable it ?
At least for the openHABian initial installation, then you can edit the Pi’s config and assign a static IP so you won’t need the DHCP server any longer and can disable it.

A home network without DHCP is exceptionally rare. It would be easier for you for sure, but that is a not insignificant amount of work to get something working for which you are the first person to have this problem.

It very well may be that in your current set of limitations openHABian (or Raspbian for that matter) will not be an option.

The only way you will be able to set a static IP without a monitor is to access the ext partition. I’ll say it again, this is the only way. So you will either need to:

  1. enable dhcp
  2. get an HDMI device
  3. install software that will let you access the ext partition

Luckily there are lots of options to do 3. Assuming you are on Windows since if you were on anything else you would be able to access the ext partition. You can install Paragon’s Linux File Systems for Windows software (it has a 30 or 90 day free trial). You can install VirtualBox and use a Linux VM. You can find someone who has a Linux or Mac to do this.

If you enable dhcp, you can then log into the RPi over the network using the assigned IP address, manually edit the network to the static configs, then disable dhcp.

@anon89326932 here is my thought of what you could try. I did something recently in this file on openhabian.

You may be able to modify the file to copy a config file from the boot partition to the ext partition. Add a line in the file at the top cp netfile /etc/netfile.

I am unclear exactly how to setup the static ip using a file, it looks as if the dhcpd file needs to be modified. you could put it on the sd card then use a cp command to copy to the correct place.

If a reboot would be required to get the file read in you could add that into the first boot file also or just wait a few mins until you know nothing going on and manually power cycle.

Just an idea I had, It may work. If it does let me know, I am curious. I can’t try right now no spare sd card.

Note: if you want to reboot gracefully, you could look for the presence of a file or lack of file using if [ -f file ] xxx do a man on test or google for syntax. Something like:

if [[ -e $myfile ]] 

rm -f myfile        

**double check syntax.

1 Like

Why do you think it is home network?

I have no admin rights to install software.

I have no access to ext partition.

Well then that’s a weird (and to me, incomprehensible) environment you want to do home automation in.
That’s definitely not what openHABian is built for.
Get these rights, or get a DHCP server, or get HDMI, and modify your openHABian instance at the stage it fails to reach the internet. Or better yet, install your own Linux from scratch. Or install openHAB on Windows.
Even if you get openHABian to work, you’re likely to run into lots of further trouble afterwards in combination with your setup.

Yes, it weird for everyone ho do not know what environmental I am.

Trust me, not every one is same as you, so maybe I want use it for special reason where my environment is not a problem.

I wish you to be more open, and to be more understanding, and please do not judge people because that is very rude.

I know that is very frustrating when you can not fix an issue, specially when it should be easy to fix.