4

I am running Ubuntu 17.04. This happens inside X, after I have logged in. I'm running the default install of Ubuntu Gnome https://ubuntugnome.org/

I have the following code inside ~/.bashrc

[[ -z "$TMUX" ]] && exec tmux # Launch tmux in new shells

When I reboot and login with this in my bashrc then ALT+LEFT and ALT+RIGHT switch to the previous and next tty, respectively.

When I remove the line, then ALT+LEFT and ALT+RIGHT go back to their usual behaviour of going back and forward in my browser.

Am I launching tmux wrong?

2
  • Is this in the Linux console, under Xorg or under a WM/DE that uses Wayland? I assume it only happens without a graphical environment?
    – Alexander
    Commented Oct 1, 2017 at 18:51
  • 2
    @Alexander It happens when I have logged in to X. ALT+RIGHT/LEFT does exactly the same thing as CTRL+ALT+F1 for example. From X, pressing ALT+LEFT goes to tty6. Pressing ALT+LEFT again goes to tty5, etc.
    – AndrewVos
    Commented Oct 1, 2017 at 20:08

2 Answers 2

1

I am running Ubuntu 18.04 with GNOME Shell and X (no Wayland), haven't added anything about tmux to my bashrc, and I am seeing the same issue. I haven't been able to localize the cause, but to the best of my knowledge, it seems like something funky is happening with either closing and opening the laptop or the system going to sleep. When I reboot, the issue is no longer present. If we are observing the same issue, I would expect yours to no longer be present after a reboot.

2
  • Hi. This is not much like an answer to the question (liable to be flagged as such). I would say you're observing a different issue: nothing to do with tmux / bashrc / points 3&4 in my answer, plus the question issue happens immediately "when I reboot and login". You might be interested in my pts 1&2 if you weren't already aware. You could ask a fresh question, this would be more useful to anyone else with your problem. You've written up some good details and suspicions. Previously I've asked a question like "Is there a known bug on FOO which causes BAR (which goes away when I do QUUX)?"
    – sourcejedi
    Commented Jul 31, 2018 at 9:42
  • Just, given the site policy on duplicates, you're effectively required to only ask one of either the Unix&Linux site, or the AskUbuntu site. AskUbuntu might be a better bet if you suspect there's a lot of other affected users and one of them might know an answer... Here might be equally good if you want people to point out log files you would want to check for suspicious errors.
    – sourcejedi
    Commented Jul 31, 2018 at 9:49
0

Correct. This bashrc config is not compatible with the rest of the software you currently use. Consider the following.

  1. The Linux console implements ALT+LEFT / ALT_RIGHT by default. You can always see this behaviour when you use a text console login. (E.g. after CTRL+ALT+F6).
  2. The graphical system aka. X server, disables this behaviour by switching the keyboard mode of the current Linux console (e.g. /dev/tty7) to "raw".

    See e.g. What is raw keyboard mode?

  3. Traditionally, X is always started from inside a user shell. This tradition is [ab]used to set environment variables like PATH (the list of directories to find commands in) in shell config files like .bashrc, and have them apply to graphical sessions, not just logins which obviously use a shell like text console or SSH logins.

    See e.g. What is the status of setting environment variables without ~/.bash_profile?

  4. Very broadly, if you're on a Linux console and then you run something inside tmux, that thing will talk to tmux (through a pseudo-terminal), and not directly to the Linux console. I don't know exactly what happens in your case, but it sounds like X might be running inside tmux, and this causes it to proceed without finding the current console to switch to raw mode.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .