Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 127411 - screen and Midnight Commander don't work on a serial console
Summary: screen and Midnight Commander don't work on a serial console
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Alex Alexander (RETIRED)
Depends on:
Blocks: 122768
  Show dependency tree
Reported: 2006-03-24 05:04 UTC by Sasha Polonsky
Modified: 2015-12-03 06:44 UTC (History)
8 users (show)

See Also:
Package list:
Runtime testing required: ---

Screenshot (mc.png,23.77 KB, image/png)
2006-03-27 02:21 UTC, Sasha Polonsky
mc-open-nonblock.diff (mc-open-nonblock.diff,827 bytes, patch)
2006-04-03 12:33 UTC, Michael Hanselmann (hansmi) (RETIRED)
Details | Diff
strace log for mc on a serial console (mc-serial-strace.log,9.60 KB, text/plain)
2006-04-04 05:13 UTC, Sasha Polonsky
strace log for screen on a serial console (screen-serial-strace.log,87.47 KB, text/plain)
2006-04-04 05:13 UTC, Sasha Polonsky
shell log with stty settings (cu-log.txt,1.43 KB, text/plain)
2006-04-04 05:14 UTC, Sasha Polonsky
strace -ff log for screen on a serial console (screen-strace.log,87.45 KB, text/plain)
2006-04-06 02:09 UTC, Sasha Polonsky
strange second strace -ff log for screen on a serial console (screen-strace.log.341,205 bytes, text/plain)
2006-04-06 02:11 UTC, Sasha Polonsky
mc-4.6.1-nonblock.patch (mc-4.6.1-nonblock.patch,394 bytes, patch)
2006-04-30 12:02 UTC, Emanuele Giaquinta (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sasha Polonsky 2006-03-24 05:04:09 UTC
I run a server with serial console on COM1 (/dev/ttyS0) at 115200bps. Everything
seems to be all right, but when I try to run screen or mc, it hangs and I should
ssh to the server and kill it. I tried a lot of TERM and stty settings, but still cannot get screen and mc work. This server has dual-boot Gentoo Linux / FreeBSD 5.4, and in FreeBSD screen and mc on serial console work well.
I attach /boot/grub/grub.conf, /etc/inittab and output of emerge --info

f1 ~ # cat /boot/grub/grub.conf
timeout 3
default 0
#color green/black light-green/black
serial --unit=0 --speed=115200
terminal --timeout=3 serial console

title  Gentoo Linux
root   (hd0,1)
kernel /boot/kernel-2.6.16 root=/dev/hda2 ro console=ttyS0,115200
#kernel /boot/kernel-2.6.16 root=/dev/hda2 ro vga=0x0F06

title FreeBSD 5.4
root (hd0,2,a)
kernel /boot/loader

f1 ~ # cat /etc/inittab
# /etc/inittab:  This file describes how the INIT process should set up
#                the system in a certain run-level.
# Author:  Miquel van Smoorenburg, <>
# Modified by:  Patrick J. Volkerding, <>
# Modified by:  Daniel Robbins, <>
# Modified by:  Martin Schlemmer, <>
# $Header: /var/cvsroot/gentoo-x86/sys-apps/sysvinit/files/inittab,v 1.5 2005/12/22 02:03:23 vapier Exp $

# Default runlevel.

# System initialization, mount local filesystems, etc.
si::sysinit:/sbin/rc sysinit
# Further system initialization, brings up the boot runlevel.
rc::bootwait:/sbin/rc boot

l0:0:wait:/sbin/rc shutdown
l1:S1:wait:/sbin/rc single
l2:2:wait:/sbin/rc nonetwork
l3:3:wait:/sbin/rc default
l4:4:wait:/sbin/rc default
l5:5:wait:/sbin/rc default
l6:6:wait:/sbin/rc reboot

c1:12345:respawn:/sbin/agetty 38400 tty1 linux
c2:2345:respawn:/sbin/agetty 38400 tty2 linux
#c3:2345:respawn:/sbin/agetty 38400 tty3 linux
#c4:2345:respawn:/sbin/agetty 38400 tty4 linux
#c5:2345:respawn:/sbin/agetty 38400 tty5 linux
#c6:2345:respawn:/sbin/agetty 38400 tty6 linux

s0:12345:respawn:/sbin/agetty 115200 ttyS0 vt100
#s1:12345:respawn:/sbin/agetty 9600 ttyS1 vt100

# What to do at the "Three Finger Salute".
ca:12345:ctrlaltdel:/sbin/shutdown -r now

# Used by /etc/init.d/xdm to control DM startup.
# Read the comments in /etc/init.d/xdm for more
# info. Do NOT remove, as this will start nothing
# extra at boot if /etc/init.d/xdm is not added
# to the "default" runlevel.

f1 ~ # emerge --info
Portage 2.0.54 (default-linux/x86/2006.0, gcc-3.4.5, glibc-2.3.5-r2, 2.6.16 i686)
System uname: 2.6.16 i686 AMD Duron(tm) processor
Gentoo Base System version 1.6.14
dev-lang/python:     2.4.2
sys-apps/sandbox:    1.2.12
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.16.1
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.11-r2
CFLAGS="-O3 -march=athlon -pipe"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d"
CXXFLAGS="-O3 -march=athlon -pipe"
FEATURES="autoconfig distlocks sandbox sfperms strict"
USE="x86 berkdb bzip2 cli crypt ctype dba elibc_glibc fastbuild force-cgi-redirect ftp idn java kernel_linux libwww memlimit ncurses pam perl posix python readline session simplexml soap sockets spl ssl tcpd tokenizer udev userland_GNU userlocales xsl zlib"
Comment 1 Sven Blumenstein (RETIRED) gentoo-dev 2006-03-25 03:42:11 UTC
I can confirm this on Sparc64 (Sun Ultra 2) using TeraTermPro from Windows or Minicom from another Sparc. Although I dont have to kill the mc process as I can still cancel this one with ctrl-c. But for the screen process I have to kill it or close/reopen the serial connection.
Comment 2 Jakub Moc (RETIRED) gentoo-dev 2006-03-25 03:54:31 UTC
Can you try to recompile mc with USE="-ncurses" and tell us if it helps?
Comment 3 Jakub Moc (RETIRED) gentoo-dev 2006-03-25 12:07:48 UTC
See above and post back. Thanks.
Comment 4 Sasha Polonsky 2006-03-27 02:21:41 UTC
Created attachment 83219 [details]

So the serial console looks like. Mc should not be killed in ssh session, it can be stopped with Ctrl-C, but still does not work
Comment 5 Sasha Polonsky 2006-03-27 02:23:24 UTC
I have recompiled mc with USE="-ncurses" and it does not help (see screenshot). I also need working screen.
Comment 6 Jakub Moc (RETIRED) gentoo-dev 2006-03-30 03:02:23 UTC
OK, this apparently doesn't move anywhere, no idea what's causing this problem. Attach some debugging info (like strace) and reopen then.
Comment 7 Michael Hanselmann (hansmi) (RETIRED) gentoo-dev 2006-04-03 12:33:29 UTC
Created attachment 83835 [details, diff]

Can you please test this patch? I've no idea what other implications it has except that mc starts over a real serial console (with the DCD line implemented).
Comment 8 Michael Hanselmann (hansmi) (RETIRED) gentoo-dev 2006-04-03 12:33:48 UTC
Comment 9 Sasha Polonsky 2006-04-04 05:13:21 UTC
Created attachment 83882 [details]
strace log for mc on a serial console
Comment 10 Sasha Polonsky 2006-04-04 05:13:49 UTC
Created attachment 83884 [details]
strace log for screen on a serial console
Comment 11 Sasha Polonsky 2006-04-04 05:14:20 UTC
Created attachment 83886 [details]
shell log with stty settings
Comment 12 Michael Hanselmann (hansmi) (RETIRED) gentoo-dev 2006-04-04 11:48:23 UTC
I'm really wondering what I should do with those logs 
Comment 13 Michael Hanselmann (hansmi) (RETIRED) gentoo-dev 2006-04-04 11:48:23 UTC
I'm really wondering what I should do with those logs 

Can you please submit the output files of "strace -ff -o mc-strace mc"? And does it work after applying the patch?
Comment 14 Sasha Polonsky 2006-04-06 02:04:03 UTC
Yes, after applying the patch mc started to work on a serial console. I have also tested it in ssh and telnet sessions and it worked there too. But I cannot test mc on a virtual console right now because that machine has no monitor and keyboard attached and this is a server used in a project, so it should be always up.

Screen still does not work. I will upload it's strace -ff log today.
Comment 15 Sasha Polonsky 2006-04-06 02:09:11 UTC
Created attachment 84054 [details]
strace -ff log for screen on a serial console
Comment 16 Sasha Polonsky 2006-04-06 02:11:41 UTC
Created attachment 84055 [details]
strange second strace -ff log for screen on a serial console

I have also noticed that on a serial console screen gives the error message
Directory '/var/run/screen' must have mode 777.,
and after chmod 777 /var/run/screen it gives the message
Directory '/var/run/screen' must have mode 775. in ssh session, so I should run
chmod 777 /var/run/screen.
Comment 17 Michael Hanselmann (hansmi) (RETIRED) gentoo-dev 2006-04-06 14:54:46 UTC
The maintainer of the screen ebuild will check in the patch not long from now. Please wait until then.
Comment 18 Michael Hanselmann (hansmi) (RETIRED) gentoo-dev 2006-04-26 11:27:05 UTC
Any information on this?
Comment 19 Sasha Polonsky 2006-04-27 01:43:50 UTC
I didn't understand what you mean. The maintainer of screen has not contacted me. I emerge --sync'ed yesterday and saw that mc was updated to version 4.6.1, and it also does not work on a serial console and your patch does not work with this version. So on a machine with a serial console I used to emerge "=app-misc/mc-4.6.0" with your patch applied manually.
Comment 20 Michael Hanselmann (hansmi) (RETIRED) gentoo-dev 2006-04-30 04:54:27 UTC
Lanius: Please use the attached patch for screen.
Comment 21 Jakub Moc (RETIRED) gentoo-dev 2006-04-30 05:27:28 UTC
(In reply to comment #19)
> Lanius: Please use the attached patch for screen.

Good luck w/ lanius. ;) exg, can you perhaps revbump mc w/ this patch?

Comment 22 Emanuele Giaquinta (RETIRED) gentoo-dev 2006-04-30 12:02:23 UTC
Created attachment 85846 [details, diff]

Can you please verify that mc-4.6.1 works with this patch?
Comment 23 Sasha Polonsky 2006-05-03 07:01:42 UTC
Yes, the patch for mc 4.6.1 works. The only thing left is to add this patch to portage. BTW, what attached patch for screen do you mean? I cannot find it.

Comment 24 Emanuele Giaquinta (RETIRED) gentoo-dev 2006-05-03 07:48:20 UTC
fixed in mc-4.6.1-r1.ebuild.
Comment 25 klamp 2011-04-20 11:10:20 UTC
This old bug seems to be back in mc-, same symptoms and same patch works.
Comment 26 Alex Legler (RETIRED) archtester gentoo-dev Security 2015-12-02 11:10:29 UTC
Assigning to current mc maintainers
Comment 27 Jeroen Roovers (RETIRED) gentoo-dev 2015-12-03 06:44:27 UTC
So that would be what is known as a regression. Please file a new bug report.