dvdhrm / kmscon

Linux KMS/DRM based virtual Console Emulator
http://www.freedesktop.org/wiki/Software/kmscon
Other
436 stars 81 forks source link

it produces "^H" when I hit [backspace] on kmscon login phase #69

Closed wind0204 closed 11 years ago

wind0204 commented 11 years ago

"it produces "^H" when I hit [backspace] on kmscon login phase" instead of removing a character in my gentoo box

dvdhrm commented 11 years ago

What login program do you use? kmscon uses /bin/login by default, did you change that? If not, which package provides /bin/login on your box?

kmscon sets VERASE=^H for the TTY. If /bin/login resets the TTY (which it shouldn't do), it might screw the setup.

Regards David

wind0204 commented 11 years ago

I guess there is no package providing /bin/login. I have done a "emerge -s login"(Searching for packages whose name contains "login") and there was no installed packages in the result list. I'm a linux newbie and was just a windows user, so don't trust me :-d

And I just have done 2 things after "make install"

  1. /etc/inittab
# TERMINALS
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
#c1:12345:respawn:/usr/bin/kmscon --vt /dev/tty1
c2:2345:respawn:/usr/bin/kmscon --vt /dev/tty2
c3:2345:respawn:/usr/bin/kmscon --vt /dev/tty3
c4:2345:respawn:/usr/bin/kmscon --vt /dev/tty4
c5:2345:respawn:/usr/bin/kmscon --vt /dev/tty5
c6:2345:respawn:/usr/bin/kmscon --vt /dev/tty6
  1. /etc/kmscon/kmscon.conf
font-size=11
hwaccel
verbose
sb-size=256
xkb-layout=kr
dvdhrm commented 11 years ago

/bin/login is normally provided by a package called "util-linux" or similar. Anyway, could you login at a kmscon prompt that is broken and then type "stty" and show me the output? The "erase" line should be "erase = ^H".

wind0204 commented 11 years ago

I don't know whether '/bin/login' is from sys-apps/util-linux or sys-apps/shadow.

here is the output of stty:

dewr@dewr ~ $ stty --all
speed 38400 baud; rows 50; columns 160; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
-iuclc -ixany -imaxbel -iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke
wind0204 commented 11 years ago

this one is different a little and is from agetty (tty1)

dewr ~ # stty --all
speed 38400 baud; rows 50; columns 160; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 hupcl -cstopb cread -clocal -crtscts
-ignbrk brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
-iuclc -ixany imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke
dvdhrm commented 11 years ago

Ok, this is really weird. I set VERASE=^H during TTY setup but somehow your TTY gets reset. This really shouldn't happen. Could you try:

kmscon --debug --login /bin/sh

This starts kmscon with /bin/sh instead of /bin/login. Can you then try again "stty" and check what the "erase =" line looks like? If it is "erase = ^H" then you /bin/login needs fixed and I should check what Gentoo uses there. Otherwise, kmscon probably needs to be fixed.

Thanks

wind0204 commented 11 years ago

well.. it is "erase = ^H"

sh-4.2# stty --all
speed 38400 baud; rows 50; columns 142; line = 0;
intr = ^C; quit = ^\; erase = ^H; kill = ^U; eof = ^D; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
-iuclc -ixany -imaxbel -iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke

and here is from in fbterm(another terminal emulator) on which I haven't tried a login. when I hit "fbterm" in bash, it just doesn't prompt login, and just show me bash. it seems same:

dewr ~ # stty --all
speed 38400 baud; rows 57; columns 91; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
...blahblah...
dvdhrm commented 11 years ago

Ok, I tracked this down. Unfortunately, gentoo doesn't use the util-linux /bin/login program, but instead one from the debian-shadow package (sys-util/shadow on gentoo). Code can be found here: http://anonscm.debian.org/viewvc/pkg-shadow/upstream/trunk/src/login.c?view=markup (I cannot find out why they do that, but ok)

Anyway, upstream /bin/login keeps the VERASE setting of the parent TTY untouched. But gentoo /bin/login resets it to the value given in /etc/login.defs ERASECHAR option. The only way to avoid this, is to comment this option out. That is, prepend a hashtag '#' before the line with ERASECHAR=XY. After that, everything should be working again.

Side note: I don't know why gentoo /bin/login still uses the ERASECHAR option. This should really be fixed there as it is obsolete and a wrong default setting, imo. But maybe they keep it because some other program initializes VERASE wrongly? I don't know. If it annoys you, report it to gentoo bugtracker.

Can you confirm that removing/commenting ERASECHAR=XY in /etc/login.defs fixes things? Thanks David

wind0204 commented 11 years ago

Yes. removing/commenting ERASECHAR solves the problem!

#
# Login configuration initializations:
#
#       ERASECHAR       Terminal ERASE character ('\010' = backspace).
#       KILLCHAR        Terminal KILL character ('\025' = CTRL/U).
#       ULIMIT          Default "ulimit" value.
#
# The ERASECHAR and KILLCHAR are used only on System V machines.
# The ULIMIT is used only if the system supports it.
# (now it works with setrlimit too; ulimit is in 512-byte units)
#
# Prefix these values with "0" to get octal, "0x" to get hexadecimal.
#
#ERASECHAR      0177
KILLCHAR        025
#ULIMIT         2097152