You can not re-attach a process id. You need to reattach the corresponding session.tmux
So do . Pick whatever session you want to re-attach. Then do tmux ls to re-attach it to a new tmux instance and release it from the old one.tmux attach -d -t <session id>
Nice idea. I'd create a wrapper, say that would look
like this:/bin/my-screen
#!/usr/bin/env sh
screen -d -RR
Make it executable and add it to :/etc/shells
echo /bin/my-screen | sudo tee -a /etc/shells
Make it the default shell:
chsh --shell /bin/my-screen
Notice that some terminal emulators such as do not run shell
defined in xterm by default but they check /etc/passwd variable
first.$SHELL
You can try adding this to your :~/.screenrc
screen -X screen -d -RR
Notice however that there is a potential problem with that solution -
you won't be able to start at all if there are no existing
sessions screen could re-attach. That means that if you set your
screen as your default shell you won't be able to log into your
system.screen
Thanks. I found the problem. The tmux process were in D state, and I had no choice but to reboot the system. The problem came from kerberos ticket expiring after a while. And find a scripts that solves this problem: https://iain.cx/src/ktmux/