See Ash Code logo See Ash Code

SSH authenticated. My shell startup hook was what hung.

Ashlynn Antrobus
• • 2 min read

SSH accepted my password and printed “Last login.” Then I got no usable prompt.

That already put the failure later than the network connection and authentication. I could reach the machine, and it had accepted the login. Something in starting the session still hadn’t completed as expected.

The cause was a Warp integration command I had added to .bashrc. Fixing it restored SSH access.

A dragon inside an open doorway looks at a ribbon tangled on a hallway hook.

Illustration: a snag after getting through the door.

The shell had startup work of its own

The command printed Warp’s SourcedRcFileForWarp hook sequence. It wasn’t ordinary text intended for the person logging in; it was terminal integration output.

Putting that output in general shell startup made the login depend on code intended for a particular terminal context. In the cleaned-up file, that section was conditional:

if [[ $TERM_PROGRAM = "WarpTerminal" ]]; then
  printf '\eP$f{"hook": "SourcedRcFileForWarp", "value": { "shell": "bash"}}\x9c'
fi

The snippet shows the relevant startup section from the incident. The useful fact is the observed repair: correcting the offending hook got me a prompt again. I didn’t need to change the router or make SSH authenticate a second time to solve it.

Follow the login stages

The path looked like:

TCP connection -> SSH authentication -> login/session setup
                                               |
                                               v
                                        start user shell
                                               |
                                               v
                                      .bashrc terminal hook

The login banner wasn’t proof that the last step had succeeded. It was evidence that several earlier steps had.

Cockpit also appeared to attribute an unexpectedly large amount of memory to sshd. I didn’t reproduce that figure when inspecting the processes afterward. It was a distraction from the startup command I could identify and repair.

That differs from the March OOM incident, where kernel logs supplied evidence of memory exhaustion. Similar symptoms don’t make the two incidents the same failure.

Cleaning up wasn’t a speed project

After restoring access, I simplified the startup file. It already returned early for noninteractive shells, so there was no reason to add another equivalent interactive check around every later section.

I also measured the initialization commands instead of assuming the eval calls were slow. The complete .bashrc source took 0.140 seconds in the reported check, and the individual completion and prompt setup commands were short.

My goal was a clean, understandable file. Those measurements didn’t justify turning the cleanup into a performance project.

In this case, SSH got as far as running my startup hook. In January’s PATH problem, the launcher had skipped setup the shell normally ran for me.

AA

Written by Ashlynn Antrobus

Software developer, author, and builder. Sharing technical lessons learned from building tools like Ebook2Text, IndexedDict, and rag-mcp, and navigating life as a programmer with dyslexia.