After downgrading my Ubuntu from 18.10 to 18.04 when ever trying to login I am getting the following error:
And opening the terminal following error displays
bash: /usr/bin/locale-check: No such file or directory
How can I fix this error?
After downgrading my Ubuntu from 18.10 to 18.04 when ever trying to login I am getting the following error:
And opening the terminal following error displays
bash: /usr/bin/locale-check: No such file or directory
How can I fix this error?
I had this same issue after downgrading 18.10 to 18.04
-bash: /usr/bin/locale-check: No such file or directory
In downgrading I had to create this file:
/etc/apt/preferences.d/preferences
to force it to downgrade, which was preventing some packages from being downloaded
after removing it and updating/upgrading:
Note: you may have created a different preferences file so your file below might be named differently
sudo rm /etc/apt/preferences.d/preferences
sudo apt update && sudo apt upgrade
That fixed it for me! :)
The problem is that the base-files
package starting with version 10.1ubuntu2.6
(bionic-updates
pocket) or newer (cosmic
and later releases) contains some additional files, compared to the bionic
release version and older:
/etc/profile.d/01-locale-fix.sh
/usr/bin/locale-check
Files in /etc
are config files though, which will not normally get removed along with the package, unless you apt purge
it. Especially during a downgrade, which isn't officially supported anyway, removing such files will not be taken care of.
That is why, after downgrading from a newer version to the one 18.04 initially ships with, you get the "File not found" error - the shell initialization script in /etc
got left behind as residual config, while the required executable got removed properly according to the requested downgrade. This is also explained in the reply to @roganartu's rejected bug report.
The recommended solution is to fix your software repositories configuration and enable getting packages from the bionic-updates
pocket again, then upgrading base-files
to that version. /usr/bin/locale-check
should be back again.
Alternatively, if you insist on staying with the release pocket and not enabling updates, you will either have to manually delete /etc/profile.d/01-locale-fix.sh
, or you might possibly try forcefully purging and reinstalling base-files
.
Yeah it is caused by the package "base-flies", and I re-installed it by down-grade then upgrade. This is what I have done:
$ sudo apt-cache madison base-files
Then we can get the accurate version of the package:
base-files | 10.1ubuntu2.7 | https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates/main amd64 Packages
base-files | 10.1ubuntu2.7 | http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
base-files | 10.1ubuntu2.2 | https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-security/main amd64 Packages
base-files | 10.1ubuntu2.2 | http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages
base-files | 10.1ubuntu2 | https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic/main amd64 Packages
base-files | 10.1ubuntu2 | http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages
Then choose a version to downgrade:
$ sudo apt install base-files=10.1ubuntu2.7
The last step is to upgrade:
$ sudo apt upgrade base-files
I had this same problem after downgrading from 19.04 to 18.04, which involved doing a bunch of package purging, manual dependency conflict resolution, and some temporary version pinning that prevented me from getting packages from bionic-updates
.
The reason that (re)installing the base-files
package doesn't work seems to be that /usr/bin/locale-check
isn't actually present in the LTS packages, though it should be:
tl@hotbox:~$ apt-cache policy base-files
base-files:
Installed: 10.1ubuntu2
Candidate: 10.1ubuntu2
Version table:
10.1ubuntu2.5 500
500 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
10.1ubuntu2.2 500
500 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages
*** 10.1ubuntu2 1001
1001 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
100 /var/lib/dpkg/status
tl@hotbox:~$ apt download base-files=10.1ubuntu2
Get:1 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 base-files amd64 10.1ubuntu2 [58.2 kB]
Fetched 58.2 kB in 0s (1,000 kB/s)
tl@hotbox:~$ apt download base-files=10.1ubuntu2.2
Get:1 http://security.ubuntu.com/ubuntu bionic-security/main amd64 base-files amd64 10.1ubuntu2.2 [58.2 kB]
Fetched 58.2 kB in 0s (189 kB/s)
tl@hotbox:~$ apt download base-files=10.1ubuntu2.5
Get:1 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 base-files amd64 10.1ubuntu2.5 [60.2 kB]
Fetched 60.2 kB in 0s (975 kB/s)
tl@hotbox:~$ dpkg -c base-files_10.1ubuntu2_amd64.deb | rg "/usr/bin"
drwxr-xr-x root/root 0 2018-04-24 04:34 ./usr/bin/
tl@hotbox:~$ dpkg -c base-files_10.1ubuntu2.2_amd64.deb | rg "/usr/bin"
drwxr-xr-x root/root 0 2018-08-20 09:44 ./usr/bin/
tl@hotbox:~$ dpkg -c base-files_10.1ubuntu2.5_amd64.deb | rg "/usr/bin"
drwxr-xr-x root/root 0 2019-07-08 14:43 ./usr/bin/
-rwxr-xr-x root/root 10240 2019-07-08 14:43 ./usr/bin/locale-check
You can therefore fix by either forcibly installing 10.1ubuntu2.5
, or manually extracting the locale-check
binary from the package.
$ sudo apt install base-files=10.1ubuntu2.5
...
$ ls /usr/bin/locale-check
/usr/bin/locale-check
Later updates will revert this unless you pin the version, however if this is happening you should probably figure out why you aren't getting your version from bionic-updates
.
I raised a launchpad bug for this: https://bugs.launchpad.net/ubuntu/+source/base-files/+bug/1837300
It should be fixed by reinstalling the package base-files, which can be done via:
sudo apt install base-files
Unfortunately, that didn't work, so I simply also copied it from another Ubuntu 18.04 system onto this one.