vannimb
Posts: 29
Joined: Thu Mar 27, 2014 12:59 pm

apt-get broken? Help!

Sat May 14, 2016 2:50 pm

Hi all,
i think i screwed up apt-get.
everytime i try to run some upgrades with:
sudo apt-get update
sudo apt-get upgrade
or
sudo apt-get dist-upgrade
the system hangs and sometimes is not even able to boot anymore (i have to reimage from the last backup).

Here the logs of last operation:

Code: Select all

pi@RASPBERRY-B1 ~ $ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
pi@RASPBERRY-B1 ~ $ sudo apt-get dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
  apt apt-utils base-files base-passwd bash bash-completion bsdmainutils bsdutils ca-certificates coreutils dash
  debconf debconf-i18n debianutils diffutils dpkg e2fslibs e2fsprogs findutils gcc-4.8-base gnupg gnupg-curl gpgv grep
  gzip hostname initscripts insserv krb5-locales libacl1 libapt-inst1.5 libapt-pkg4.12 libattr1 libblkid1 libbz2-1.0
  libc-bin libc6 libcomerr2 libcurl3-gnutls libdb5.1 libgcc1 libgcrypt11 libgnutls26 libgpg-error0 libgpm2
  libgssapi-krb5-2 libidn11 libk5crypto3 libkeyutils1 libkrb5-3 libkrb5support0 libldap-2.4-2 liblocale-gettext-perl
  liblzma5 libmount1 libncurses5 libp11-kit0 libpam-modules libpam-modules-bin libpam-runtime libpam0g libpng12-0
  libreadline6 librtmp0 libsasl2-2 libsasl2-modules libselinux1 libsemanage-common libsemanage1 libsepol1 libslang2
  libss2 libssh2-1 libssl1.0.0 libstdc++6 libtasn1-3 libtext-charwidth-perl libtext-iconv-perl libtext-wrapi18n-perl
  libtinfo5 libusb-0.1-4 libustr-1.0-1 libuuid1 login lsb-base mount multiarch-support ncurses-base ncurses-bin openssl
  original-awk passwd perl-base psmisc raspbian-archive-keyring readline-common sed sensible-utils sysv-rc sysvinit
  sysvinit-utils tar tzdata util-linux uuid-runtime zlib1g
0 upgraded, 106 newly installed, 0 to remove and 0 not upgraded.
Need to get 41.6 MB of archives.
After this operation, 102 MB of additional disk space will be used.
Do you want to continue [Y/n]?
i said yes and after the download i get these errors:

Code: Select all

Get:106 http://mirrordirector.raspbian.org/raspbian/ wheezy/main uuid-runtime armhf 2.20.1-5.3 [60.1 kB]
Fetched 41.6 MB in 31s (1,308 kB/s)
E: Cannot get debconf version. Is debconf installed?
debconf: apt-extracttemplates failed: No such file or directory
Extracting templates from packages: 28%E: Cannot get debconf version. Is debconf installed?
debconf: apt-extracttemplates failed: No such file or directory
Extracting templates from packages: 56%E: Cannot get debconf version. Is debconf installed?
debconf: apt-extracttemplates failed: No such file or directory
Extracting templates from packages: 84%E: Cannot get debconf version. Is debconf installed?
debconf: apt-extracttemplates failed: No such file or directory
Extracting templates from packages: 100%
Selecting previously unselected package libc-bin.
(Reading database ... 59 files and directories currently installed.)
Unpacking libc-bin (from .../libc-bin_2.13-38+rpi2+deb7u10_armhf.deb) ...
Setting up libc-bin (2.13-38+rpi2+deb7u10) ...
Selecting previously unselected package gcc-4.8-base:armhf.
(Reading database ... 130 files and directories currently installed.)
Unpacking gcc-4.8-base:armhf (from .../gcc-4.8-base_4.8.2-21~rpi3rpi1_armhf.deb) ...
Setting up gcc-4.8-base:armhf (4.8.2-21~rpi3rpi1) ...
Selecting previously unselected package multiarch-support.
(Reading database ... 139 files and directories currently installed.)
Unpacking multiarch-support (from .../multiarch-support_2.13-38+rpi2+deb7u10_armhf.deb) ...
Selecting previously unselected package libc6:armhf.
Unpacking libc6:armhf (from .../libc6_2.13-38+rpi2+deb7u10_armhf.deb) ...
Selecting previously unselected package libgcc1:armhf.
dpkg: regarding .../libgcc1_1%3a4.8.2-21~rpi3rpi1_armhf.deb containing libgcc1:armhf, pre-dependency problem:
 libgcc1 pre-depends on multiarch-support
  multiarch-support is unpacked, but has never been configured.

