LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   mc problem under root shell in X (https://www.linuxquestions.org/questions/slackware-14/mc-problem-under-root-shell-in-x-4175587536/)

montagdude 08-20-2016 09:13 PM

mc problem under root shell in X
 
I am experiencing an annoyance with Midnight Commander (mc) when run under a root shell in X. (By root shell, I mean opening a terminal and typing 'su -l'.) The issue is that Ctrl+Enter does not put the highlighted item's text onto the command line like it should. It does work correctly under a normal user shell, and it also works under a root shell from a console login, just not under X. It also works if I get a root shell using 'su -lm', but I prefer not to do that. However, this suggests to me that it must be an issue with the environment, but I'm not sure what aspect of the environment I should be checking.

Some more info off the top of my head:
  • The $TERM variable is the same for both the user and root shell (xterm).
  • Running mc -V gives the same output under both the user and root shell.
  • I tried copying the user mc config files to root's mc config directory, but it didn't fix it.
Any ideas?

kingbeowulf 08-20-2016 09:49 PM

Using Xfce DE, Slackware64 14.2 multilib, in 'su -' or su-l' root shell:
Unconfirmed: Ctrl-Enter Works as expected Xfce's Terminal, set to xterm emulation
Unconfirmed: Ctrl-Enter Works as expected xterm
Unconfirmed: Ctrl-Enter Works as expected rvxt

(I would have tried a few more, but I can't seem to remember how many terminal emulators in in Slackware!)

Perhaps some added details as to which DE/WM (as I doubt you are using bare X) and terminal emulator you are using would help us narror down the issue? Also: wversion of Slackware (full or customer install)?

montagdude 08-20-2016 10:05 PM

I'm using Slackware64 14.2, full install except for xfce, most of xap, and some games in kde. For DEs I've tried KDE and Lumina, terminal emulators qterminal, konsole, xterm, and rxvt, and this same behavior happens in all of them. If this helps, here are the differences between printenv run as user and root. Nothing really stuck out to me, but maybe it will to someone else:

Code:

diff user_environment root_environment
2a3
> HZ=100
4,5d4
< DM_CONTROL=/var/run/xdmctl
< XDG_DATA_HOME=/home/dan/.local/share
8,11d6
< XDG_SESSION_COOKIE=Thinkpad-T430-1471748202.976540-1396038595
< XDM_MANAGED=method=classic
< WINDOWID=33554434
< OLDPWD=/home/dan
14,15c9,10
< USER=dan
< LS_COLORS=<snip>
---
> USER=root
> LS_COLORS=<snip>
21,22c16,17
< DESKTOP_SESSION=Lumina
< PATH=/usr/local/krb5/bin:/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/lib64/java/bin:/usr/lib64/java/jre/bin:/usr/lib64/kde4/libexec:/usr/lib64/qt/bin:/usr/lib64/qt5/bin
---
> MAIL=/var/spool/mail/root
> PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/lib64/java/bin:/usr/lib64/java/jre/bin:/usr/lib64/kde4/libexec:/usr/lib64/qt/bin:/usr/lib64/qt5/bin
25c20
< PWD=/home/dan/Desktop
---
> PWD=/root
29d23
< KDEDIRS=/usr
31,35c25,29
< HOME=/home/dan
< COLORFGBG=15;0
< SHLVL=2
< XDG_CONFIG_HOME=/home/dan/.config
< LANGUAGE=
---
> KDEDIRS=/usr
> PS1=\u@\h:\w\$
> PS2=>
> SHLVL=1
> HOME=/root
37,38d30
< XDG_CACHE_HOME=/home/dan/.cache
< PYTHONPATH=/home/dan/python_tools/lib:
40,41c32
< LOGNAME=dan
< XDG_DATA_DIRS=/usr/local/share:/usr/share
---
> LOGNAME=root
44d34
< WINDOWPATH=7
46d35
< XDG_CURRENT_DESKTOP=Lumina

I guess if nobody knows of the top of their head, I can go through them one-by-one to find the culprit. Maybe running printenv from an su -l login in console mode (since it works there) would be enlightening as well.

montagdude 08-20-2016 10:33 PM

Alright, well I found out that setting the $HOME environment variable for root to the user's home directory fixes the problem, but I don't want to do that. That seems to be the same reason why it works with 'su -lm'. I also tried looking at the differences between printenv run by root in console mode and under X, and there were only two of them: $TERM and $DISPLAY. Unfortunately, changing those variables to the ones from console mode didn't help. So now I'm out of ideas.

FYI, I can work around it by using Esc+Enter instead of Ctrl+Enter, but I'd still like to know what the problem is.

kingbeowulf 08-20-2016 10:47 PM

what shell? bash? Do you have a .bashrc in /root?

I just tried mc in 'su -l' bash konsole shell in KDE (full 14.2 qemu VM), and Ctrl-Enter works as expected. I not sure, but I don't think its your env.

montagdude 08-20-2016 10:50 PM

I use bash. I don't have a .bashrc in /root, but I do have a bash_profile, which is almost the same as the .bashrc in my user $HOME directory. I just tried temporarily renaming /root/bash_profile, and the problem remained. I think you are right that it is something other than the environment, but I'm not sure what.

kingbeowulf 08-20-2016 10:59 PM

Then we are both stumped. The man page does state that ALT-ENTER and CTRL-ENTER are the same and that CTRL-ENTER may not work in some cases. Why it works Ok here and not on yours is a mystery. Maybe try a clean full install in VM?

allend 08-21-2016 08:33 AM

I find "Ctrl-Enter" as documented:
- Works for normal user in shell without X.
- Works for normal user in terminal emulator under X
- Works for root in shell without X.
- Works for root in terminal emulator under X when started with 'su -m'.
- Does not work for root in terminal emulator under X when started with 'su -' or 'su -l'. 'Ctrl-x t' works as an equivalent.

Seems that this has been a source of friction in the past. https://www.midnight-commander.org/ticket/2150

zk1234 08-21-2016 09:16 AM

Quote:

Originally Posted by montagdude (Post 5593747)
I'm using Slackware64 14.2, full install except for xfce, most of xap, and some games in kde.

Are you using mc included in Slackware, or a newer one compiled by you ?

.

montagdude 08-21-2016 12:25 PM

Quote:

Originally Posted by allend (Post 5593870)
I find "Ctrl-Enter" as documented:
- Works for normal user in shell without X.
- Works for normal user in terminal emulator under X
- Works for root in shell without X.
- Works for root in terminal emulator under X when started with 'su -m'.
- Does not work for root in terminal emulator under X when started with 'su -' or 'su -l'. 'Ctrl-x t' works as an equivalent.

Seems that this has been a source of friction in the past. https://www.midnight-commander.org/ticket/2150

Sounds like the same behavior as me then.

Quote:

Originally Posted by zk1234 (Post 5593885)
Are you using mc included in Slackware, or a newer one compiled by you ?

.

I'm using the version included in Slackware.

Wiser Slacker 08-24-2016 01:07 PM

what about the sourcing of the ".Xdefaults" in the root directory ... if there is one ?
i have had some "hard to find" problems with that if these files are different ...

the other way could be to use slogin to become a real root with all its inbuild or sourced shell varibles ...
since slogin is gone - you now could use someting like this for remote and local login shells
Code:

rxvt -name $TARGET -ls -sb -sl 1500 -font 6x13 -T $WERBINICH@$TARGET -e ssh -l $WERBINICH -X -C $TARGET &
where $TARGET is the TARGET system - local or remote - i set this in a script
where $WERBINICH is the loginname - one may get it from whoami or from command line variable in an script

i dont ever use the cli in mc so i can't tell you if it helps to your problem .... sorry

montagdude 02-09-2017 08:22 AM

Well, I never figured out what the problem was, but I recently reinstalled Slackware because of an error I made (here), and now the problem with mc as root is gone. So I'll mark this as solved. Sorry to anyone reading this with the same problem that I never figured out the cause.

NoStressHQ 02-09-2017 09:23 AM

Why not use *kdesu* instead ?
Code:

$ kdesu Terminal &>/dev/null &
(Or make a shortcut)...


All times are GMT -5. The time now is 12:04 AM.