Fix: Slow Start of Midnight Commander (MC) on Linux

PowerADM.com / Linux / Fix: Slow Start of Midnight Commander (MC) on Linux

MC (Midnight Commander) is one of the most commonly used console file managers for Linux. One drawback most Linux users face is that mc sometimes takes a very long time to start.

MC Midnight Commander slow start in Linux

Once you have connected to the host via SSH and run the mc command, there is a 1-3 minute delay before the Midnight Commander opens. This problem is most often related to DNS settings.

Solution 0: check that the DNS servers are configured in the network interface and the servers are reachable.

If your mc starts up slowly, there are other ways to fix it.

Solution 1:

Add the hostname of your server and its local IP to the /etc/hosts file.

Get your computer name with the command:

$ hostname

appsrvub1.local

Add a new entry to the /etc/hosts file:

192.168.22.22 appsub01.local

Or you can use the following command:

$ sudo echo "127.0.0.1 $(hostname).domain $(hostname)" >> /etc/hosts

Solution 2:

You can try disabling the use of name resolution when connecting via SSH. You can do this by adding the following parameter to the sshd configuration file /etc/sshsshd_config:

UseDNS no

Restart sshd:

$sudo systemctl restart sshd || systemctl restart ssh

It may also help to disable the GSSAPIAuthentication option in /etc/ssh/sshd_config:

GSSAPIAuthentication no

Solution 3:

Try to disable the built-in mc subshell:

alias mc="mc --nosubshell"
Midnight Commander opens a separate subshell on startup (you can switch to it by pressing CTRL+O). If you’re using zsh, this subshell may hang. If you don’t need this shell, you can disable it. Add the following to the .zshrc file:

bash
alias mc="mc --nosubshell"

Or change the shell for this user to /bin/bash.

After that, the mc should open up immediately.

If this does not solve the problem, check where the mc hangs:

$ strace -S mc

Analyze a list of the system calls made by the mc and the delays that occur.

2 thoughts on “Fix: Slow Start of Midnight Commander (MC) on Linux”
  1. Trata ejecutando el comando sin x11:
    mc –no-x11
    Si esto solucionó el problema te puedes generar un alias:
    cat .bash_profile

    alias mc=’mc –no-x11′

Leave a Reply

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