Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Is there any way to prevent mc from taking 10-30 seconds to open? Never seen this with Debian.

share|improve this question
1  
Did you compile it with --enable-vfs-smb? Try disabling the feature. Seems to be a common problem with version 4.8.4: mc starting up very SLOW –  Marco Dec 3 '12 at 12:25
2  
Run strace -r -tt -o mc.strace mc to see where it's taking time. Upload the trace file if you need help interpreting it. Note that the trace file may contain private information (at least file names), take a look at it and sanitize it if necessary before uploading. –  Gilles Dec 3 '12 at 21:38

4 Answers 4

Try to delete line "search whatever.something" from /etc/resolv.conf

/etc/hosts should have the lines:

127.0.0.1 localhost

127.0.0.2 hostname.domain hostname

"hostname" is your hostname and "domain" is your domain.

share|improve this answer
    
That makes some sense only if the machine is never connected to the 'net. That file is filled in by DHCP (or when the Internet connection is configured). –  vonbrand Jan 26 '13 at 3:38

Check

host 'hostname'

get quick result MC use hostname at first to connect to internal service

In similar situation on Fedora 18 I add hostname to /etc/hosts and it help.

share|improve this answer
    
mc internal service? may be we could change some configuration to fix mc to not require changing /etc/hosts? or is the /etc/hosts broken and mc expects it to be corrected? –  Aquarius Power Jan 22 at 21:20
    
oh, I just found that this works here: alias mc='TERM=linux mc' –  Aquarius Power Jan 22 at 21:29
    
Really /etc/hosts is broken, from some point of view. Impossible to resolve own hostname to own ip. I don't know why mc depend on it there. –  mmv-ru Jan 22 at 22:32

Actually editing /etc/hosts solved the problem for me.
My mc took 10 seconds to start due to the fact that during startup mc tries to resolve the local hostname to an IP address.
I added to /etc/hosts the following line (my hostname is FOO) 127.0.0.2 FOO.domain FOO That instantly solved the problem.

share|improve this answer

It took about 10 seconds to start mc. Running strace -r -tt -o mc.strace mc I got:

...
 0.000023 pipe([7, 8])              = 0
 0.000028 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fcad000fa50) = 3332
 0.000247 write(5, " PROMPT_COMMAND=${PROMPT_COMMAND"..., 75) = 75
 0.000050 rt_sigaction(SIGINT, {0x449960, [], SA_RESTORER, 0x7fcaced23740}, NULL, 8) = 0
 0.000034 select(8, [5 7], NULL, NULL, {10, 0}) = 1 (in [5], left {9, 999996})
 0.000039 read(5, " PROMPT_COMMAND=${PROMPT_COMMAND"..., 128) = 76
 0.000032 select(8, [5 7], NULL, NULL, {9, 999996}) = 1 (in [5], left {9, 985005})
 0.015050 read(5, "[yuri@yuri ~]  PROM", 128) = 19
 0.000031 select(8, [5 7], NULL, NULL, {9, 985005}) = 1 (in [5], left {9, 985001})
 0.000036 read(5, "PT_COM", 128)    = 6
 0.000026 select(8, [5 7], NULL, NULL, {9, 985001}) = 1 (in [5], left {9, 984998})
 0.000033 read(5, "MAND=", 128)     = 5
 0.000026 select(8, [5 7], NULL, NULL, {9, 984998}) = 1 (in [5], left {9, 984995})
 0.000033 read(5, "${PR", 128)      = 4
 0.000025 select(8, [5 7], NULL, NULL, {9, 984995}) = 1 (in [5], left {9, 984992})
 0.000034 read(5, "OMPT", 128)      = 4
 0.000025 select(8, [5 7], NULL, NULL, {9, 984992}) = 1 (in [5], left {9, 984989})
 0.000034 read(5, "_COM", 128)      = 4
 0.000026 select(8, [5 7], NULL, NULL, {9, 984989}) = 1 (in [5], left {9, 984986})
 0.000034 read(5, "MAND", 128)      = 4
 0.000025 select(8, [5 7], NULL, NULL, {9, 984986}) = 1 (in [5], left {9, 984983})
 0.000033 read(5, ":+$", 128)       = 3
 0.000025 select(8, [5 7], NULL, NULL, {9, 984983}) = 1 (in [5], left {9, 984980})
 0.000033 read(5, "PRO", 128)       = 3
 0.000025 select(8, [5 7], NULL, NULL, {9, 984980}) = 1 (in [5], left {9, 984977})
 0.000033 read(5, "MPT", 128)       = 3
 0.000025 select(8, [5 7], NULL, NULL, {9, 984977}) = 1 (in [5], left {9, 984974})
 0.000033 read(5, "_CO", 128)       = 3
 0.000025 select(8, [5 7], NULL, NULL, {9, 984974}) = 1 (in [5], left {9, 984971})
 0.000033 read(5, "MMA", 128)       = 3
 0.000026 select(8, [5 7], NULL, NULL, {9, 984971}) = 1 (in [5], left {9, 984968})
 0.000032 read(5, "ND;", 128)       = 3
 0.000025 select(8, [5 7], NULL, NULL, {9, 984968}) = 1 (in [5], left {9, 984965})
 0.000033 read(5, " }", 128)        = 2
 0.000026 select(8, [5 7], NULL, NULL, {9, 984965}) = 1 (in [5], left {9, 984962})
 0.000033 read(5, "'pw", 128)       = 3
 0.000025 select(8, [5 7], NULL, NULL, {9, 984962}) = 1 (in [5], left {9, 984959})
 0.000033 read(5, "d>", 128)        = 2
 0.000026 select(8, [5 7], NULL, NULL, {9, 984959}) = 1 (in [5], left {9, 984956})
 0.000032 read(5, "&8;", 128)       = 3
 0.000026 select(8, [5 7], NULL, NULL, {9, 984956}) = 1 (in [5], left {9, 984953})
 0.000032 read(5, "ki", 128)        = 2
 0.000025 select(8, [5 7], NULL, NULL, {9, 984953}) = 1 (in [5], left {9, 984950})
 0.000033 read(5, "ll ", 128)       = 3
 0.000026 select(8, [5 7], NULL, NULL, {9, 984950}) = 1 (in [5], left {9, 984947})
 0.000032 read(5, "-S", 128)        = 2
 0.000025 select(8, [5 7], NULL, NULL, {9, 984947}) = 1 (in [5], left {9, 984944})
 0.000033 read(5, "TO", 128)        = 2
 0.000025 select(8, [5 7], NULL, NULL, {9, 984944}) = 1 (in [5], left {9, 984941})
 0.000033 read(5, "P ", 128)        = 2
 0.000025 select(8, [5 7], NULL, NULL, {9, 984941}) = 1 (in [5], left {9, 984938})
 0.000033 read(5, "$$", 128)        = 2
 0.000033 select(8, [5 7], NULL, NULL, {9, 984938}) = 1 (in [5], left {9, 984935})
 0.000034 read(5, "'\r\n", 128)     = 3
 0.000025 select(8, [5 7], NULL, NULL, {9, 984935}) = 1 (in [5], left {9, 984886})
 0.000082 read(5, "bash: PROMPT_COMMAND: line 1: sy"..., 128) = 128
 0.000033 select(8, [5 7], NULL, NULL, {9, 984886}) = 1 (in [5], left {9, 984882})
 0.000071 read(5, "tory -r; ; pwd>&8;kill -STOP $$'"..., 128) = 48
 0.000061 select(8, [5 7], NULL, NULL, {9, 984882}) = 0 (Timeout)
 9.995037 rt_sigaction(SIGINT, {SIG_IGN, [], SA_RESTORER, 0x7fcaced23740}, NULL, 8) = 0
 0.000090 write(1, "\33[?1001s\33[?1002h\33[?1006h", 24) = 24
 0.000066 write(1, "\33[?2004h", 8) = 8
 0.000034 geteuid()                 = 1000
 0.000064 access("/home/yuri/.config/mc/filehighlight.ini", R_OK) = -1 ENOENT (No such file or directory)
 0.000061 access("/etc/mc/filehighlight.ini", R_OK) = 0
 0.000042 access("/etc/mc/filehighlight.ini", R_OK) = 0
 0.000044 stat("/etc/mc/filehighlight.ini", {st_mode=S_IFREG|0644, st_size=1119, ...}) = 0
 0.000035 open("/etc/mc/filehighlight.ini", O_RDONLY) = 9
...

Looking at this output, I decided to start mc with empty PROMPT_COMMAND (PROMPT_COMMAND= mc), and it started instantly. I had there supposedly common:

history -a; history -c; history -r;
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.