dpkg: error processing /var/cache/apt/archives/libgcc1_1%3a4.8.2-21~rpi3rpi1_armhf.deb (--unpack):
 pre-dependency problem - not installing libgcc1:armhf
Errors were encountered while processing:
 /var/cache/apt/archives/libgcc1_1%3a4.8.2-21~rpi3rpi1_armhf.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
then i remove the file at /var/cache/apt/archives/libgcc1_1%3a4.8.2-21~rpi3rpi1_armhf.deb
and try the upgrade again, here the result:

Code: Select all

pi@RASPBERRY-B1 ~ $ sudo rm  /var/cache/apt/archives/libgcc1_1%3a4.8.2-21~rpi3rpi1_armhf.deb
pi@RASPBERRY-B1 ~ $ sudo apt-get dist-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:
 libc6 : Depends: libgcc1 but it is not installed
E: Unmet dependencies. Try using -f.
when i run sudo apt-get -f install here the result:

Code: Select all

pi@RASPBERRY-B1 ~ $ sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
  libgcc1
The following NEW packages will be installed:
  libgcc1
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
Need to get 54.2 kB of archives.
After this operation, 210 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://archive.raspberrypi.org/debian/ wheezy/main libgcc1 armhf 1:4.8.2-21~rpi3rpi1 [54.2 kB]
Fetched 54.2 kB in 0s (274 kB/s)
E: Cannot get debconf version. Is debconf installed?
debconf: apt-extracttemplates failed: No such file or directory
dpkg: regarding .../libgcc1_1%3a4.8.2-21~rpi3rpi1_armhf.deb containing libgcc1:armhf, pre-dependency problem:
 libgcc1 pre-depends on multiarch-support
  multiarch-support is unpacked, but has never been configured.

dpkg: error processing /var/cache/apt/archives/libgcc1_1%3a4.8.2-21~rpi3rpi1_armhf.deb (--unpack):
 pre-dependency problem - not installing libgcc1:armhf
Errors were encountered while processing:
 /var/cache/apt/archives/libgcc1_1%3a4.8.2-21~rpi3rpi1_armhf.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
then i try to configure multiarch-support with sudo dpkg --configure multiarch-support
here the output:

Code: Select all

pi@RASPBERRY-B1 ~ $ sudo dpkg --configure multiarch-support
dpkg: dependency problems prevent configuration of multiarch-support:
 multiarch-support depends on libc6 (>= 2.13-5); however:
  Package libc6:armhf is not configured yet.

