[SOLVED] openHABian - Updating repositories and upgrading installed packages... FAILED

Tags: #<Tag:0x00007f2fb55ea3d0>
  • Platform information: Rasp3
    • Hardware: ARM/Rasp3
    • OS: openHABian
    • openHAB version: 2.0 stable
  • Issue of the topic: [openHABian] Updating repositories and upgrading installed packages… FAILED

I found sometimes “mirrordirector.raspbian.org” is not working and you installation fails on the apt-get update / upgrade.

I got stuck 3 times until I found what was happening I want to share my fix (really simple) to avoid you to spend time looking for solution on Internet.

The error is: Updating repositories and upgrading installed packages… FAILED on the log file:

/boot/first-boot.log

The easy way is to connect your SD after image format to a linux computer, look for the apt-get sources (sources.list) and modify the http for a functional URL.

The other way is to wait to fail the installation, use ssh to connect to the raspberry and modify then the sources.list.

Anyway, you must do the next steps:

sudo vi /etc/apt/sources.list
  • Comment the first line:
#deb http://mirrordirector.raspbian.org/raspbian/ jessie main contrib non-free rpi
  • Add a new line using one of the web page working mirrors. I used as example:
deb http://ramses.wh2.tu-dresden.de/pub/mirrors/raspbian/raspbian/ jessie main contrib non-free rpi
  • Now simply reboot the raspberry:
sudo reboot

Now the installation process will continue after a OK on the updated packages.

6 Likes

I am facing a similar issue:

Log snapshot

2018-08-12_04:49:18_UTC [openHABian] Storing configuration… OK
2018-08-12_04:49:18_UTC [openHABian] Changing default username and password… SKIPPED
2018-08-12_04:49:18_UTC [openHABian] Setting up Ethernet connection… OK
2018-08-12_04:49:18_UTC [openHABian] Ensuring network connectivity… OK
2018-08-12_04:49:18_UTC [openHABian] Waiting for dpkg/apt to get ready… OK
2018-08-12_04:49:26_UTC [openHABian] Updating repositories and upgrading installed packages… FAILED
2018-08-12_04:49:32_UTC [openHABian] Initial setup exiting with an error!

What I did ?

  1. sudo vi /etc/apt/sources.list

    Comment the first line:

#deb http://mirrordirector.raspbian.org/raspbian/ jessie main contrib non-free rpi

Add a new line using one of the web page working mirrors. I used as example:

deb http://ramses.wh2.tu-dresden.de/pub/mirrors/raspbian/raspbian/ jessie main contrib…

The above did not work

  1. From the file ‘first-boot.sh’, commented the entire section
    [openHabian] Updating repositories and upgrading install packages…


    echo “FAILED”; fail in_progress; fi

After that, again I get the same logs…


2018-08-12_04:49:18_UTC [openHABian] Storing configuration… OK
2018-08-12_04:49:18_UTC [openHABian] Changing default username and password… SKIPPED
2018-08-12_04:49:18_UTC [openHABian] Setting up Ethernet connection… OK
2018-08-12_04:49:18_UTC [openHABian] Ensuring network connectivity… OK
2018-08-12_04:49:18_UTC [openHABian] Waiting for dpkg/apt to get ready… OK
2018-08-12_04:49:26_UTC [openHABian] Updating repositories and upgrading installed packages… FAILED
2018-08-12_04:49:32_UTC [openHABian] Initial setup exiting with an error!


This indicates, my changes did not take place.

Img: openhabianpi-raspbian-201804031720-gitdba76f6-crc9e93c3eb.img
Raspberry Pi 3 B Model
32GB SD card - Sandisk

I used Ubuntu 16-04 . I had inserted the SD card (using a USB) into Ubuntu, make changes to the sources.list and first-boot.sh and booted Pi3 again.

Any help in this direction would be appreciated !!

Cheers,
H.Jain

Never had this issue installing openhabian but here is a screen shot of my sources file. You may can copy the repo source and get it working. I do see you are using jessie and this is for stretch, it’ll either work or it won’t…:thinking:

Screenshot%20at%202018-08-12%2012-21-47

You may also be able to sudo openhabian-config and use the tools of openhabian. Look thru the options and find update or install the latest.

OK. Will try that

