Bosse_B
Posts: 980
Joined: Thu Jan 30, 2014 9:53 am

Error while doing apt upgrade on RPi3, why?

Sun Jul 12, 2020 12:15 pm

I have an RPi3 with some development tools installed and today I decided to do an update via apt.

Code: Select all

sudo apt update
...
sudo apt upgrade
....
Errors were encountered while processing:
 /var/cache/apt/archives/libssl1.0.0_1.0.1t-1+deb8u12_armhf.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
This is all it says. What went wrong?
And what is the state now and how can I make a successful upgrade?
I tried running the following (after googling):

Code: Select all

sudo apt-get -f install
sudo apt update
sudo apt upgrade
Now a whole bunch more packages were available for upgrade but when that was run it ended with this message:

Code: Select all

Errors were encountered while processing:
 /var/cache/apt/archives/dbus_1.8.22-0+deb8u3_armhf.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Notice that it now points to something else than the first time...
Bo Berglund
Sweden

User avatar
rpdom
Posts: 17173
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Error while doing apt upgrade on RPi3, why?

Sun Jul 12, 2020 1:14 pm

Were there any other messages further up the text? Quite often they are shown, but the install appears to continue and shows the "Errors encountered" message at the end.
Unreadable squiggle

Bosse_B
Posts: 980
Joined: Thu Jan 30, 2014 9:53 am

Re: Error while doing apt upgrade on RPi3, why?

Sun Jul 12, 2020 1:31 pm

rpdom wrote:
Sun Jul 12, 2020 1:14 pm
Were there any other messages further up the text? Quite often they are shown, but the install appears to continue and shows the "Errors encountered" message at the end.
Amazingly I could scroll upwards in the terminal (PuTTY) to the start of this process!
Here is what I found errorwise in my first run:

Code: Select all

...
Preparing to unpack .../libssl1.0.0_1.0.1t-1+deb8u12_armhf.deb ...
Unpacking libssl1.0.0:armhf (1.0.1t-1+deb8u12) over (1.0.1t-1+deb8u2) ...
dpkg-deb (subprocess): decompressing archive member: lzma error: compressed data is corrupt
dpkg-deb: error: subprocess <decompress> returned error exit status 2
dpkg: error processing archive /var/cache/apt/archives/libssl1.0.0_1.0.1t-1+deb8u12_armhf.deb (--unpack):
 cannot copy extracted data for './usr/share/doc/libssl1.0.0/changelog.Debian.gz' to '/usr/share/doc/libssl1.0.0/changelog.Debian.gz.dpkg-new': unexpected end of file or stream
Preparing to unpack .../python-ldb_2%3a1.1.20-0+deb8u2_armhf.deb ...
Unpacking python-ldb (2:1.1.20-0+deb8u2) over (2:1.1.20-0+deb8u1) ...
...
Errors were encountered while processing:
 /var/cache/apt/archives/libssl1.0.0_1.0.1t-1+deb8u12_armhf.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

 $ sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
 libglib2.0-bin : Depends: libglib2.0-0 (= 2.42.1-1+deb8u3) but 2.42.1-1 is installed
 libglib2.0-dev : Depends: libglib2.0-0 (= 2.42.1-1+deb8u3) but 2.42.1-1 is installed
 samba-dsdb-modules : Depends: samba-libs (= 2:4.2.14+dfsg-0+deb8u13) but 2:4.2.10+dfsg-0+deb8u3 is installed
E: Unmet dependencies. Try using -f.
So based on this I made this attempt:

Code: Select all

$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
...
---No errors during this command execution---
Next I tried this:

Code: Select all

$ sudo apt update
...
sudo apt upgrade
...
377 upgraded, 53 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/898 MB of archives.
After this operation, 225 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
...
Unpacking dbus (1.8.22-0+deb8u3) over (1.8.20-0+deb8u1) ...
dpkg-deb (subprocess): decompressing archive member: lzma error: compressed data is corrupt
dpkg-deb: error: subprocess <decompress> returned error exit status 2
dpkg: error processing archive /var/cache/apt/archives/dbus_1.8.22-0+deb8u3_armhf.deb (--unpack):
 cannot copy extracted data for './usr/bin/dbus-daemon' to '/usr/bin/dbus-daemon.dpkg-new': unexpected end of file or stream
Preparing to unpack .../procps_2%3a3.3.9-9+deb8u1_armhf.deb ...
Unpacking procps (2:3.3.9-9+deb8u1) over (2:3.3.9-9) ...
Processing triggers for systemd (215-17+deb8u13) ...
Processing triggers for man-db (2.7.0.2-5) ...
Errors were encountered while processing:
 /var/cache/apt/archives/dbus_1.8.22-0+deb8u3_armhf.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
....
sudo apt-get autoremove
....
$ sudo apt update
...
Ign http://mirrordirector.raspbian.org jessie/rpi Translation-en
Reading package lists... Done
Building dependency tree
Reading state information... Done
361 packages can be upgraded. Run 'apt list --upgradable' to see them.
And this is where I am at now...
Bo Berglund
Sweden

User avatar
DougieLawson
Posts: 39121
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Error while doing apt upgrade on RPi3, why?

Sun Jul 12, 2020 1:34 pm

What happens if you try
sudo rm /var/cache/apt/archives/libssl1.0.0_1.0.1t-1+deb8u12_armhf.deb
sudo apt update
sudo apt dist-upgrade -y


That should pull a fresh copy of libssl1.0.0_1.0.1t-1+deb8u12_armhf.deb from the RaspiOS repository and replace the broken copy you've got.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

Bosse_B
Posts: 980
Joined: Thu Jan 30, 2014 9:53 am

Re: Error while doing apt upgrade on RPi3, why?

Sun Jul 12, 2020 1:41 pm

DougieLawson wrote:
Sun Jul 12, 2020 1:34 pm
What happens if you try
sudo rm /var/cache/apt/archives/libssl1.0.0_1.0.1t-1+deb8u12_armhf.deb
sudo apt update
sudo apt dist-upgrade -y


That should pull a fresh copy of libssl1.0.0_1.0.1t-1+deb8u12_armhf.deb from the RaspiOS repository and replace the broken copy you've got.
Well it gets me here:

Code: Select all

 $ sudo apt dist-upgrade -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
 libssl-dev : Depends: libssl1.0.0 (= 1.0.1t-1+deb8u12) but 1.0.1t-1+deb8u2 is installed
E: Unmet dependencies. Try using -f.
Bo Berglund
Sweden

trejan
Posts: 2119
Joined: Tue Jul 02, 2019 2:28 pm

Re: Error while doing apt upgrade on RPi3, why?

Sun Jul 12, 2020 1:59 pm

Bosse_B wrote:
Sun Jul 12, 2020 1:31 pm

Code: Select all

Ign http://mirrordirector.raspbian.org jessie/rpi Translation-en
Jessie? How old is this install? Jessie has been out of support since 2017 as Raspbian doesn't do Long Term Support maintenance.

Bosse_B
Posts: 980
Joined: Thu Jan 30, 2014 9:53 am

Re: Error while doing apt upgrade on RPi3, why?

Sun Jul 12, 2020 8:35 pm

trejan wrote:
Sun Jul 12, 2020 1:59 pm
Bosse_B wrote:
Sun Jul 12, 2020 1:31 pm

Code: Select all

Ign http://mirrordirector.raspbian.org jessie/rpi Translation-en
Jessie? How old is this install? Jessie has been out of support since 2017 as Raspbian doesn't do Long Term Support maintenance.
Well, I really don't know exactly. But I would think from 2016 or so.
Is there a way on the actual system to see when it was installed?

Now I wanted to install Adafruit software for a DHT temperature sensor so I could monitor the temperature and humidity using this RPi, which otherwise holds a development system for FreePascal with Lazarus.
But the Adafruit system needs an updated RPi plus Python 3.5 or higher.
I have tried to install python via apt to get it upgraded but it says I have the latest version (3.4)...

Looks like I am hosed with this RPi3 then....
Bo Berglund
Sweden

trejan
Posts: 2119
Joined: Tue Jul 02, 2019 2:28 pm

Re: Error while doing apt upgrade on RPi3, why?

Sun Jul 12, 2020 9:00 pm

Bosse_B wrote:
Sun Jul 12, 2020 8:35 pm
Is there a way on the actual system to see when it was installed?
Running "cat /etc/rpi-issue" should show you what Pi image you used to do the original install.
Bosse_B wrote:
Sun Jul 12, 2020 8:35 pm
But the Adafruit system needs an updated RPi plus Python 3.5 or higher.
I have tried to install python via apt to get it upgraded but it says I have the latest version (3.4)...
Jessie only has Python 3.4. If you need Python 3.5 or higher then you need Stretch or newer. It isn't recommended to upgrade between versions on Raspbian/Raspberry Pi OS as you may end up with a broken system. It is especially not a good idea as you already seem to be having issues with apt and your packages.

If you do want to risk it then backup your card first and then follow the instructions on https://www.raspberrypi.org/documentati ... pdating.md

Using a fresh Buster install would be the best option as it is still supported unlike Jessie and Stretch but you'd need to manually transfer everything from your old install to the new one.

