Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Other Things Gentoo
  • Search

[Solved]Weird tty behavior

Still need help with Gentoo, and your question doesn't fit in the above forums? Here is your last bastion of hope.
Post Reply
Advanced search
10 posts • Page 1 of 1
Author
Message
ShadowHawk92
n00b
n00b
Posts: 14
Joined: Mon Mar 04, 2013 3:15 am
Location: Texas, USA
Contact:
Contact ShadowHawk92
Website

[Solved]Weird tty behavior

  • Quote

Post by ShadowHawk92 » Sat Apr 20, 2013 8:41 pm

I'm having some weird behavior related to tty.
NOTE: I am running KDE 4.10.1 with Konsole 4.10.1

The first problem I realized was [topic=954838]this topic,[/topic] but I marked it solved when I found a workaround and there were no responses.

The second problem I noticed is that when I'm logged in as root, if I run man, instead of accepting input and scrolling pages (or whatever I told it to do) the key code would be displayed where the page number was.
I.E. I hit [Down] to scroll down one line, but instead...

Code: Select all

lines 1-57
turns into

Code: Select all

:^[0B
I can backspace it away, and I can type, but It captures all my keyboard input and I cannot close the man page. I even just tried it in a tmux shell run as sudo, and I could not even 'C-a x' which should force tmux to close the terminal.

The third problem, that I just noticed the other day, is that gnupg doesn't work. When I run gpg I get the following:

Code: Select all

 % gpg --gen-key
gpg (GnuPG) 2.0.19; Copyright (C) 2012 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

gpg: cannot open `/dev/tty': Permission denied
If I run the command as root the behavior varies depending on the kernel console= option:
If kernel... console=tty1 then I can see the output and type input into tty1 (Ctl-Alt-F1)
If I do not specify console= then I cannot see the output or input in any of the 6 tty's or the pts I ran the command in. I believe I discussed having similar behavior in the above thread.

I have no idea what is happening, or what information is relevant, so I'll give some of my system information here, more info available on request.

Computer: Toshiba Satellite C675
Processor: Intel Pentium CPU B960 @ 2.20GHz
Kernel: ck-sources 3.7.10 Custom compiled - No genkernel
I'm running a custom generated initramfs and custom init script. I can give information about the initramfs if need be.

Any and all suggestions & help appreciated.

~ShadowHawk92

Solved After a reboot, even Konsole seems to be working fine. Thanks for the help!
Last edited by ShadowHawk92 on Thu Apr 25, 2013 6:30 pm, edited 1 time in total.
Top
BradN
Advocate
Advocate
User avatar
Posts: 2391
Joined: Fri Apr 19, 2002 2:48 am
Location: Wisconsin (USA)

  • Quote

Post by BradN » Sun Apr 21, 2013 1:57 am

Sounds possibly like a missing kernel config option - try turning on more options related to tty handling. I doubt something like that would be broken in udev but there's a side chance of that as well.

Has the problem recently appeared (if so, any system package upgrades that might have affected it?) or could it have been like that a while?
Top
ShadowHawk92
n00b
n00b
Posts: 14
Joined: Mon Mar 04, 2013 3:15 am
Location: Texas, USA
Contact:
Contact ShadowHawk92
Website

  • Quote

Post by ShadowHawk92 » Sun Apr 21, 2013 4:32 am

BradN,

I've had the problem since installing KDE. Actually the man page problem happens even in tty. I've upgraded Udev since initial install and the problem persisted. sys-fs/udev is version 200, virtual/udev is 197.3.

A quick search for tty in the kernel menu config shows everything with tty in the name being =n. The problem is that I don't know what needs to be changed.
Top
khayyam
Watchman
Watchman
User avatar
Posts: 6227
Joined: Thu Jun 07, 2012 2:45 am
Location: Room 101

Re: Weird tty behavior

  • Quote

Post by khayyam » Sun Apr 21, 2013 3:31 pm

ShadowHawk92 wrote:The second problem I noticed is that when I'm logged in as root, if I run man, instead of accepting input and scrolling pages (or whatever I told it to do) the key code would be displayed where the page number was.
ShadowHawk92 ... I think there may a number of seperate issues here, and for that reason its difficult from your report to point at the 'cause' and provide a solution.

My first stab in the dark would be to ask if you've tried another terminal, and if the same issues can be reproduced, this would rule out kconsole, and narrow down the scope. Also, can it be reproduced in the console?
ShadowHawk92 wrote:I can backspace it away, and I can type, but It captures all my keyboard input and I cannot close the man page. I even just tried it in a tmux shell run as sudo, and I could not even 'C-a x' which should force tmux to close the terminal.
Your shell will interpret the keycodes sent via the keyboard in a certain way, ^? or ^H (for stty erase) being one example. This is true for other keys such as 'page up', 'end', etc. So, does the keymap you provide represent the keyboard, and does KDE (in whatever "keyboard" preferences) show the same keymap, ie: keymap=us. Also, when using tmux the terminal is being reported to tmux, so what does kconsole say is the TERM and what does tmux think it is? The value of TERM will effect the termcap used, and so how the shell understands keyboard input.
ShadowHawk92 wrote:The third problem, that I just noticed the other day, is that gnupg doesn't work. When I run gpg I get the following:

Code: Select all

% gpg --gen-key
gpg (GnuPG) 2.0.19; Copyright (C) 2012 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

gpg: cannot open `/dev/tty': Permission denied
Does the following produce the same error?

Code: Select all

% GPG_TTY=$(tty) gpg --gen-key
Infact ... what does the output of 'tty' show?
ShadowHawk92 wrote:If I run the command as root the behavior varies depending on the kernel console= option: If kernel... console=tty1 then I can see the output and type input into tty1 (Ctl-Alt-F1)
If I do not specify console= then I cannot see the output or input in any of the 6 tty's or the pts I ran the command in. I believe I discussed having similar behavior in the above thread.
Why are you passing console=tty1? ... unless you need to send to a serial line then using console= is not necessary.
ShadowHawk92 wrote:I have no idea what is happening, or what information is relevant, so I'll give some of my system information here, more info available on request.
Its really hard to see what might be the issue, you should probably post your kernel config, and init from the initramfs. CONFIG_UNIX98_PTYS is enabled?

best ... khay
Top
ShadowHawk92
n00b
n00b
Posts: 14
Joined: Mon Mar 04, 2013 3:15 am
Location: Texas, USA
Contact:
Contact ShadowHawk92
Website

  • Quote

Post by ShadowHawk92 » Mon Apr 22, 2013 4:13 pm

I'm having to type this from my phone, I appolagize for spelling errors in advance.

Khayyam,

The problem with man pages is reproducable in a tty. I went ahead and installed another terminal emulator anyway (yakuake) to test in also.

Running

Code: Select all

sudo man gpg
in yakuake (without tmux) had the same input error. Before I gave it any input there was just a colon where the page numbers should have been. Giving it input showed me the key codes after the colon instead of scrolling.

In konsole TERM=xterm;
in yakuake TERM=xterm;
in tmux TERM=screen-256color

In tmux, konsole, and yakuake

Code: Select all

% GPG_TTY=$(tty) gpg --gen-key
...
gpg: cannot open '/dev/tty': Permission denied

Code: Select all

% tty
/dev/pts/#
Currently Konsole is pts/2 and yakuake is pts/1. TMUX grabs the next available pts also. So if I ran it now it would be pts/3.

CONFIG_UNIX98_PTYS=y.

console=tty1 is from http://en.gentoo-wiki.com/wiki/Fbsplash although I removed it trying to figure this out.
Top
khayyam
Watchman
Watchman
User avatar
Posts: 6227
Joined: Thu Jun 07, 2012 2:45 am
Location: Room 101

  • Quote

Post by khayyam » Mon Apr 22, 2013 8:53 pm

ShadowHawk92 wrote:

Code: Select all

% GPG_TTY=$(tty) gpg --gen-key
...
gpg: cannot open '/dev/tty': Permission denied
ShadowHawk92 ... can you check what the permissions of /dev/tty are ... they should be ugo+rw.
ShadowHawk92 wrote:console=tty1 is from http://en.gentoo-wiki.com/wiki/Fbsplash although I removed it trying to figure this out.
So your initramfs is that built with genkernel with the suggested changes from the wiki.com howto? Have you tried to boot without this, and with a non modified kernel? I suspect this to be the prime candidate for why the tty is not rw for your user, and that the subseqent issues are the result.

best ... khay
Top
ShadowHawk92
n00b
n00b
Posts: 14
Joined: Mon Mar 04, 2013 3:15 am
Location: Texas, USA
Contact:
Contact ShadowHawk92
Website

  • Quote

Post by ShadowHawk92 » Mon Apr 22, 2013 11:14 pm

Code: Select all

% ls -l /dev/tty 
crw-rw---- 1 root root 5, 1 Apr 22 13:05 /dev/tty
My initramfs is not built with genkernel, it is most similar to this with the fbsplash modifications I linked to earlier. I also added GnuPG 1.4.11 to the initramfs. I can download gentoo-sources and compile it with genkernel, but my whole hard drive is encrypted with boot on a usb drive so I have to have an initramfs to decrypt the hard drive. Actually, genkernel has support for a cryptsetup, gpg, lvm initramfs so I may be able to genkernel a working initramfs and try that.

I tried (just for kicks)

Code: Select all

sudo chmod ugo+rw /dev/tty
I took a screenshot of the result. You can see it prints a message, then just hangs. This makes me think it may not be the tty permissions that are the problem.

I'm emerging genkernel and gentoo-sources now. Will (try) to use genkernel to compile the kernel and the initramfs and will report back with the results.
Also if you want I can post my current initramfs init script.
Top
ShadowHawk92
n00b
n00b
Posts: 14
Joined: Mon Mar 04, 2013 3:15 am
Location: Texas, USA
Contact:
Contact ShadowHawk92
Website

Finally got Gentoo-sources working

  • Quote

Post by ShadowHawk92 » Thu Apr 25, 2013 5:17 pm

I forgot how much kernel customization I had to do to get my system set up. Any how, a large number of kernel compiles and reboots later I finally got a genkerneled gentoo-sources bootable, albeit with my custom initramfs and I'm having the same problem.
So the kernel isn't the problem.

I have a line in my initramfs:

Code: Select all

cp -a /dev/console /dev/tty
So that gpg will work in the initramfs. I'm wondering if this is the problem so I devised another work-around that I'm about to try.

Also, because of my setup, I don't think a genkernel initramfs will ever work right, but I can use the shell when it fails to (hopefully) boot, and test that.

I'll let you know what I find out, but any other suggestions would be greatly appreciated.

- Shadow

EDIT:Removing the above line from initramfs fixed all the problems and created a new one (or emphasized an old one I hadn't noticed.)
But first, to clarify, the problem with man pages works, gpg --gen-key works, and sudo works without the -S option; all in tty, pts, and tmux.

The (new) Problem: On login, yakuake starts automatically and grabs pts/0. However, something else (I don't know what) grabs pts/1. If I start Konsole, it grabs pts/2.
Konsole (pts/2) can't read in my password. I can't use sudo, or su. I can use Ctl-C and exit the password prompt from sudo, but not su.

Code: Select all

[ ryan@CommanderShepard ] (pts/2) ~/
% ls -l /dev/pts 
total 0
crw------- 1 ryan tty 136, 0 Apr 25 12:44 0
crw--w---- 1 ryan tty 136, 1 Apr 25 12:28 1
crw------- 1 ryan tty 136, 2 Apr 25 12:47 2

[ ryan@CommanderShepard ] (pts/2) ~/
% chmod g-w /dev/pts/1

[ ryan@CommanderShepard ] (pts/2) ~/
% ls -l /dev/pts           
total 0
crw------- 1 ryan tty 136, 0 Apr 25 12:44 0
crw------- 1 ryan tty 136, 1 Apr 25 12:28 1
crw------- 1 ryan tty 136, 2 Apr 25 12:49 2
[ ryan@CommanderShepard ] (pts/2) ~/
% sudo echo 'Hello World!'
Password: 
Pauses for audience applause, not a sausage
Password: 
When I change the permissions of pts/1, pts/2 works fine, so I imagine if I can figure out what is grabbing pts/1 I can fix the problem.

Any ideas?
/Edit
Edit2: lsof is your best friend.

Code: Select all

% lsof | grep pts
kded4     2141            ryan   17u      CHR              136,1       0t0       4 /dev/pts/1
QInotifyF 2141 2225       ryan   17u      CHR              136,1       0t0       4 /dev/pts/1
QProcessM 2141 2779       ryan   17u      CHR              136,1       0t0       4 /dev/pts/1
I still don't know why it's setting the permissions wrong though.
Top
khayyam
Watchman
Watchman
User avatar
Posts: 6227
Joined: Thu Jun 07, 2012 2:45 am
Location: Room 101

  • Quote

Post by khayyam » Sat Apr 27, 2013 5:38 pm

ShadowHawk92 ...

see the following [post=7298374]link[/post]

best ... khay
Top
ShadowHawk92
n00b
n00b
Posts: 14
Joined: Mon Mar 04, 2013 3:15 am
Location: Texas, USA
Contact:
Contact ShadowHawk92
Website

  • Quote

Post by ShadowHawk92 » Tue Apr 30, 2013 3:05 pm

Thanks Khayyam.
Top
Post Reply

10 posts • Page 1 of 1

Return to “Other Things Gentoo”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic