How to restart x11/StumpWM from a different tty.

8 views
Skip to first unread message

Eric Ihli

unread,
Apr 7, 2020, 1:58:51 PM4/7/20
to stumpw...@nongnu.org
Sometimes my graphic environment locks up. I think this is a StumpWM issue since my keyboard and mouse continue to "work". I can move the mouse around and switch to a different tty using ctrl-alt-f<n>. But nothing works in the tty where I ran `startx`.

What can be done from a different tty to troubleshoot/fix the issue? I've tried `stumpish` from another tty but I get the error `xprop: unable to open display`.

Other possibly relevant info is that my `.xinitrc` launches StumpWM with `dbus-launch --with-exit-session --sh-syntax stumpwm`.

Thanks,
Eric

Ram Krishnan

unread,
Apr 7, 2020, 2:35:51 PM4/7/20
to Eric Ihli, stumpw...@nongnu.org
I've had moderate luck connecting via emacsclient and using slime to poke around stumpwm's state. This does require emacs to be running, listening on a server port and for stumpwm itself to accept slime connections.

Cheers,

-ram

Lionel Flandrin

unread,
Apr 7, 2020, 2:59:12 PM4/7/20
to Eric Ihli, stumpw...@nongnu.org
You can set the DISPLAY environment variable to connect to X from any terminal. In bash/zsh this should do the trick:

export DISPLAY=:0

Then your commands will work.

I have a dirty trick to handle WM crashes: instead of starting the stumpwm binary directly I use a shell script that does something like:

while [ ! -f /tmp/stopstump ]
do
     stumpwm
     sleep 1
done

This way if stumpwm crashes or freeze and I have have to kill it it's restarted automatically without killing my X session and running programs. If I really want to quit the WM and end the session I have to "touch /tmp/stopstump" first.

A bit ugly, but it served me well.

--
Lionel Flandrin


‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐

Eric S Fraga

unread,
Apr 8, 2020, 7:52:08 AM4/8/20
to stumpw...@nongnu.org
On Tuesday, 7 Apr 2020 at 18:58, Lionel Flandrin wrote:
> I have a dirty trick to handle WM crashes: instead of starting the
> stumpwm binary directly I use a shell script that does something like:

Thank you for this. Quite helpful as I've been having quite a few
stumpwm crashes lately. I'm using stumpwm from Debian bullseye as I
have not found the time to compile my own with the latest versions...

--
Eric S Fraga via Emacs 28.0.50 & org 9.3.6 on Debian bullseye/sid


Stefan Reichör

unread,
Apr 8, 2020, 10:39:03 AM4/8/20
to Lionel Flandrin, stumpw...@nongnu.org
Hi Lionel,

> You can set the DISPLAY environment variable to connect to X from any
> terminal. In bash/zsh this should do the trick:
>
> export DISPLAY=:0
>
> Then your commands will work.
>
> I have a dirty trick to handle WM crashes: instead of starting the
> stumpwm binary directly I use a shell script that does something
> like:
>
> while [ ! -f /tmp/stopstump ]
> do
> stumpwm
> sleep 1
> done
>
> This way if stumpwm crashes or freeze and I have have to kill it it's
> restarted automatically without killing my X session and running
> programs. If I really want to quit the WM and end the session I have
> to "touch /tmp/stopstump" first.
>
> A bit ugly, but it served me well.
>
> --
> Lionel Flandrin

That is a really nice idea. I was already using some tmux sessions that survived a stumpwm crash.
I remembered a tool that will do the restart of a crashed application: daemontools

- http://cr.yp.to/daemontools.html
- daemontools is a collection of tools for managing UNIX services.
- supervise monitors a service. It starts the service and restarts the service if it dies. Setting up a new service is easy: all supervise needs is a directory with a run script that runs the service.

# apt-get install daemontools

Now I use daemontools to restart stumpwm when it crashes. Perhaps this
is useful for somebody else as well:


Content of ~/supervise/stumpwm/run
<example>
#!/bin/sh
/home/stefan/prg/bin/stumpwm
</example>

* Run stumpwm through supervise
# supervise /home/stefan/supervise/stumpwm
# svstat ~/supervise/stumpwm
/home/stefan/supervise/stumpwm: up (pid 32536) 238 seconds
- Restart stumpwm
# killall stumpwm
- 'svc -k ~/supervise/stumpwm' does not work since it only kills the script.
Not sure why - perhaps because the script is restarted and exits since the window manager is already running
- Quit stumpwm to get back to the login manager (-x ... tell supervise to stop when stumpwm exits, -t ... send sigterm to stumpwm)
# svc -x ~/supervise/stumpwm
# svc -t ~/supervise/stumpwm
* Show status of my running supervised tools
# svstat ~/supervise/*


Stefan.

Lionel Flandrin

unread,
Apr 9, 2020, 9:29:51 AM4/9/20
to Eric Ihli, stumpw...@nongnu.org
By the way, if you use a similar script you probably want to add a "rm -f /tmp/stopstump" before the while loop, otherwise you won't manage to restart the WM if you use a login manager since the script will quit immediately. I noticed that the hard way...

--
Lionel Flandrin


‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
Reply all
Reply to author
Forward
0 new messages