[SOLVED] Initial setup exiting with an error!


I tried to reinstall the openHab on my RapPi but I still have the same problem. After the installation when I want to start OpenHab I get always the problem like in the log below.

2018-04-08_06:45:11_UTC [openHABian] Starting the openHABian initial setup.
2018-04-08_06:45:11_UTC [openHABian] Storing configuration… OK
2018-04-08_06:45:11_UTC [openHABian] Changing default username and password… SKIPPED
2018-04-08_06:45:11_UTC [openHABian] Setting up Ethernet connection… OK
2018-04-08_06:45:11_UTC [openHABian] Ensuring network connectivity… OK
2018-04-08_06:45:12_UTC [openHABian] Waiting for dpkg/apt to get ready… OK
2018-04-08_06:45:20_UTC [openHABian] Updating repositories and upgrading installed packages… FAILED
2018-04-08_06:45:27_UTC [openHABian] Initial setup exiting with an error!

I’ve noticed also an error message during the instaltion, which is saying that the first-boot.sh finished with an error.

I use a preconfigured image for the Raspberry Pi, with the latest build of openHAB 2 (1.4.1)
I’ve already checked:

  • the internet connection, (both though lan and wifi)
  • I’ve changed SD card,
  • flashed the image with Etcher and Win32diskimager,
  • add mirrors to /etc/apt/sources.list, ( I found this solution on this forum), didn’t help
  • I went through the file first-boot.sh but everything look pretty normal.

Please for any help.

What model is your Raspi? If it’s not a 3b+ I world try 1.4, to see if there is the same problem.

I have Rasp3B, just checked 1.4.0, everything is the same. I don’t understand it completely, I was installing openhab two times with no problems. Now I’m fighting with this the second day. Maybe the problem lays here, there is information, amongst the others:

  Flag file 'afterfirstboot.lock' not found, continuing with /boot/first-boot.sh

but later after several lines:
Script /boot/first-boot.sh failed
Started /etc/rc.local Compatibility

Starting Hold until boot process finishes up

Any idea what to check next?

1 Like

I found the problem. I bought a new power supply, it’s broken. Higher load was causing the voltage drop.

Me too getting the same errore at the same point every time
Don’t think the cause would be power related since the same error occurred several times after reformatting different SD card and image rewriting (with Etcher)

Any help? this make me crazy

Log in with ssh and then cancel the script with strg+c and do sudo apt update && sudo apt upgrade, then start script again sudo ./boot/firstBoot.sh or so. Worked for me.

Looks like some problem with apt update or so. So if manually updating the following steps work.


I had the same error on my pine64 and running the apt update/upgrade manually and restarting the first boot script got me past that same error. Thanks!

Same for me:

sudo apt update && sudo apt upgrade


sudo ./boot/first-boot.sh

solved this problem.

not sure if relevant but had the same as all of you and all I’ve done it’s burning the .xz file instead of .img and used USB 2.0 instead of 3.0 and worked for me, Good luck!

Hi together,

I’m having a quite similar problem. I tried two different raspberries and even 2 SD cards.
I’ve tried

sudo apt update && sudo apt upgrade
sudo ./boot/first-boot.sh

but without success.

Here is the output of my raspberry:

Linux openHABianPi 4.9.80-v7+ #1098 SMP Fri Mar 9 19:11:42 GMT 2018 armv7l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Tue Apr 16 01:06:14 2019 from

Attention! The openHABian setup process seems to have failed on your system.
Sorry, this shouldn’t happen! Please restart the installation process. Chances
are high setup will succeed on the second try.

In order to find the cause of the problem, have a look at the installation log:
sudo cat /boot/first-boot.log

Contact the openHAB community forum for help if the problem persists:

[01:57:03] openhabian@openHABianPi:~$ sudo cat /boot/first-boot.log

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

