0

I have done something strange to my debian server and now I cannot install anything. It says, that locale is broken. I tried to fix it by reconfiguring dpkg, cleaning apt-get and and many other solutions from the internet. When I try to install stuff I get:

Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be REMOVED:
  locales
The following packages will be upgraded:
  xxx yyy
xx upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 27.3 MB of archives.
After this operation, 19.3 MB disk space will be freed.
Do you want to continue? [Y/n]
Fetched 27.3 MB in 19s (1,396 kB/s)
(Reading database ... 45726 files and directories currently installed.)
Removing locales (2.19-18+deb8u2) ...
dpkg: error processing package locales (--remove):
 cannot remove '/usr/share/locale/locale.alias': Input/output error
Errors were encountered while processing:
 locales
E: Sub-process /usr/bin/dpkg returned an error code (1)
apt-get upgrade  10.60s user 2.89s system 40% cpu 32.969 total 

I cannot remove this file due to this aforementioned error.
Trying to fix or redo locale file says, that locales is broken or not fully installed

As suggested in comment:

root@bananapi ~ # dpkg --audit
The following packages are only half installed, due to problems during
installation.  The installation can probably be completed by retrying it;
the packages can be removed using dselect or dpkg --remove:
 locales              GNU C Library: National Language (locale) data [support]

Tried doing it, gives me this error:

1 root@bananapi ~ # apt-get install locales                                                                                                                                                              :(
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be upgraded:
  locales
1 upgraded, 0 newly installed, 0 to remove and 17 not upgraded.
1 not fully installed or removed.
Need to get 3,944 kB of archives.
After this operation, 395 kB of additional disk space will be used.
Get:1 http://security.debian.org/ jessie/updates/main locales all 2.19-18+deb8u3 [3,944 kB]
Fetched 3,944 kB in 1s (3,045 kB/s)
Preconfiguring packages ...
Selecting previously unselected package locales.
(Reading database ... 45727 files and directories currently installed.)
Preparing to unpack .../locales_2.19-18+deb8u3_all.deb ...
Unpacking locales (2.19-18+deb8u3) over (2.19-18+deb8u2) ...
dpkg: error processing archive /var/cache/apt/archives/locales_2.19-18+deb8u3_all.deb (--unpack):
 unable to make backup link of './usr/sbin/update-locale' before installing new version: Too many links
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/locales_2.19-18+deb8u3_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
apt-get install locales  5.53s user 1.97s system 34% cpu 21.697 total
  • Can you include the output from dpkg --audit in your original question – EightBitTony Mar 10 '16 at 22:23
  • And if you try and install locales again? (apt-get install locales - what do you get?) – EightBitTony Mar 10 '16 at 23:21
  • Update in the original post – fulaphex Mar 10 '16 at 23:23
  • 1
    Although to be fair, cannot remove '/usr/share/locale/locale.alias': Input/output error looks like that file has issues and maybe you've got filesystem corruption, can you also include the output of ls -l /usr/share/locale/locale.alias / stat /usr/share/locale/locale.alias / file /usr/share/locale/locale.alias and the same for /etc/locale.alias since I think that's where it should point. – EightBitTony Mar 10 '16 at 23:23
  • All your commands fail due to input/output error – fulaphex Mar 10 '16 at 23:25
2
cannot remove '/usr/share/locale/locale.alias': Input/output error

This is not a problem with the packaging system. The storage is corrupted. Anything that requires accessing the corrupted part of the storage fails. In this case the upgrade requires replacing a file in a corrupted directory so it fails.

Corrupted storage is a bad sign. Replace your disk and check the integrity of your data.

  • I had something similar on a system with a faulty SATA cable. In my case, the kernel managed to remount the filesystem read-only, but it was still unable to do much, and syslog (and dmesg) were full of SATA resets. – Toby Speight Apr 27 '16 at 14:37
1

The solution was to take the card out and fix it with fsck on another computer. Pretty simple, suggested by EightBitTony.

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.