Skip to content

Extend Travis debug sessions

Last updated:

For debugging failing Travis builds there is a handy Debug build button that will re-run a build instance and supply an SSH session to it for investigating.

Unfortunately these will close within a few minutes and there may be special circumstances that require a bit more poking around.

To extend the time for the debugging session we can use screen and run a script that doesn’t exit. This will prevent terminating the ssh session until the script is stopped.

After triggering the debug run Travis will give you the host address you can SSH into:

Terminal window
ssh asdfjkhadgsfkjhg.tmate.io

Now start the screen session and run a long running command

Terminal window
screen -S wait
sleep 36000 # wait for 10h

Detach from screen session using Ctrl+a - d

Debug the build.

When done log back into screen session

Terminal window
screen -r wait

quit the sleep command using Ctrl+c, and quit screen session Ctrl+a - k - y.