Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Terminal goes crazy when I use sudo/su
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
sinopeus
n00b
n00b


Joined: 20 Feb 2015
Posts: 7

PostPosted: Fri Feb 20, 2015 9:37 pm    Post subject: Terminal goes crazy when I use sudo/su Reply with quote

So yesterday I upgraded my system and today when I rebooted - craziness. When I open a terminal and I try to use sudo, it works but once the sudo'ed command starts execution, it gets into a weird loop where the shell prompt keeps repeating over and over - it's like the enter key is blocked or being pressed constantly. I've also noticed that the same happens with su (root prompt appears in a loop), and I can't use the 'exec' command (I need it to start my WM).

I'd post logs - but they don't actually show anything unusual of any kind! And once the terminal starts acting up, the keyboard blocks and I can't do anything, so I'm unable to take screenshots.

Has anyone ever seen anything like this before?
Back to top
View user's profile Send private message
sinopeus
n00b
n00b


Joined: 20 Feb 2015
Posts: 7

PostPosted: Sat Feb 21, 2015 8:41 pm    Post subject: Reply with quote

Added weirdness: this only seems to happen when I'm using a terminal with a login shell! So for example, if I start my terminal with 'urxvt -e zsh' the terminal works perfectly, if I just run 'urxvt' without extra arguments - boom.
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Sat Feb 21, 2015 8:48 pm    Post subject: Reply with quote

Does your urxvt have any plugins enabled? Does it work without those?
Back to top
View user's profile Send private message
sinopeus
n00b
n00b


Joined: 20 Feb 2015
Posts: 7

PostPosted: Sat Feb 21, 2015 9:16 pm    Post subject: Reply with quote

I only had the URL matcher plugin enabled. Disabling it didn't help. I've been digging and messing around a bit, and now it seems like the problem appears only if the following conditions are all met:

- I'm running a terminal emulator under X (using sudo in the tty works just fine).
- I'm running a login shell in this terminal emulator (using 'urxvt -e zsh' allows me to sudo).

I tried a blank .zshrc and .zprofile - no luck there either, and afterwards I discovered that bash had the same problem.

I've also been facing a few problems with X which are related to the upgrade to Xorg 1.16 (was made stable this Thursday, just before I upgraded my system). Think DM's not working properly any more. I'm not sure if that's directly related but since the problem only appears in X terminals ...
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Sun Feb 22, 2015 12:44 am    Post subject: Reply with quote

sinopeus ...

on this update did you updater perl, and subsequently run 'perl-cleaner --all'? urxvt links to perl, and given the odd behavior seems to be localised to the terminal this may be the issue. In my case x11-terms/rxvt-unicode was re-merged with perl-cleaner.

