Debugging a Che workspace
To diagnose workspace startup failures and inspect failing postStart commands, start the workspace in debug mode to keep containers running after failure.
When debug mode is enabled:
-
If a
postStartlifecycle command fails, the container sleeps instead of terminating, giving you time to connect and inspect the failure. -
Logs from
postStartcommands are written to/tmp/poststart-stdout.txtand/tmp/poststart-stderr.txtinside the workspace container. -
The workspace deployment remains available for the duration of the configured
progressTimeout(default: 5 minutes) before scaling down.
-
A running Che instance.
-
Access to the Che dashboard.
Start a stopped workspace in debug mode:
-
In the Che dashboard, go to the Workspaces page.
-
Click the kebab menu (⋮) for the workspace you want to debug.
-
Select Open in Debug mode.
The workspace starts with the
controller.devfile.io/debug-startannotation set totrue, and the Logs tab opens.
Restart a running workspace in debug mode:
-
In the Che dashboard, go to the Workspaces page.
-
Click the kebab menu (⋮) for the running workspace.
-
Select Restart in Debug mode.
The workspace restarts with debug mode enabled, and the Logs tab opens.
Inspect a failing workspace:
-
Wait for the workspace to report a failure in the Logs tab. Look for error messages or status conditions indicating startup problems. If no failure occurs within the
progressTimeoutperiod (default: 5 minutes), the workspace will scale down automatically. -
Use
kubectlto exec into the workspace container:$ kubectl exec --namespace='<workspace_namespace>' \ deploy/workspace<workspace_id> -- /bin/bash -
Review the
postStartcommand logs:$ cat /tmp/poststart-stderr.txt $ cat /tmp/poststart-stdout.txt
-
In the Logs tab, verify that the workspace status conditions include the message
DevWorkspace is starting in debug mode. -
If a
postStartcommand fails, verify that the container remains running and that/tmp/poststart-stderr.txtcontains the failure details.
|
The Always use the dashboard actions described above to enable debug mode. |