Hi All,
It turned out the issue was due to Incorrect Power Adapter.
I used a Power Adapter with Higher Current rating and everything started working properly.

Thank you All.

Cheers,
H. Jain

Hi, had the same issue, can you share with me the specs of the power adapter that worked for you please.

Appreciate it.

Hi ,
Any adapter which has 2A rating would do.

Example, a Samsung usb mobile charger.

Rgds,

Hemendra Jain

I recommend the power supply that comes with the RPI kit, 5v 2.5A. Using a 2A adapter may not be reliable, some list 2A but are really 1.7A. Just something to keep in mind.

The issue on this post can be found in several other topics with the solution being to replace the power supply.

FYI: I’ve had the same issue, but a simple reboot seems to have cured it.

1 Like

SOLVED!
I’m using OpenHabian on RaspPi3, I found sources.list file after installing comes wrong. The linux version is “stretch” and source doesn’t match with any, no mather how many times you reload it, or change the power supply. So I modified the file and is working now as this:

sudo nano /etc/apt/sources.list

#coment any other line
deb http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free rpi

I had the same issue and like @metin I could solve it by doing a simple reboot.

Additional info to other beginners: You can exit the displayed “firstboot.log” by pressing ctrl + d or ctrl + c (not sure). Then you are back on the console and you can do sudo reboot.

Last time it went smoothly, but this time I had also a failed installation.

When reading /boot/first-boot.sh I see that the installer fails when doing apt update.

Here’s what I did to fix the problem:

  • Exit the “first-boot” script by hitting <Ctrl>+C
  • Do not yet edit the file the file /etc/apt/sources.list
  • Run the following commands:
    1. openhabian@openHABianPi:~$ sudo apt update
      Results in:
      Get:1 http://mirrordirector.raspbian.org/raspbian stretch InRelease [15.0 kB]
      Hit:2 http://archive.raspberrypi.org/debian stretch InRelease
      Get:3 http://mirrordirector.raspbian.org/raspbian stretch/main armhf Packages [11.7 MB]
      Get:4 http://mirrordirector.raspbian.org/raspbian stretch/contrib armhf Packages [56.9 kB]
      Get:5 http://mirrordirector.raspbian.org/raspbian stretch/non-free armhf Packages [95.5 kB]
      Get:6 http://mirrordirector.raspbian.org/raspbian stretch/rpi armhf Packages [1360 B]
      Fetched 11.8 MB in 8s (1390 kB/s)
      Reading package lists… Done
      Building dependency tree
      Reading state information… Done
      79 packages can be upgraded. Run ‘apt list --upgradable’ to see them.

    2. openhabian@openHABianPi:~$ sudo apt upgrade
      Results in:
      Reading package lists… Done
      Building dependency tree
      Reading state information… Done
      You might want to run ‘apt --fix-broken install’ to correct these.
      The following packages have unmet dependencies:
      apt-utils : Depends: apt (= 1.4.8) but 1.4.9 is installed
      E: Unmet dependencies. Try ‘apt --fix-broken install’ with no packages (or specify a solution).

    3. openhabian@openHABianPi:~$ sudo apt --fix-broken install
      Results in:
      Reading package lists… Done
      Building dependency tree
      Reading state information… Done
      Correcting dependencies… Done
      The following additional packages will be installed:
      apt-utils
      The following packages will be upgraded:
      apt-utils
      1 upgraded, 0 newly installed, 0 to remove and 78 not upgraded.
      8 not fully installed or removed.
      Need to get 0 B/392 kB of archives.
      After this operation, 0 B of additional disk space will be used.
      Do you want to continue? [Y/n] y

Don’t be afraid to see warnings about missing locale information, as those are not show stoppers.

Now the broken update/upgrade process should be fixed. Time to reboot the Pi:
openhabian@openHABianPi:~$ sudo reboot now

This at least saved my broken first-boot process.

Probably /boot/first-boot.sh should be modified to run apt --fix-broken install before running apt upgrade

3 Likes

Thank you very much, I also has a broken install, fixing it manualy through ssh did the trick :slight_smile:

@shutterfreak Thank you a thousand times for this short help! Saved me a lot of time. Great!!!

sudo apt update
sudo apt upgrade
sudo apt --fix-broken install