BTW, rather than use "a blank .zshrc" you can do the following: 'env -i zsh -f' (or just 'zsh -f' ... if you don't want to make sure the env is absoultely free of any variables).

best ... khay
Back to top
View user's profile Send private message
sinopeus
n00b
n00b


Joined: 20 Feb 2015
Posts: 7

PostPosted: Sun Feb 22, 2015 9:50 am    Post subject: Reply with quote

My last Perl upgrade was on the 12th of February and the system has been fully functional up to Thursday the 19th. I ran perl-cleaner anyway and it didn't find anything to unmerge or rebuild ... So I'm thinking it has nothing to do with perl. What I did notice is: if I use a different graphical terminal (I've tried st and terminator), sudo does work, so I'm now thinking that it does have something to do with urxvt specifically. BUT: it only works if I use some kind of launcher to run them - if I open urxvt, run the command 'st' or 'terminator', and try sudo in the resulting window, the same problem occurs.

I tried out the env command as well. It seems that doing sudo in the shell resulting from 'env -i zsh -f' works perfectly! So it's probably something to do with my environment, since I've already tried running without a .zshrc? But I'd find that a bit strange. I used the env command to print out the environment variables for both a login shell and non-login shell in urxvt and they're exactly the same ...

EDIT: I've now excluded ZSH being at fault. 'env -i sudo' works within any shell. So how do I start digging through my environment to find the culprit?
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Sun Feb 22, 2015 3:21 pm    Post subject: Reply with quote

sinopeus wrote:
I tried out the env command as well. It seems that doing sudo in the shell resulting from 'env -i zsh -f' works perfectly! So it's probably something to do with my environment, since I've already tried running without a .zshrc? But I'd find that a bit strange. I used the env command to print out the environment variables for both a login shell and non-login shell in urxvt and they're exactly the same.

EDIT: I've now excluded ZSH being at fault. 'env -i sudo' works within any shell. So how do I start digging through my environment to find the culprit?

sinopeus ... you don't happen to be using oh-my-broken-zsh do you? All of this suggests to me your configuration being the cause.

best ... khay
Back to top
View user's profile Send private message
sinopeus
n00b
n00b


Joined: 20 Feb 2015
Posts: 7

PostPosted: Sun Feb 22, 2015 6:13 pm    Post subject: Reply with quote

I'm not. Using grml-zsh, which is a lot less broken than oh-my-zsh in my experience. Note that running 'env -i sudo -i' works perfectly (i.e. the problem is not with zsh, since sudo -i starts a zsh login shell from another zsh login shell). The problem also appears in other shells if used in the same manner. So setting bash or tcsh (I tested those two) as my login shell and trying to use sudo in urxvt caused the exact same problem. Also - the configuration was working perfectly and hasn't changed a lot in the past six months (except adding an alias here or there). So I don't think my zsh config can be the cause.

It's just very weird behaviour. At first sight it seems like a problem with the shell because of the shell prompt appearing in a loop, but if I run for ex. 'sudo emerge <package>' the emerge command goes through fine, except there's a line break after every character - it's like the enter key is being pressed continuously.
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Sun Feb 22, 2015 7:55 pm    Post subject: Reply with quote

sinopeus wrote:
I'm not. Using grml-zsh, which is a lot less broken than oh-my-zsh in my experience. Note that running 'env -i sudo -i' works perfectly (i.e. the problem is not with zsh, since sudo -i starts a zsh login shell from another zsh login shell). The problem also appears in other shells if used in the same manner. So setting bash or tcsh (I tested those two) as my login shell and trying to use sudo in urxvt caused the exact same problem. Also - the configuration was working perfectly and hasn't changed a lot in the past six months (except adding an alias here or there). So I don't think my zsh config can be the cause.

sinopeus ... yes, but we have to account for why it goes away once the env is cleared, so I wouldn't rule out something related to the configuration entirely.

Do you run 'urxvtd and urxvtc' or 'urxvt' iself? You don't have the 'debug' useflag set? What packages were updated prior to the behavior? What TERM variable, any stty setting/changes? What DE/WM is in use, and is consolekit/policykit in use? Can you reproduce with another term (ie, x11-terms/st)? I guess 'emerge --info' wouldn't hurt.

sinopeus wrote:
It's just very weird behaviour. At first sight it seems like a problem with the shell because of the shell prompt appearing in a loop, but if I run for ex. 'sudo emerge <package>' the emerge command goes through fine, except there's a line break after every character - it's like the enter key is being pressed continuously.

Honestly, I've no idea what the cause is, or even where to begin, I guess looking at what happened before it arose might give us some clue.

best ... khay
Back to top
View user's profile Send private message
sinopeus
n00b
n00b


Joined: 20 Feb 2015
Posts: 7

PostPosted: Sun Feb 22, 2015 10:32 pm    Post subject: Reply with quote

khayyam wrote:

yes, but we have to account for why it goes away once the env is cleared, so I wouldn't rule out something related to the configuration entirely.


Very true.

khayyam wrote:

Do you run 'urxvtd and urxvtc' or 'urxvt' iself?


I use the urxvt daemon yes, but I've tried using simply urxvt - it behaves in the same way.

khayyam wrote:

You don't have the 'debug' useflag set?


I don't have it set. I don't see it in the USE flags for rxvt-unicode either.

khayyam wrote:

What packages were updated prior to the behavior?


http://pastebin.com/rJs6rBqx

A whole bunch of x11 packages it seems, I'd already seen that but where to start ...

khayyam wrote:

What TERM variable, any stty setting/changes?


rxvt-unicode-256color, no special stty stuff.

khayyam wrote:

What DE/WM is in use


Xmonad.

khayyam wrote:

, and is consolekit/policykit in use?


Polkit is running, I'm using systemd so no consolekit needed.

khayyam wrote:

Can you reproduce with another term (ie, x11-terms/st)?


Depends. If I use dmenu to launch st, I can't reproduce it. But if I use urxvt to launch st, then the same problem appears in st.

khayyam wrote:

I guess 'emerge --info' wouldn't hurt.


http://pastebin.com/JeNxvWke

khayyam wrote:

Honestly, I've no idea what the cause is, or even where to begin, I guess looking at what happened before it arose might give us some clue.


Usually I solve most issues I have on my system myself or by Googling, but I'm completely stumped by this and can't seem to find any other instance of it occurring on Google ...

khayyam wrote:

best ... khay


Thanks a bunch for helping already!
Back to top
View user's profile Send private message
sinopeus
n00b
n00b


Joined: 20 Feb 2015
Posts: 7

PostPosted: Sun Feb 22, 2015 11:24 pm    Post subject: Reply with quote

Found the solution.

https://bbs.archlinux.org/viewtopic.php?id=185398

I was running urxvtd as a systemd user service as well. Now I've put it into xinitrc and it works just fine. It's only since the xorg 1.16 upgrade that this happened and I haven't got a clue why. I'll report to the thread on the Arch BBS that I have had the same problem. This explains why urxvt worked perfectly ...
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum