Loss of Vim keybindings after screen detach and SSH logout - vim

On one of the servers I commonly work with (Ubuntu 11.04), I get a hanging logout whenever I do following:
Log in via SSH
Start screen
Run Vim
{edit files, etc}
Detach screen session
Log out of server ("exit")
After doing, it hangs. (says "logout", never seems to actually log out). Furthermore, the next time I log in and reattach my screen session, it seems that all of my key bindings are gone in Vim. This includes the entire functionality of some plugins, like NERDTree.
I tried a few different combinations of these actions. For example, if I exit Vim before detaching my screen, it doesn't do this. It also doesn't do this if I don't run Vim at all, or if I don't run screen at all.
Any idea what could be going on here?

I found out what the issue is. I had my SSH client configured to forward X for that server. Disabling that fixed the problem. I don't really understand the details of why, but that's what it is.

Related

ISPF reconnect successful but does not show ISPF primary options menu

I have a problem reconnecting to ISPF. After the TSO/E LOGON screen, the screen on the attached picture shows and says that logon reconnection is successful, but it doesn't proceed to ISPF. If I type any commands, ISPF, logoff, etc. it locks.
Make sure you are connecting with the same terminal settings(mod5, mod2, etc).
Sometime you need to use PA2 to force a rebuild of the current panel. If you disconnected while running a CLIST/EXEC/program, then you might need to ATTN out of it.
It could have been that you were in a process that was looping or hung, and you were simply reconnected to that looping/hanging process. Next time, try the ATTN key. I have seen some installations set up the logon screen/process where if you do not choose RECONNECT, your still-active prior session will be terminated prior to logging you on. This is a nice setup, especially for hang situations like you were probably in.

Reconnecting to a console output after system restart

For a running script on a Linux VM with a regular console output: If I disconnect from the VM the output window disappears. If I restart the VM, the script is still running but how do I get back to the output-screen?
Easy solution: use GNU screen, or an alternative like tmux to run your scripts in a persistent session. Thus, if you accidentally disconnect from your SSH session (or must shut down your computer), you can still reattach to the screen session later.
Tutorial: Using GNU Screen to Manage Persistent Terminal Sessions
Another great feature is that screen can also log the console output to a file. I use it all the time for cron jobs or other unattended tasks. I also use screen for updates (using yum, dnf or whatever), because updates can take a lot of time, and sometimes may even have to restart the network service, which would terminate your SSH session.

Trying to launch a process via screen from within ansible

I'm having a slightly weird, repeatable, but unexplainable problem with screen.
I'm using ansible/vagrant to build a consistent dev environment for my company, and as a slightly showy finishing touch it starts the dev server running in a screen session so the frontend devs don't need to bother logging in and manually starting the process, but backend devs can log in and take control.
However, one of the systems - despite being built from scratch - ends up with an immediately dead screen (it doesn't log anything to screenlog). Running the command manually works fine.
(the command being)
screen -L -d -m bash -c /home/vagrant/run_screen_server.sh
I've even gone to the point of nuking everything vagrant/virtualbox related on the system, making sure it's installing a clean, nightly box. Exactly the same source box works all the other machines.
Are there any other debugging steps I can be taking or is there something I'm missing?
I'm right now trying to do the same with my setup and hit the same problem.
Further testing has shown, that sleep 1 right after calling the screen helped. It seems the ssh script that ansible calls exits before the screen call is fully detached (or something else, that would explain that the sleep 1 helps)
I've also found Can't get Fabric's detached screen session example to work with the same suggestion.

How to enter and leave an existing screen through script?

I'm fairly new with Linux shell scripting but have several years experience using Linux(non-hardcore).
There is an application running on my server(accessing it through SSH/putty) which is a console one. In order to ensure that it will run even even if I close my ssh client(putty), I made it run though screen.
In my script, there is a part where I want to enter this specific screen and "leave a message", then leave the screen to proceed with other things it have to perform.
How to do it exactly? Thanks!
(the console application is actually a vanilla Minecraft server)
check out 'screen' window manager http://www.gnu.org/software/screen/ with session names, see the following article:
http://www.mattcutts.com/blog/a-quick-tutorial-on-screen/

Exiting an ongoing Node.js server in linux

When I run my node server node server.js through SSH, the server starts and operates properly, however, I am left at the command prompt on a blank line, and no matter what I try to do, I can't "escape" out of that back to root /]#. Is it necessary for me to terminate the session completely and rerun a new SSH session to be able to operate on the prompt again?
I'm sure this is a completely basic problem with a completely basic solution, I just can't for the life of me seem to "escape" out of this back to the command line. It would seem unlikely that it would be necessary to completely exit out of PuTTy and start a new session just to terminate it..
Going to post as an answer, have you tried pressing Ctrl + C or as Gabi mentioned, Ctrl + D, that usually exits most servers I start via the CLI.
You can use GNU Screen (quick reference here) to simultaneously work with multiple terminal interfaces within existing PuTTy session.

Resources