Open metasoarous opened 3 years ago
I have exactly the same problem. This issue is especially problematic if you automatically start tmux with your shell because it will prevent you from using your terminal. I think there should be a check that makes tmux-resurrect fail gracefully, e. g. something as simple as displaying a message like "Error: Could not load resurrect file. Starting new session instead ...".
I'm not sure why there are corrupted / zero-byte resurrect files in the first place, though. I think the underlying issue should be fixed as well.
Thanks for chiming in @ret2src. Glad I'm not the only one here. (misery loves company?)
I'd be pretty happy with that solution. I can't really think of a situation where I'd want an earlier version of the session (I probably wouldn't even notice). And if someone did, catching the warning would give them enough info to mess around with the last
pointer until they get what they want.
I definitely agree that fixing the underlying problem would be nice as well (if possible). In my case, I think there had been a hard reset or battery failure somewhere in the interim, so maybe there were some hanging file handles that didn't get closed out properly?
Thanks again
I got this problem today, when a colleague has restarted a server without noticing others, and now I cannot start tmux
(it exits immediately).
@dmitry-kabanov Delete the corrupted file and you should be good
Encountered the same issue today, thanks @metasoarous, you are a life saver.
rtmux() {
cd ~/.local/share/tmux/resurrect/ || exit # Your save path
find . | sort | tail -n 1 | xargs rm
find . -printf "%f\n" | sort | tail -n 1 | xargs -I {} ln -sf {} last
cd - || exit
}
This issue occurs periodically,I solved it with a simple shell command.
We have the same problem here: our last file is sometimes empty.
I've tried to diagnose it by trying to save my tmux several times, but I can't reproduce it. It seems to happen before I shut down my computer. The rest of the backups are ok.
I just had a problem where all of a sudden running
tmux
was immediately exiting with[exited]
. After a bit of digging around I realized that the~/.tmux/resurrect/last
file was pointing to an empty resurrect file! The fix was easy enough, but it took me quite a while to resolve this and was rather handicapped at the terminal until I did.I'm not sure why the resurrect file didn't save properly, and it may not even be possible to fix whatever the issue was. But I'm wondering if it would be possible to catch this edge case and present a prompt asking if the user would like to reload a different resurrect (perhaps the most recent non-empty) session. Even a warning that the resurrect file was empty and can't be loaded before exiting (with some tips on how to fix) would have saved me a ton of time. Is this something you'd consider?
Thanks for your time, and the awesome plugin!