openhabian: Installation hangs on Raspberry PI 3

Installation hangs on: " Waiting for dpkg/apt to get ready…"

2017-03-03_16:19:14_UTC [openHABian] Booting for the first time! The initial setup might take a few minutes.
2017-03-03_16:19:14_UTC [openHABian] Storing configuration...
2017-03-03_16:19:14_UTC [openHABian] Changing default username and password...
2017-03-03_16:19:14_UTC [openHABian] Setting up Wifi connection... SKIPPED
2017-03-03_16:19:14_UTC [openHABian] Ensuring network connectivity...
2017-03-03_16:19:48_UTC [openHABian] Waiting for dpkg/apt to get ready...
2017-03-24_18:59:01_UTC [openHABian] Updating repositories and upgrading installed packages... 

2017-03-03_16:18:51_UTC [openHABian] Booting for the first time! The initial setup might take a few minutes.
2017-03-03_16:18:51_UTC [openHABian] Storing configuration...
2017-03-03_16:18:51_UTC [openHABian] Setting up Wifi connection... SKIPPED
2017-03-03_16:18:51_UTC [openHABian] Ensuring network connectivity...
2017-03-03_16:18:51_UTC [openHABian] Waiting for dpkg/apt to get ready...

2017-03-24_19:17:13_UTC [openHABian] Booting for the first time! The initial setup might take a few minutes.
2017-03-24_19:17:13_UTC [openHABian] Storing configuration...
2017-03-24_19:17:13_UTC [openHABian] Setting up Wifi connection... SKIPPED
2017-03-24_19:17:13_UTC [openHABian] Ensuring network connectivity...
2017-03-24_19:17:13_UTC [openHABian] Waiting for dpkg/apt to get ready...

2017-03-24_19:41:21_UTC [openHABian] Booting for the first time! The initial setup might take a few minutes.
2017-03-24_19:41:21_UTC [openHABian] Storing configuration...
2017-03-24_19:41:21_UTC [openHABian] Setting up Wifi connection... SKIPPED
2017-03-24_19:41:21_UTC [openHABian] Ensuring network connectivity...
2017-03-24_19:41:21_UTC [openHABian] Waiting for dpkg/apt to get ready...

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 53 (17 by maintainers)

Most upvoted comments

In my case, the problem was that IPv6 was not allowed (or not working with the router) and apt uses IPv6 by default.

I have disabled IPv6 for APT with this command:

echo ‘Acquire::ForceIPv4 “true”;’ | sudo tee /etc/apt/apt.conf.d/99force-ipv4

(source: https://unix.stackexchange.com/questions/9940/convince-apt-get-not-to-use-ipv6-method)

I also had to reboot the Pi to have the first-boot.sh script restarted.

@ThomDietrich I have downloaded latest (22 July 2018) openhabian for a trial. My installation was stuck at apt update and failed. When I debugged the issue further, it seems some of the debian repos are not reachable or lots of packet losses when using IPv6. When I disabled IPv6 using sysctl commands, the installation went ahead.

sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1

I am not sure why IPv6 is preferred by default on this distro. It should be IPv4. Not all regions and countries are fully IPv6 ready yet.

Disabling IPv6 altogether may not be preferable on some networks. Instead we can tell address resolver to prefer IPv4 over IPv6 in /etc/gai.conf by un-commenting this line

precedence ::ffff:0:0/96 100

There is another apt specific workaround. Add -o Acquire::ForceIPv4=true when running apt-get.

In the above posts I read symptoms I’ve seen myself a couple of times. In my case it’s mainly user error (not being patient) I think. At first boot (after burning the image) the system seems to hang on dpkg/apt to get ready. This is also the point where the date time switches so actual waiting time can not be seen anymore.

The first time I rebooted the Pi and it got stuck at the second attempt on missing dependencies.

After a new attempt (new burned image) I took a look at the /var/log/dpkg.log using tail -f /var/log/dpkg.log. The you see a lot of activity. I might be an idea to help the impatient with some kind of progress indication, since the reboot gets you into trouble.

Idea: maybe a dot for each added logline in dpkg.log?

partial /boot/first-boot.log

Every 2.0s: cat /boot/first-boot.log                                                                              Sat Sep  9 10:36:02 2017

2017-04-10_09:59:02_UTC [openHABian] Starting the openHABian initial setup. This might take a few minutes.
2017-04-10_09:59:02_UTC [openHABian] If you see this message more than once, something went wrong!
2017-04-10_09:59:02_UTC [openHABian] Storing configuration... OK
2017-04-10_09:59:02_UTC [openHABian] Changing default username and password... OK
2017-04-10_09:59:04_UTC [openHABian] Setting up Wifi connection... SKIPPED
2017-04-10_09:59:04_UTC [openHABian] Ensuring network connectivity... OK
2017-04-10_09:59:04_UTC [openHABian] Waiting for dpkg/apt to get ready... OK
2017-09-09_07:57:47_UTC [openHABian] Updating repositories and upgrading installed packages... OK
2017-09-09_08:18:08_UTC [openHABian] Installing git package... OK
2017-09-09_08:19:16_UTC [openHABian] Cloning myself... OK
2017-09-09_08:19:20_UTC [openHABian] Executing 'openhabian-setup.sh unattended'
2017-09-09_08:19:20_UTC [openHABian] Checking for root privileges... OK
2017-09-09_08:19:20_UTC [openHABian] Loading configuration file '/etc/openhabian.conf'... OK
2017-09-09_08:19:20_UTC [openHABian] Setting timezone based on IP geolocation... OK (Europe/Amsterdam)
2017-09-09_10:21:36_CEST [openHABian] Setting locale based on openhabian.conf... OK
2017-09-09_10:22:23_CEST [openHABian] Setting hostname of the base system... OK
2017-09-09_10:22:23_CEST [openHABian] Setting the GPU memory split down to 16MB for headless system... OK
2017-09-09_10:22:23_CEST [openHABian] Installing basic can't-be-wrong packages (screen, vim, ...)... OK
2017-09-09_10:27:19_CEST [openHABian] Installing additional needed packages... OK
2017-09-09_10:28:06_CEST [openHABian] Adding slightly tuned bash config files to system... OK
2017-09-09_10:28:06_CEST [openHABian] Adding slightly tuned vim config file to system... OK
2017-09-09_10:28:07_CEST [openHABian] Downloading and setting up FireMotD... OK
2017-09-09_10:29:06_CEST [openHABian] Installing etckeeper (git based /etc backup)... OK
2017-09-09_10:30:32_CEST [openHABian] Installing Zulu Embedded OpenJDK... OK
2017-09-09_10:35:31_CEST [openHABian] Installing openHAB 2.1 (stable)...

@ThomDietrich Seems to work OK without “sleep 600” as well. BTW, my issue was on Pi 2.