Community Packages

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#37378 - [mc] slow to start

Attached to Project: Community Packages
Opened by Xavier de Gaye (xdegaye) - Thursday, 17 October 2013, 20:35 GMT
Last edited by Jakob Gruber (schuay) - Monday, 18 November 2013, 17:51 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Jakob Gruber (schuay)
Architecture i686
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
Midnight Commander takes 20 seconds to start. mc is run after a fresh
standard arch install on a VmWare VM. Running strace shows many
timeouts on poll syscalls after a dns datagram is being sent. The same
problem arises when running the following statements in python:

>>> from socket import getfqdn
>>> getfqdn()

'loth' is the hostname configured on this host.
mc starts immediately (and the call to python getfqdn() returns
immediately) after adding the following line to /etc/hosts:

127.0.1.1 loth


See also the following bug report on F18 that seems closely related:
https://bugzilla.redhat.com/show_bug.cgi?id=912530


The arch wiki in the Beginners'_Guide and the Network_Configuration
pages states "You no longer need to edit /etc/hosts" but
Debian install process currently still adds the
"127.0.1.1 <host_name>" line to /etc/hosts, see:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=719621

Additional info:
* package version(s) Midnight Commander 4.8.10-2


Steps to reproduce:
* do a standard installation of arch on a host that gets its ip
address through dhcp
* install mc and python
* start mc or run the above python statements

This task depends upon

Closed by  Jakob Gruber (schuay)
Monday, 18 November 2013, 17:51 GMT
Reason for closing:  Upstream
Comment by Dave Reisner (falconindy) - Friday, 18 October 2013, 14:37 GMT
I can't reproduce this on i686 or x86_64.

# mv /etc/hosts /etc/hosts.bak
# time python -c 'import socket; print(socket.getfqdn())'
rampage

real 0m0.036s
user 0m0.031s
sys 0m0.004s

The beginner's guide correctly points out that the hostname mapping for localhost isn't needed because we use nssmyhostname. We had a report similar to this ( FS#34854 ) but this was fixed upstream in systemd.
Comment by Xavier de Gaye (xdegaye) - Friday, 18 October 2013, 18:52 GMT
The 'hosts' line in /etc/nsswitch.conf on this host is the same as the one in
the example given in the man page of nss-myhostname, but getent does not give
the expected result when /etc/hosts has been removed (and the command is also
slow):

[xavier@loth ~]$ ip add
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:01:b4:8e brd ff:ff:ff:ff:ff:ff
inet 172.16.157.131/24 brd 172.16.157.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fe01:b48e/64 scope link
valid_lft forever preferred_lft forever
[xavier@loth ~]$ time getent ahosts `hostname`
fe80::20c:29ff:fe01:b48e STREAM loth
fe80::20c:29ff:fe01:b48e DGRAM
fe80::20c:29ff:fe01:b48e RAW
172.16.157.131 STREAM
172.16.157.131 DGRAM
172.16.157.131 RAW

real 0m10.021s
user 0m0.000s
sys 0m0.010s

I don't know if this is related but the name of the network interface was
'ens32' during the install, and switched to 'eth0' after the first reboot.
This is on VmWare server version 2.0.0 with a VM hardware version 7. This is
an old version of VmWare, so it is fine with me to close this bug.

FWIW below is my personal log of this install on VmWare, I also created a user
account and installed rsync, strace, mc, vim and python and run 'pacman -Syu',
but that's all (and tinkered with /etc/hosts as explained before):

install
loadkeys fr-latin1
# setfont Lat2-Terminus16
ping -c 3 www.google.com

filesystem setup
lsblk: list the hard disks attached to your system
fdisk /dev/sda
mkfs.ext4 /dev/sda1
mount /dev/sda1 /mnt

base system install
vi /etc/pacman.d/mirrorlist
ping -c 3 www.google.com
pacstrap -i /mnt base
genfstab -U -p /mnt >> /mnt/etc/fstab
vi /mnt/etc/fstab

chroot
vi /etc/locale.gen
en_US.UTF-8 UTF-8
fr_FR.UTF-8 UTF-8
locale-gen
echo LANG=en_US.UTF-8 > /etc/locale.conf
export LANG=en_US.UTF-8
vi /etc/vconsole.conf
KEYMAP=fr-latin1
# FONT=Lat2-Terminus16
ln -s /usr/share/zoneinfo/Europe/Paris /etc/localtime
hwclock --systohc --utc
echo loth > /etc/hostname
systemctl enable dhcpcd.service
pacman -S ifplugd
systemctl enable netctl-ifplugd@ens32.service
pacman -S grub
grub-install --target=i386-pc --recheck /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg
exit
umount -R /mnt
reboot
error msg at boot: dmesg: WRITE SAME failed. Manually zeroing.: see https://groups.google.com/forum/#!topic/linux.kernel/Uyo7u5FEBuY

Comment by Xavier de Gaye (xdegaye) - Sunday, 27 October 2013, 15:55 GMT
The following assumes that /etc/hosts has not been edited.
One can fix the problem by changing the order in /etc/nsswitch.conf in the hosts database from:

hosts: files dns myhostname

to:

hosts: files myhostname dns

However this is not the recommended practice in the man page of nss-myhostname, so it's a no go.

Then another solution is to prevent dns lookups for the given process (see man resolv.conf) so that
the dns service does not cause those delays:

$ RES_OPTIONS=attempts:0 python -c "import socket; print(socket.getfqdn())"

In that case, tcpdump shows that dns datagrams are not sent anymore over the network and the command
takes 0.1 seconds instead of the usual 10 seconds. Same thing for mc and getent.

Comment by Xavier de Gaye (xdegaye) - Monday, 18 November 2013, 16:22 GMT
Using RES_OPTIONS=attempts:0 to start mc, causes also the dns requests
from the mc subshell to fail. Rather annoying when you use git or
mercurial for example from the subshell.
Comment by Jakob Gruber (schuay) - Monday, 18 November 2013, 16:47 GMT
Is there anything here that actually requires action from Arch maintainers? Should this not be taken upstream instead?
Comment by Xavier de Gaye (xdegaye) - Monday, 18 November 2013, 17:21 GMT
It is fine with me to close this bug report.

Loading...