Publish 'Reconnect to broken tmux session'

This commit is contained in:
timvisee 2021-02-28 20:26:45 +01:00
parent d73481e913
commit 12c231755b
No known key found for this signature in database
GPG Key ID: B8DB720BC383E172
1 changed files with 5 additions and 9 deletions

View File

@ -2,15 +2,11 @@
title = "Reconnect to broken tmux session"
description = "Reconnect to a running tmux session, that tmux fails to connect to."
# TODO: remove to release
draft = true
[taxonomies]
categories = ["guide", "blog"]
tags = ["tmux"]
[extra]
comments = true
zenn_applause = true
+++
@ -35,10 +31,10 @@ All your tmux sessions are hosted by a single tmux process. This is persistent
and keeps running until you quit all sessions again.
The process creates a socket file, other processes use this to talk to it. When
you invoke `tmux attach`, the program finds this socket, and attaches to session
you invoke `tmux attach`, the program finds this socket and attaches to it
through the socket.
Now what happens when you delete this file? Exactly, your `tmux` command doesn't
Now, what happens when you delete this file? Exactly, your `tmux` command doesn't
know how to connect to the running server. That's what we're seeing here.
## Recreate socket
@ -46,7 +42,7 @@ Because others had the same issue, tmux provides a feature to fix this. When you
send the `SIGUSR1` signal to the host process, it creates a fresh socket file
for you.
For this you need to find the PID of the running tmux server. Find it through
For this, you need to find the PID of the running tmux server. Find it through
your task manager, or invoke the following command to list all running tmux
programs. The first line is probably your server, the first number on that line
is the PID you'll need:
@ -57,8 +53,8 @@ ps kstart_time -ef | grep tmux
# timvisee 913216 911044 0 21:22 pts/5 S+ 0:00 grep tmux
```
For me it was `5612`, so I invoke the following and attach again (be sure to use
your own PID):
For me it was `5612`, so I invoke the following and attach it again (be sure to
use your own PID):
```bash
sudo kill -SIGUSR1 5612