Solutions to various Linux problems

Share this article

I decided to start this article, which I intend to keep adding to over time, because I was unable to find a solution to my problem through searches. I hope this information helps people.

Problem: codepage cp437 not found
Solution: I encountered this error when I was trying to slim down my Debian Stretch installation. Through trial-and-error, I was trying to figure out what all is unnecessary in order to run a small headless/no GUI system. I had deleted directories in the fs/ directory, which corresponded to file system types I didn’t expect to encounter on that system. The important directory was “nls/”. This directory contains code pages with characters that the terminal needs in order to display certain text correctly. I personally don’t care how fancy or bad the fonts look on a console, especially if I plan to run it headless.

On Debian (and I am assuming that other distributions are similar in this regard, insofar as they require the 437 code page), the following file is missing:

/lib/module/<kernel version>/kernel/fs/nls/nls_cp437.ko

To fix it, simply copy the file (or wget it from online storage) from another Linux system into

/lib/module/<kernel version>kernel/fs/nls/

Then load the kernel module into your kernel (you’ll need to have root permission) with the command:

$ sudo insmod nls_cp437.ko

This is identical on Linux Mint, as well, but I haven’t checked other distributions. The exact location and file name might be different for your distribution.

Problem: IO charset ascii not found
Solution: This has a similar solution. The nls_ascii.ko kernel module is missing. Simply copy it to the same directory as the one shown above:

/lib/module/<kernel version>kernel/fs/nls/

Then use the following command as root to insert it into your kernel:

$ sudo insmod nls_ascii.ko

Problem: sudo must be owned by uid 0 and have the setuid bit set
Solution: Reinstalling sudo fixes it.

The message:

user@computer:~$ sudo bash
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set

To fix it, log in as root, or if root logins are disabled, boot up another partition of Linux, or boot from a live Linux CD. Then mount the partition containing the system you want to fix.

user@computer:~$ sudo mount /dev/sda2 /mnt

I arbitrarily chose sda2. Instead of typing sda2, type the partition your messed up system is on. Then you’ll have to change root directories so that you can work on your messed up system with root permissions:

user@computer:~$ sudo chroot /mnt/

Then you’ll need to reinstall sudo.

root@messed-up-computer:~# apt-get update
root@messed-up-computer:~# apt-get install --reinstall sudo
root@messed-up-computer:~# exit

I’ve seen people on stack overflow suggesting a complete reinstall, and other more complicated “solutions”. However, this has always worked for me. The only times this problem has ever occurred for me was when I was customizing my own boot/live Linux CDs. I’m not sure what caused it, but that has always fixed it for me. I can’t guarantee it’ll work in every situation, but at least now you know that the system isn’t totally screwed.


Leave a Reply

Your email address will not be published. Required fields are marked *