4

The image file I am using is quite old. How old exactly I am not sure, because this image I have inherited from previous developer.

I have learnt that running:

sudo apt-get update
sudo apt-get upgrade

Kills the Raspberry Pi. I checked memory consumption with htop, and at the last moment the system was responding I had 10 megabytes left (including swap). Then everything went readonly, the upgrade crashed, not a single command was working (I typed ls, ls command not found, cat, cat command not found). I had to reboot.

I increased swap size to 512 megabytes, and it seemed it helped a little, but Raspbian crashed on later into the installation.

I would like to hear from you guys:

  • Did you have a similar error?
  • How do I solve it?
  • Is there a way to install only some packages and not all of them in one go?

Typical stdout from apt-get upgrade looks like this:

Unpacking replacement python2.7-minimal ...
Preparing to replace idle-python2.7 2.7.3-6 (using .../idle-python2.7_2.7.3-6+deb7u2_all.deb) ...
Unpacking replacement idle-python2.7 ...
Preparing to replace initramfs-tools 0.109.1 (using .../initramfs-tools_0.115~bpo70+1_all.deb) ...
Unpacking replacement initramfs-tools ...
Preparing to replace libclutter-1.0-common 1.10.8-2 (using .../libclutter-1.0-common_1.10.8-2+rpi1_all.deb) ...
Unpacking replacement libclutter-1.0-common ...
Preparing to replace libcogl-common 1.10.2-7 (using .../libcogl-common_1.10.2-7+rpi1_all.deb) ...
Unpacking replacement libcogl-common ...
Preparing to replace libglib2.0-data 2.33.12+really2.32.4-5 (using .../libglib2.0-data_2.40.0-3rpi3rpi1_all.deb) ...
dpkg: unrecoverable fatal error, aborting:tee: deployment.log: Read-only file system
Etee: deployment.log: Read-only file system: Sub-process /usr/bin/dpkg returned an error code (2)

Some people have requested df -h:

Filesystem      Size  Used Avail Use% Mounted on
rootfs           15G  2.4G   12G  18% /
/dev/root        15G  2.4G   12G  18% /
devtmpfs        212M     0  212M   0% /dev
tmpfs            44M  236K   44M   1% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs            88M     0   88M   0% /run/shm
/dev/mmcblk0p1   56M   19M   38M  33% /boot
  • You are trying to write to a read only filesystem. Please edit your question and include the contents of /etc/fstab. – Steve Robillard Feb 17 '15 at 23:54
  • I thought we should not be using swap raspberrypi.stackexchange.com/questions/70/… or did you mean something else? – rob Feb 18 '15 at 9:01
  • How much disk space have you got left? What is the output of df -h ? – Bex Feb 18 '15 at 9:19
  • 1
    @rob This is I don't know why but shared misconception, raspbery is using dphys-swapfile. – Drachenfels Feb 18 '15 at 10:19
  • 1
    @Bex df -h added to main question. – Drachenfels Feb 18 '15 at 10:49
2

Did you have a similar error?

Yes, if I don't take care to avoid it.

How do I solve it?

  1. Use top to make sure you have stopped all CPU or RAM consuming services. For example,

    /etc/init.d/lighttpd stop
    
  2. Prefix your upgrade command with nice.

  3. Sometimes upgrading breaks, or the img breaks, and you just need to re-install, so keep an install log and backup files you created.

Is there a way to install only some packages and not all of them in one go?

Yes,

sudo nice apt-get install PACKAGE-TO-BE-UPGRADED
1

As far as I can tell there is no easy solution. If the Pi wasn't upgraded regularly there is a great deal of chance that running generic sudo apt-get upgrade will kill it. Adding nice or releasing as much memory as possible helps mitigate but not really solves the problem. I tried to create a bash script that first reads packages that require update, and then upgrade them one at a time as a subprocess. On paper I understood it will solve it, in practice, not really (however it might be that bash script worked differently than I thought), for a reference below:

DATA=$(apt-get upgrade -s -y -q | grep "Inst " | cut -d ' ' -f 2)

PACKAGES=(${DATA// / })
Z=0

for package in "${PACKAGES[@]}";
do
    echo ""
    echo ""
    echo "apt-get install -y -q $package"
    bash -c "nice apt-get install -y -q $package"
    bash -c "nice apt-get clean -y -q"

    Z=$((Z+1))

    # update only first 50 packages, just to be sure that we won't kill pi by running this script
    if [[ $Z -eq 50 ]];
    then
        break
    fi
done
0

Check your SD card against this list. I bought two of the same cards at the same time and had the same issue, only to find my make and model were listed as Not OK on this list.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.