title: The Hurd on Bare Metal Update
date: 2024-01-07 19:00
tags: Hurd
summary: X runs on the Hurd!
---

# Running the Hurd on Bare Metal

So apparently, you can run X on the Hurd, and I am currently daily
driving the Hurd.  It's not perfect.  Once a month or so the Hurd will
lock up completely, and I will have to hard shutoff the machine and
deal with filesystem corruption.  But it does work!  You will need to
read the whole [Debian wiki](https://www.debian.org/ports/hurd/hurd-install) page.  There are sections that mention how
to upgrade to the unstable distribution, setting up X, and the correct
upgrade procedure:

    # apt update
    # apt upgrade --without-new-pkgs
    # apt full-upgrade

Let's install some packages and set up X.

    # apt install i3 xinit pinentry-gnome3
    # Tell X to let any user startx (it is better to let only console
    # users to start X, but that is not working for me.
    # apt dpkg-reconfigure x11-common xserver-xorg-legacy

Create a keyboard shortcut to kill X, because X may get stuck.

    cat /etc/X11/xorg.conf.d/xorg-ctrl-backspace.conf
    
    Section "InputDevice"
            Identifier "Generic KeyBoard"
            Driver "kbd"
            Option "XkbOptions" "terminate:ctrl_alt_bksp"
    EndSection

If, I am running X, then the best way to shutdown the computer, is to
first kill X, then from the console execute `sudo halt`.  I tried to
issue `sudo halt` from an `xterm`, and that caused some filesystem
corruption on my `/home` partition.

So what works?

-   Emacs 29.1
    -   Gnus
    -   magit
    -   erc
    -   org-mode
-   git send-email
-   netsurf web browser

    I "ported" it via hard-coding `PATHMAX`, which is not an ideal
    solution, but at least I have a web browser that can render simple
    websites like Wikipedia.
-   ffmpeg

    I actually use `recordmydesktop --no-sound --fps 2` on the Hurd
    machine.  This does actually work.  I tried
    using ffmpeg on my Guix System to add audio to the file, but the
    audio is out of sync with the video.  I'm not sure why.
-   [terrible-mdns-responder](https://mail.gnu.org/archive/html/bug-hurd/2023-03/msg00021.html)

    Sergey created this as a way to easily ssh into his hurd box from a
    GNU/Linux machine.  I use it like so:  `ssh joshua@pippin.local`,
    and I can ssh into my Hurd machine without having to know its IP
    address.  It's pretty cool!
-   i3

    i3 is probably the slickest window manager out there!  Since the
    Hurd is currently X only, I might as well use something light-weight
    that I like.
-   pastebinit

    It would be nice if netsurf would work with a pastebin, but it's
    not.  So the `pastebinit` command works.
-   ikiwiki

    I can update the GNU Hurd wiki entirely using the Hurd.  That's
    awesome!

## **Gotchas**

There are some gotchas when running the Hurd.

If, `/home` or `/` are readonly, then X will refuse to start and will
not tell you why.  So, my `.bashrc` has this in it:

    cat .profile | grep -A 15 'tell me'
    
    # tell me if / or /home are writeable or not.
    echo -n '/ is '
    myroot=$(fsysopts / | awk '{ print $2 }')
    myroot=${myroot:2}
    echo $myroot
    echo -n '/home is '
    myhome=$(fsysopts /home | awk '{ print $2 }')
    myhome=${myhome:2}
    echo $myhome
    
    if [ $myhome == "writable" ]; then
        echo "starting X";
    else
        echo "NOT starting X";
    fi


When I have filesystem corruption, I need to umount `/` and `/home`
and run fsck on them.  Then reboot.  Most of the time the Hurd can
auto run fsck for you, but sometimes it is so bad that you must do it
yourself.

When you have to fsck the filesystem, here is how to do it. You have
to login via `root`, then `umount /home && umount /`. Then run
`fsck.ext2 /dev/hd0s1 && fsck.ext2 /dev/hd0s6`.  Now reboot.

I also cannot shutoff the machine from a terminal inside X.  I first
have to kill X, and then shutoff the machine from the console.

Also, `apt` is apparently not the best tool to install various
packages.  It is actually better to use `aptitude`.  `# apt install
elpa-magit` fails, but `#aptitude install elpa-magit` somehow works.
I do not know why.

This is kind of new, but `sudo` is failing:

    $ sudo ls
    malloc(): invalid size (unsorted)
    Aborted

I would love to get haunt running on the Hurd, and it does run!  But
it fails to build this blog.  At first it was that `guile-commonmark`
was not installed.  Then it was that haunt could not find
`guile-commonmark`.  The fix was pretty easy.  In the haunt source
code directory:

    $ export GUILE_LOAD_PATH=/usr/local/share/guile/site/3.0"
    $ ./configure

So that helped me build haunt correctly and it could find
guile-commonmark.  But then it needed guile-reader installed as well.
Now I can't build guile-reader.

    $ autoreconf -vif
    autoreconf: error: automake failed with exit status: 1
    
And of course the `./configure` in the guile-reader directory failed
too.