Bosse_B
Posts: 980
Joined: Thu Jan 30, 2014 9:53 am

Re: Error while doing apt upgrade on RPi3, why?

Sun Jul 12, 2020 10:18 pm

trejan wrote:
Sun Jul 12, 2020 9:00 pm
Bosse_B wrote:
Sun Jul 12, 2020 8:35 pm
Is there a way on the actual system to see when it was installed?
Running "cat /etc/rpi-issue" should show you what Pi image you used to do the original install.
This is what I got:

Code: Select all

cat /etc/rpi-issue
Raspberry Pi reference 2016-02-26
Generated using Pi-gen, https://github.com/RPi-Distro/Pi-gen, stage4
So as I thought, 2016...
Bosse_B wrote:
Sun Jul 12, 2020 8:35 pm
But the Adafruit system needs an updated RPi plus Python 3.5 or higher.
I have tried to install python via apt to get it upgraded but it says I have the latest version (3.4)...
Jessie only has Python 3.4. If you need Python 3.5 or higher then you need Stretch or newer. It isn't recommended to upgrade between versions on Raspbian/Raspberry Pi OS as you may end up with a broken system. It is especially not a good idea as you already seem to be having issues with apt and your packages.

If you do want to risk it then backup your card first and then follow the instructions on https://www.raspberrypi.org/documentati ... pdating.md

Using a fresh Buster install would be the best option as it is still supported unlike Jessie and Stretch but you'd need to manually transfer everything from your old install to the new one.
OK, I guess I have to examine this device more in detail and see what is on it.
I have many RPi units collected over the years and they were built for specific purposes at the time, with a lot having faded away.
I will probably repurpose it and if so put Buster on it.

Thanks for your suggestions and clarifications.
Bo Berglund
Sweden

Bosse_B
Posts: 980
Joined: Thu Jan 30, 2014 9:53 am

Re: Error while doing apt upgrade on RPi3, why?

Mon Jul 13, 2020 8:09 pm

FOLLOW-UP:
Concerning devices/operating systems becoming unsupported, what can I do (on other RPi:s) in order to keep the RPi fully updated?
If I do a

Code: Select all

sudo apt dist-upgrade
will that then be upgrading more than a sudo apt upgrade does?
Will it for example track the Raspbian development so that the Pi will get to the "bleeding edge" following such an upgrade?
It seems like such a PITA to have to start over with a blank SDcard every so often and do all these extra installs and configs needed for the development software I am using...

As an example I have an RPi4B where I am doing most of my current work. It was created 2019-09-26 after I ditched the SDcard I created to begin with the week after the RPi4B came out (about July 1 2019).
I remember that experience as a very prolonged one I do not want to re-live again.
So:
How can I keep my Raspbian Buster from Sept 2019 live and updated going forward?
Bo Berglund
Sweden

User avatar
rpdom
Posts: 17173
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Error while doing apt upgrade on RPi3, why?

Mon Jul 13, 2020 8:45 pm

If you are running Raspi OS Buster, then apt update and apt- full-upgrade (or dist-upgrade - they are the same thing) will ensure you have an up to data Buster system.

It will not update Buster to Bullseye when that change happens. Then you should start afresh again.
(It is possible to upgrade from one release to the next, but it can be risky).
Unreadable squiggle

User avatar
dickon
Posts: 1541
Joined: Sun Dec 09, 2012 3:54 pm
Location: Home, just outside Reading

Re: Error while doing apt upgrade on RPi3, why?

Mon Jul 13, 2020 9:05 pm

It's annoying, but I can understand RPT's reluctance to support dist-to-dist upgrades. Chances are it'll work, but they won't support them.

User avatar
DougieLawson
Posts: 39121
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Error while doing apt upgrade on RPi3, why?

Mon Jul 13, 2020 9:08 pm

dickon wrote:
Mon Jul 13, 2020 9:05 pm
It's annoying, but I can understand RPT's reluctance to support dist-to-dist upgrades. Chances are it'll work, but they won't support them.
The problem is the quirky errors that don't appear until weeks/months after you've done the upgrade. I've had some of those on Jessie to Stretch to Buster upgrades (done by mucking about with /etc/apt lists).

Keeping notes so you can run a fresh install and add in the things you just can't run without works for me. All the files I create in /home/pi are on a NAS device anyway, so I can run any system from a fresh install with very little going missing.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

User avatar
dickon
Posts: 1541
Joined: Sun Dec 09, 2012 3:54 pm
Location: Home, just outside Reading

Re: Error while doing apt upgrade on RPi3, why?

Mon Jul 13, 2020 9:20 pm

