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
dpkg --auditin your original questionapt-get install locales- what do you get?)cannot remove '/usr/share/locale/locale.alias': Input/output errorlooks like that file has issues and maybe you've got filesystem corruption, can you also include the output ofls -l /usr/share/locale/locale.alias/stat /usr/share/locale/locale.alias/file /usr/share/locale/locale.aliasand the same for/etc/locale.aliassince I think that's where it should point.