[sudo] password for openhabian:
2018-03-13_22:53:58_UTC [openHABian] Starting the openHABian initial setup.
2018-03-13_22:53:58_UTC [openHABian] Storing configuration… OK
2018-03-13_22:53:58_UTC [openHABian] Changing default username and password… OK
2018-03-13_22:53:59_UTC [openHABian] Setting up Wi-Fi connection… OK, rebooting…
2018-03-13_22:54:15_UTC [openHABian] Starting the openHABian initial setup.
2018-03-13_22:54:15_UTC [openHABian] Storing configuration… OK
2018-03-13_22:54:15_UTC [openHABian] Changing default username and password… SKIPPED
2018-03-13_22:54:15_UTC [openHABian] Setting up Wi-Fi connection… OK
2018-03-13_22:54:15_UTC [openHABian] Ensuring network connectivity… OK
2018-03-13_22:54:16_UTC [openHABian] Waiting for dpkg/apt to get ready… OK
2019-04-15_23:04:19_UTC [openHABian] Updating repositories and upgrading installed packages… OK
2019-04-15_23:19:48_UTC [openHABian] Installing git package… OK
2019-04-15_23:20:47_UTC [openHABian] Cloning myself… OK
2019-04-15_23:20:50_UTC [openHABian] Executing ‘openhabian-setup.sh unattended’…
2019-04-15_23:20:50_UTC [openHABian] Checking for root privileges… OK
2019-04-15_23:20:50_UTC [openHABian] Loading configuration file ‘/etc/openhabian.conf’… OK
2019-04-15_23:20:50_UTC [openHABian] Setting timezone based on IP geolocation… OK (Europe/Berlin)
2019-04-16_01:23:09_CEST [openHABian] Setting locale based on openhabian.conf… OK
2019-04-16_01:23:36_CEST [openHABian] Setting hostname of the base system… OK
2019-04-16_01:23:36_CEST [openHABian] Setting the GPU memory split down to 16MB for headless system… OK
2019-04-16_01:23:36_CEST [openHABian] Enabling Audio output… OK
2019-04-16_01:23:37_CEST [openHABian] Installing basic can’t-be-wrong packages (screen, vim, …)… OK
2019-04-16_01:25:10_CEST [openHABian] Installing additional needed packages… OK
2019-04-16_01:25:27_CEST [openHABian] Installing additional bluetooth packages… OK
2019-04-16_01:25:34_CEST [openHABian] Adding slightly tuned bash config files to system… OK
2019-04-16_01:25:34_CEST [openHABian] Adding slightly tuned vim config file to system… OK
2019-04-16_01:25:34_CEST [openHABian] Downloading and setting up FireMotD… OK
2019-04-16_01:27:22_CEST [openHABian] Installing Zulu Embedded OpenJDK… OK
2019-04-16_01:30:07_CEST [openHABian] Installing or upgrading to latest openHAB release (stable)… FAILED (apt)
2019-04-16_01:35:41_CEST [openHABian] Initial setup exiting with an error!

[01:57:58] openhabian@openHABianPi:~$

This one wonders me, if there are currently an issue with the openHAB repository ?!?
2019-04-16_01:30:07_CEST [openHABian] Installing or upgrading to latest openHAB release (stable)… FAILED (apt)

1 Like

I’m having the exact same problem, it only manifested itself after rebooting for the first time after doing an update/upgrade, can’t remember which. in the openhabian-config. I have tried to restore from backup but it was done after this date and tried 4 times with the xz image.
I have tried everything above except a new PSU.
I am also going to throw it on a windows PC for good measure will let you know how that goes

I could solve the problem nix changing from wlan to cable.

I’m on cable

This did the trick from Failed installation on Pi3B+ - Cloning myself... FAILED

sudo rm -R /opt/openhabian
sudo reboot

For me, the problem was that, out of the box, the image had an incompatible version of apt-utils.


sudo apt --fix-broken install

fixed the problem

friend I am having the same problem I have an rp4 and I am installing openhab version 1.5 but I have tried anyway so that I can start and it gives me exactly the same error when opening the ssh, someone who explains to me in the best way how to solve this trouble? :Cara cansada::cráneo:

I was able to work Arouca this issue by using a Network cable instead of wlan.