dpkg: error processing multiarch-support (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 multiarch-support
and the story goes on for various packages missing....
How can i restore apt-get to upgrade the system?

Many thanks for your cooperation.
best regards

DirkS
Posts: 10422
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: apt-get broken? Help!

Sat May 14, 2016 3:16 pm

I would say the contents of the card is corrupted.
Have you checked the free space with 'df -h'?

vannimb
Posts: 29
Joined: Thu Mar 27, 2014 12:59 pm

Re: apt-get broken? Help!

Sat May 14, 2016 3:21 pm

Hello DirkS,
here the output of df -h

Code: Select all

pi@RASPBERRY-B1 ~ $ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        29G  3.6G   24G  14% /
devtmpfs        237M     0  237M   0% /dev
tmpfs            49M  216K   49M   1% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs            97M  4.0K   97M   1% /run/shm
/dev/mmcblk0p1   56M   21M   36M  38% /boot
none            242M     0  242M   0% /sys/fs/cgroup

klricks
Posts: 7240
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: apt-get broken? Help!

Sat May 14, 2016 3:26 pm

If you installed the standalone image (not NOOBS) then you must expand the filesystem to fill the card and reboot before attempting to do any updates or installations.
Note that the latest release of Raspbian will automatically expand on first boot.
Unless specified otherwise my response is based on the latest and fully updated RPiOS Buster w/ Desktop OS.

DirkS
Posts: 10422
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: apt-get broken? Help!

Sat May 14, 2016 3:27 pm

Free space should be OK.
I suggest you get all the files you value from that card and start with a fresh install

Since you still seem to be using wheezy it is also a good opportunity to upgrade to Jessie.
Get the latest image from the RPF downloads page.

vannimb
Posts: 29
Joined: Thu Mar 27, 2014 12:59 pm

Re: apt-get broken? Help!

Sat May 14, 2016 3:32 pm

Hi all,
I expanded the filesystem using the raspi-config but still the result is the same:

Code: Select all

pi@RASPBERRY-B1 ~ $ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        29G  3.6G   24G  14% /
devtmpfs        237M     0  237M   0% /dev
tmpfs            49M  216K   49M   1% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs            97M     0   97M   0% /run/shm
/dev/mmcblk0p1   56M   21M   36M  38% /boot
none            242M     0  242M   0% /sys/fs/cgroup

Code: Select all

pi@RASPBERRY-B1 ~ $ uname -a
Linux RASPBERRY-B1 4.4.10+ #885 Fri May 13 15:30:07 BST 2016 armv6l GNU/Linux
upgrading witha fresh image is an option i do not relaly like bacuse i coded a bit and modified several files... i would prefer to upgrade if possible.

How could i do that without a fresh install?

Best regards

DirkS
Posts: 10422
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: apt-get broken? Help!

Sat May 14, 2016 3:53 pm

Can you post the output of

Code: Select all

cat /etc/os-release

vannimb
Posts: 29
Joined: Thu Mar 27, 2014 12:59 pm

Re: apt-get broken? Help!

Sun May 29, 2016 9:19 am

Dear DirkS,
sorry for the late reply!
The output is:

Code: Select all

PRETTY_NAME="Raspbian GNU/Linux 7 (wheezy)"
NAME="Raspbian GNU/Linux"
VERSION_ID="7"
VERSION="7 (wheezy)"
ID=raspbian
ID_LIKE=debian
ANSI_COLOR="1;31"
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
is it normal to have a line like the last one as output of df -h?

Code: Select all

pi@RASPBERRY-B1 / $ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        29G  3.6G   24G  14% /
devtmpfs        237M     0  237M   0% /dev
tmpfs            49M  216K   49M   1% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs            97M  4.0K   97M   1% /run/shm
/dev/mmcblk0p1   56M   21M   36M  38% /boot
none            242M     0  242M   0% /sys/fs/cgroup
i compared to another raspberry unit i have and that line is not prsent.....
many thanks for your help!
Best regards

fransko
Posts: 19
Joined: Sat Jan 05, 2013 11:23 pm

Re: apt-get broken? Help!

Sun May 29, 2016 9:22 am

try to use a new s-d card

vannimb
Posts: 29
Joined: Thu Mar 27, 2014 12:59 pm

Re: apt-get broken? Help!

Sun May 29, 2016 9:32 am

Hello Fransko,
do you suggest a new sd with a frsh install or with an image of the current one?
i am not an expert but in case i have to use a new SD with anew image how can i transfer all my files system files i modified?
Many thanks

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

Re: apt-get broken? Help!

Sun May 29, 2016 9:57 am

What model of RPi?
What's your GPU memory setting?
How much RAM is committed to running tasks?

If you push the system into swapping it will appear to hang. The only way to avoid that is to ensure that there's enough free RAM to run the apt-get processes. You can save a lot by dropping the GPU share to 16 and running from the command line (so all that memory hungry GUI stuff doesn't run). Do that as a temporary update until you've got everything installed, then reset things back to normal with the GUI and your current GPU memory split.
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 fake doctors are on my foes list.

DirkS
Posts: 10422
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: apt-get broken? Help!

Sun May 29, 2016 10:08 am

I would use a new card with a fresh install using the latest Raspbian image.
Use a USB SD card reader on your Pi to get your files off the old card.

vannimb
Posts: 29
Joined: Thu Mar 27, 2014 12:59 pm

Re: apt-get broken? Help!

Sun May 29, 2016 3:13 pm

DougieLawson wrote:What model of RPi?
What's your GPU memory setting?
How much RAM is committed to running tasks?

If you push the system into swapping it will appear to hang. The only way to avoid that is to ensure that there's enough free RAM to run the apt-get processes. You can save a lot by dropping the GPU share to 16 and running from the command line (so all that memory hungry GUI stuff doesn't run). Do that as a temporary update until you've got everything installed, then reset things back to normal with the GUI and your current GPU memory split.
Hello DougieLawson,
the Pi is a B+

here the available memory:

Code: Select all

pi@RASPBERRY-B1 / $ free -m
             total       used       free     shared    buffers     cached
Mem:           482        114        368          0         23         60
-/+ buffers/cache:         30        451
Swap:           99          0         99
the amount of memory is 16 for the viseo card and the gui never starts at boot.

Best regards

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

Re: apt-get broken? Help!

Sun May 29, 2016 3:44 pm

In that case starting with a fresh SDCard and a USB reader is your best option.

Build a new system, get it updated, mount the broken system in the reader, mount that filesystem and retrieve your valuable data.
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 fake doctors are on my foes list.

Return to “Troubleshooting”