I forget when I last reinstalled my desktop -- well over a decade ago, I think -- and I've been dist-upgrading it ever since. So it can work, although I won't deny there have been hiccoughs once in a while. But IIRC most of those have been to do with nVidia's binary drivers and whatnot. I suspect RPT don't want similar hassles with their own packages being slightly out-of-Debian's-tree potentially interfering in someway.

I get it, but it's slightly irritating. OTOH, I don't tend to use Pis for that sort of workload, so a periodic reinstall is acceptable to me. I'll probably do an upgrade first to see if it works, and rollback if it doesn't, though.

Bosse_B
Posts: 980
Joined: Thu Jan 30, 2014 9:53 am

Re: Error while doing apt upgrade on RPi3, why?

Mon Jul 13, 2020 9:34 pm

dickon wrote:
Mon Jul 13, 2020 9:20 pm
I get it, but it's slightly irritating. OTOH, I don't tend to use Pis for that sort of workload, so a periodic reinstall is acceptable to me. I'll probably do an upgrade first to see if it works, and rollback if it doesn't, though.
Can you tell me how you intend to do a rollback?
Only thing I can think of is taking a full image copy of the SDcard before the upgrade, right?

Anyway, when I started this thread I was back home on 250/100 Mbit/s fiber, now arrived at my summer home where we have to rely on mobile broadband. This is usually almost usable and can reach upwards of 25 Mbit/+
But not now, I am down to 0.8 Mbit/s....
Too many other people out in their cottages in the vicinity and all trying to stream video, I believe. :evil:

So any kind of on-line operations needing a lot of data like apt commands are probably not an option here....
Bo Berglund
Sweden

User avatar
dickon
Posts: 1541
Joined: Sun Dec 09, 2012 3:54 pm
Location: Home, just outside Reading

Re: Error while doing apt upgrade on RPi3, why?

Mon Jul 13, 2020 10:05 pm

Bosse_B wrote:
Mon Jul 13, 2020 9:34 pm
Can you tell me how you intend to do a rollback?
Only thing I can think of is taking a full image copy of the SDcard before the upgrade, right?
No. I netboot virtually everything around here, as it makes management a lot easier: broken SD cards are not a thing, and if I break cmdline.txt or config.txt or install a bad rpi-update, it doesn't matter.

Every Pi has its own ZFS filesystem on my router / rootfs server / general dogsbody machine, which is snapshotted every 15 minutes and kept for varying lengths of time. So rolling back is a matter of 'zfs rollback rt0/support/$piname@$snapshotdatetime'[0] and rebooting the Pi. Symlinks in /tftpboot point to each rootfs/boot, which means they're all part of the same filesystem, so rpi-update and raspberrypi-* package updates all just work.

20 minutes to recover from a bad rpi-update? I can do it in seconds...

I highly recommend this approach if you have a machine capable of being a bootserver. And as that can be another Pi -- I'd use a Pi4 8GB with a 64b kernel and a brace of USB-attached SSDs if I was going to use one -- there's little to stop anybody...


[0] Just for illustration:

Code: Select all

root@pi4:~# ls /.zfs/snapshot/ | wc -l
336
root@pi4:~# ls /.zfs/snapshot/ | tail -20
2020-07-13_18.45.01--4h
2020-07-13_19.00.01--1w
2020-07-13_19.15.01--4h
2020-07-13_19.30.01--4h
2020-07-13_19.45.01--4h
2020-07-13_20.00.01--1w
2020-07-13_20.15.01--4h
2020-07-13_20.30.01--4h
2020-07-13_20.45.01--4h
2020-07-13_21.00.01--1w
2020-07-13_21.15.01--4h
2020-07-13_21.30.01--4h
2020-07-13_21.45.01--4h
2020-07-13_22.00.01--1w
2020-07-13_22.15.01--4h
2020-07-13_22.30.01--4h
2020-07-13_22.45.01--4h
pre5.4
presysvinit
x
root@pi4:~# 
I can 'zfs rollback rt0/support/telly-buster@' any one of those, and roll back to where it was at the time. Because this filesystem has been cloned into other live filesystems, there are actually a few more snapshots than there should be; I should tidy it up manually. Otherwise, '--1w' are kept for about a week, '--4h' four hours, etc. Midnight snapshots are kept for three months, which gives an awful lot of lattitude for breaking things and fixing them later in time. Amusingly, I can do it to a live Pi, and assuming nothing has changed all that much, it'll continue running as if nothing has happened, just with the older filesystem underneath it. It's very clever.


[Edit:]
Knew I'd get it wrong. 20m, not 30m.
[/Edit:]

Return to “Raspberry Pi OS”