Apt-get upgrade ruins system


I just got myself an RPI3 upgrading fro the 1 and when doing “sudo apt-get upgrade” It first takes a while and then it does this:
“E: Sub-process /usr/bin/dpkg exited unexpectedly”
And after that the entire linux system is basically ruined:

  • Sudo is no longer a thing (-bash: /usr/bin/sudo: No such file or directory)
  • nano is no longer a thing (-bash: nano: command not found)
  • VI is no longer a thing (-bash: vi: command not found)
  • cat is no longer a thing (-bash: cat: command not found)
  • power off is no longer a thing (-bash: poweroff: command not found)

I can reflash the OS but upgrade does the same over and over again.

First sudo apt-get upgrade is not the right command you should do sudo apt-get dist-upgrade
Secondly if your sytem fails during an upgrade the likely cause is a faulty SD card or a bad power supply.
Suggest you do a clean install and then do grab-logs -A before you do the upgrade and then also while you do the upgrade open a second ssh window and do grab-logs -A from time to time.
Afterwards put all the URL’s you received into a post.

You should never run apt-get upgrade. It’s not the correct way to keep a Debian or Ubuntu system up to date.

Had something similar a few weeks ago having Raspbian installed on a RPi2 using a 64GB msdcard: all of a sudden after running apt-get upgate && …upgrade most of the systems functions were gone.

Didn’t investigate much then as I recalled that the RPi1/2/3 are only meant to be used with 32GB cards, and there is no guarantee that a 64GB card may sooner or later not start to literally overwrite itself (or so I heard - there was a case a few years ago about USB sticks that were sold with faked sizes, and those overwrote themselves after exceeding their real space, rendering most of the data stored unusable).

Since the above happend to my RPi2 and its 64GB card after running for 3 weeks and I now have it running for 4 weeks on a smaller card, I could imagine that this was the culprit (in my case).

You can use h2testw to test if an SD card or USB drive has a genuine advertised capacity.

https://osmc.tv/wiki/general/keeping-your-osmc-system-> up-to-date/

Updating from the command line

OSMC uses the APT packaging system. As such, OSMC can be fully upgraded via the command line by running the following two commands:

sudo apt-get update
sudo apt-get dist-upgrade

dist-upgrade didn’t help, my entire filesystem is now read-only.
This is the clean install log:
This is the mid proces log:

can’t make a new log cuz then I’d have to write to /var/tmp/
Also, sudo reboot has no impact, just gives a broadcast

sudo reboot gives this before the broadcast:
Failed to start reboot.target: Verbinding is verlopen

The stuff behind the semicolon is dutch for connection has timed out

Poor power supply or SD card which is potentially incompatible with sdhost.

Re-install and set dtoverlay=mmc in config.txt before first boot after install completes.

Ok, none of the two files showed any errors so it is really hard to goes what goes wrong. My suggestion:

  1. Try a different SD Card (which brand is your current card?)
  2. Try a different power supply/cable (have you ever seen the rainbow color square in top right corner?

Its the official power supply (new out of box) and a kingston SDCA10/16GB

I have not seen a rainbow square, and at the moment I don’t have another micro SD at hand

That’s the problem.

This SD card seems to be incompatible with the SDHost driver.

Is there a list of recommended cards or somethings, I’m not buying the wrong one twice

SanDisk, Samsung or OSMC are good picks.

You can still use that Kingston SD card, just drop use the mmc overlay. But this will stop you from being able to use WiFi.

bought a sandisk, solved the problem.
Thanks a lot!

I noticed this, on recent update:

dpkg -S bin/apt-get

diversion by base-files-osmc from: /usr/bin/apt-get
diversion by base-files-osmc to: /usr/bin/apt-get-real
diversion by base-files-osmc from: /usr/bin/apt-get
diversion by base-files-osmc to: /usr/bin/apt-get-real
base-files-osmc, apt: /usr/bin/apt-get

and the refusal to run `apt-get upgrade’:

Running apt-get upgrade on your system can cause adverse effects on your system
Use apt-get dist-upgrade, which is the proper way to administer a Debian / Ubuntu system

apt-get' is a debian tool. Is upstream debian aware of these "adverse effects" using the "upgrade" command may have? Are any bugs reported against package apt’ documenting the mentioned “adverse effects”?
And why are you suggesting `apt-get dist-upgrade’ would be “the proper way”? AFAIK, things lay the other way around.


Our advice comes from Debian themselves. This has been covered in detail on the forum. apt-get upgrade does not handle new dependencies correctly when introduced to existing packages on the target. This can lead to breakage, but as Debian upstream moves slowly, you usually get away with it. OSMC moves faster, and dependencies can be introduced via our virtual packages (i.e for hardware enablement when Pi 3 was introduced)

You can still upgrade with apt-get nowarnupgrade. We will be able to provide no support for this and you will potentially ruin your system. Do so at your own risk.

It is not a bug, it is by design.


Huh? I can’t see anything there mentioning “adverse effects” about using “upgrade” nor proclaiming “dist-upgrade” to be “the proper way to administer a Debian / Ubuntu system”. In my experience (15+ years) of using the debian distribution, ​showed use of ​"dist-upgrade" ​to be trickier than “upgrade”.

Filing bugs on package apt at submit@bugs.debian.org about problems with using “apt-get upgrade” would be a better approach to get misbehaviour fixed.

–​ ​

apt-get, the APT-based command-line tool for handling packages, provides a simple, safe way to install and upgrade packages.

To use apt-get, edit the /etc/apt/sources.list file to set it up, just as for aptitude, Section 9.1.1.

Then run

     apt-get update
followed by

     apt-get dist-upgrade

Seems pretty straight forward to me… I would take that to mean that straying from the use of these explicit commands could possibly be something other than “safe”.

Irregardless, we make a very explicit statement regarding apt-get upgrade in our wiki. Keeping your OSMC system up to date - General - OSMC

I’d suggest you read around this more. It has been covered in the forum.

apt-get upgrade will only update packages that do not interfere with the installed state of another package. That means that if a package introduces a new package (new dependency) it will not be upgraded. OSMC sometimes introduces new dependencies.

Debian does this too however, as does Ubuntu. For example, linux-image-generic is a metapackage and its dependency changes when the kernel is updated.

To reiterate, this is not a bug in APT, it is by design. Upgrade was for seasoned sysadmins rolling their own kernel and not wanting to introduce new packages. There is a reason that apt-get dist-upgrade is the same as apt-get full-upgrade.

It has been recommended since 2009 to use dist-upgrade, by running apt-get upgrade you are in contravention of Debian administration policy.

If you are sure you know what you’re doing, override it with the above suggestion.

OSMC is a recognised Debian derivative and fully complies with upstream policy. I’ll mention at the next DebConf that this needs to be clarified.