<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"><title>GNUcode.me</title><id>https://gnucode.me/feeds/tags/hurd Debian.xml</id><subtitle>Tag: hurd Debian</subtitle><updated>2024-05-01T13:21:27Z</updated><link href="https://gnucode.me/feeds/tags/hurd Debian.xml" rel="self" /><link href="https://gnucode.me" /><entry><title>The Hurd on Bare Metal</title><id>https://gnucode.me/the-hurd-on-bare-metal.html</id><author><name>Joshua Branson</name><email>jbranso@dismail.de</email></author><updated>2023-08-13T14:00:00Z</updated><link href="https://gnucode.me/the-hurd-on-bare-metal.html" rel="alternate" /><content type="html">&lt;p&gt;This blog post was written on a Debian GNU/Hurd system on a IBM ThinkPad T43
with 1.5 GB of RAM. (It was edited on Guix System (running linux)). Apparently
running Emacs on the hurd in the console is actually quite stable. This post
will describe my attempt to make this T43 be my daily laptop. Let’s see
how far I can get with that eh?&lt;/p&gt;&lt;p&gt;tl;dr  Debian GNU/Hurd is shockingly stable.  If you are an emacs wiz,
then you will feel right at home.&lt;/p&gt;&lt;p&gt;The first thing to notice after you login to the Hurd is that you can
easily switch virtual consoles via &lt;code&gt;Alt-&amp;lt;right-arrow&amp;gt;&lt;/code&gt;.  It is
actually pretty awesome that you can do this.  I know literally every
other OS has this, but it is cool to have Emacs open in one console,
and have another program running on another console;  switching
between them feels beautiful.&lt;/p&gt;&lt;p&gt;Another thing to notice is that &lt;code&gt;mount&lt;/code&gt; does not work. Let's explore that shall
we?&lt;/p&gt;&lt;pre&gt;&lt;code&gt;cat /etc/mtab | awk '{ print $1 &amp;quot; &amp;quot; $2 &amp;quot; &amp;quot; $3 }'

/dev/hd0s1 / ext2fs
none /run /hurd/tmpfs
none /run/lock /hurd/tmpfs
/dev/hd0s6 /home /hurd/ext2fs
proc /proc /hurd/procfs&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Actually &lt;code&gt;/etc/mtab&lt;/code&gt; is a symlink to &lt;code&gt;/proc/mounts&lt;/code&gt;.&lt;/p&gt;&lt;pre&gt;&lt;code&gt;ls -lha /etc/mtab

lrwxr-xr-x 1 root root 12 Apr 10 12:14 /etc/mtab -&amp;gt; /proc/mounts&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;It looks like the Hurd labels MBR partitions slightly differently from Linux. It
appears that the Hurd uses &lt;code&gt;/dev/hd0s1&lt;/code&gt;, &lt;code&gt;dev/hd0s2&lt;/code&gt;, and so on.&lt;/p&gt;&lt;pre&gt;&lt;code&gt;echo $pw | sudo -S fdisk -l /dev/hd0

Disk /dev/hd0: 37.26 GiB, 40007761920 bytes, 78140160 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x1ab32a1b

Device     Boot    Start      End  Sectors  Size Id Type
/dev/hd0s1          2048 26681343 26679296 12.7G 83 Linux
/dev/hd0s2      26683390 78139391 51456002 24.5G  5 Extended
/dev/hd0s5      26683392 28682239  1998848  976M 82 Linux swap / Solaris
/dev/hd0s6      28684288 78139391 49455104 23.6G 83 Linux&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;It looks like a good place to start learning how to use the Hurd is
via &lt;code&gt;https://www.debian.org/ports/hurd/hurd-install&lt;/code&gt;.&lt;/p&gt;&lt;p&gt;So the file that describes my network interfaces is here:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;cat /etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto /dev/eth0
iface /dev/eth0 inet dhcp&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;So it looks like i should definitely read &lt;code&gt;man 5 interfaces&lt;/code&gt; at some
point.  And the Debian Hurd guide mentions that I should add name
servers to my /etc/resolv.conf file.  I am not certain why it says
that I should do that though, but I went ahead and added OpenDNS’ name
servers.&lt;/p&gt;&lt;pre&gt;&lt;code&gt;cat /etc/resolv.conf

nameserver 172.16.112.1

cat /etc/resolv.conf

nameserver 172.16.112.1
nameserver 208.67.222.222
nameserver 208.67.220.220&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Ok, so it seems like &lt;code&gt;pfinit&lt;/code&gt; is still the default GNU Hurd &lt;code&gt;TPC/IP&lt;/code&gt;
translator, which is based on an old Linux TCP/IP driver (&lt;code&gt;lwip&lt;/code&gt; or
&lt;code&gt;rumpkernel&lt;/code&gt; may one day replace it).  Apparently my internet
connectivity can be found by quering &lt;code&gt;/servers/socket/2&lt;/code&gt; (for IPv4)
and &lt;code&gt;/servers/socket/26&lt;/code&gt; (for IPv6).&lt;/p&gt;&lt;pre&gt;&lt;code&gt;# fsysopts /servers/socket/2&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you run the above command you will see that the ethernet device
that the Hurd uses is &lt;code&gt;/dev/eth0&lt;/code&gt;.&lt;/p&gt;&lt;p&gt;The Hurd has a stateless (stateful is better) ethernet filter. For example, here
is how to disable ssh access:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;# settrans -c /dev/eth0f /hurd/eth-filter \
           -i /dev/eth0 -r &amp;quot;not port 22&amp;quot;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;I could then, tell the pfinit translator to use &lt;code&gt;/dev/eth0f&lt;/code&gt; instead
of &lt;code&gt;/dev/eth0&lt;/code&gt; via (I think this how you would do it):&lt;/p&gt;&lt;pre&gt;&lt;code&gt;# fsysopts /server/socket/2 --interface=/dev/eth0f&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This is course is not persistant across reboots.  I would probably
need to replace &lt;code&gt;/dev/eth0&lt;/code&gt; in &lt;code&gt;/etc/network/interfaces&lt;/code&gt; with
&lt;code&gt;/dev/eth0f&lt;/code&gt;.&lt;/p&gt;&lt;p&gt;The Hurd lets you mount cd drives as a regular user. I should be able
to look at the files in my CD drive via:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;cd /dev
# ./MAKEDEV cd0
# settrans /media/cdrom0 /hurd/is09660fs /dev/cd0
$ cd /media/cdrom0&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Apparently the Hurd does have a network filesystem translator
(&lt;code&gt;/hurd/nfs&lt;/code&gt;), but I believe that that translator only supports
NFSv2.  So it may not be as performanent as one might want or support
the latest NSF features.&lt;/p&gt;&lt;p&gt;Since I installed the stable Hurd release from 2021, the guide
recommends that if I want a stable environment, then I can just
configure apt to use the apt sources from 2021.  That should let me
have a fairly stable Hurd distro.  So let’s try that.&lt;/p&gt;&lt;pre&gt;&lt;code&gt;cat /etc/apt/apt.conf.d/99ignore-valid-until

Acquire::Check-Valid-Until &amp;quot;false&amp;quot;;

cat /etc/apt/sources.list

deb [trusted=yes] https://snapshot.debian.org/archive/debian-ports/20210812T100000Z sid main
deb [trusted=yes] https://snapshot.debian.org/archive/debian-ports/20210812T100000Z unreleased main
deb-src [trusted=yes check-valid-until=no] https://snapshot.debian.org/archive/debian/20210812T100000Z sid main&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This mostly worked, but apt gave a warning about the debian gpg key
had expired.&lt;/p&gt;&lt;p&gt;Well let’s try to upgrade anyway.&lt;/p&gt;&lt;pre&gt;&lt;code&gt;# apt update &amp;amp;&amp;amp; apt upgrade&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;That seemed to work.&lt;/p&gt;&lt;pre&gt;&lt;code&gt;# apt install debian-ports-archive-keyring
# apt update
# apt upgrade

# apt install git git-email
$ git config --global user.name &amp;quot;Joshua Branson&amp;quot;
$ git config --global user.email &amp;quot;jbranso@dismail.de&amp;quot;
$ cd; git clone https://notabug.org/jbranso/prog&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Now I suppose that it is time to follow &lt;a href=&quot;https://drewdevault.com/2019/12/30/dotfiles.html&quot;&gt;Drew Devault’s guide&lt;/a&gt; on how to
manage your home directory’s configuration files as a git repository.&lt;/p&gt;&lt;p&gt;I should also read the &lt;a href=&quot;https://www.debian.org/ports/hurd/hurd-doc-translator&quot;&gt;hurd-doc-translator&lt;/a&gt; webpage.&lt;/p&gt;&lt;p&gt;Apparently, the Hurd’s translators transform data into different data.
The usual case, is that a translator translates bits of the filesystem
into different data, and what is awesome is that translators run in
userspace.  Most of the time translators will need to get data from
hardware, and they will request the kernel to help them get this data.
There are some exceptions: &lt;code&gt;/dev/zero&lt;/code&gt; does not need hardware data, so
a read from &lt;code&gt;dev/zero&lt;/code&gt; is entirely run in userspace.&lt;/p&gt;&lt;p&gt;There are two kinds of translators: active and passive.  An active
translator is currently running.  You can change its settings or kill
it via the &lt;code&gt;settrans -a&lt;/code&gt; command.  The &lt;code&gt;-a&lt;/code&gt; refers to the &lt;strong&gt;active&lt;/strong&gt;
translator.  So &lt;code&gt;settrans -a file.txt&lt;/code&gt; will try to kill the userspace
translator process.  If you start a translator via the &lt;code&gt;-a&lt;/code&gt; option,
then the translator is not persistant accross reboot. For that reason,
most of the time you do not want the &lt;code&gt;-a&lt;/code&gt; option, which is what
settrans by default does.&lt;/p&gt;&lt;p&gt;If you are ever curious to know if a filesystem node has an attached translator,
then you can find out via this command:&lt;code&gt;showtrans NODE&lt;/code&gt;. It will tell you what
passive translators are set at a filesystem node.&lt;/p&gt;&lt;p&gt;Let's take a walk through some basic Hurd translators.&lt;/p&gt;&lt;pre&gt;&lt;code&gt;settrans [OPTIONS...] NODE [TRANSLATOR ARGS...]&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;For example, I can have a text file like so:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;cat ~/Documents/hello.txt

boring text document.&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Now let’s set the &lt;code&gt;hello&lt;/code&gt; translator on that filesystem node.&lt;/p&gt;&lt;pre&gt;&lt;code&gt;settrans -a ~/Documents/hello.txt /hurd/hello

cat ~/Documents/hello.txt

Hello, world!&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Now let’s see that the file system options are for the &lt;code&gt;/hurd/hello&lt;/code&gt;
translator:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;fsysopts ~/Documents/hello.txt

/hurd/hello --contents='Hello, world!
'&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;I can modify the &lt;code&gt;contents&lt;/code&gt; of the hello translator via:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;fsysopts ~/Documents/hello.txt  --contents=&amp;quot;Hello Joshua
&amp;quot;

cat ~/Documents/hello.txt

Hello Joshua&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Notice that we changed the options for that translator without having
to restart it with normal user privledges.&lt;/p&gt;&lt;p&gt;Now let’s make the hello translator go away:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;settrans -a ~/Documents/hello.txt

cat ~/Documents/hello.txt

boring text document.&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Now let’s try to stack these translators eh?&lt;/p&gt;&lt;pre&gt;&lt;code&gt;settrans gnucode.me /hurd/httpfs http://gnucode.me

ls gnucode.me/installing-wordpress.html

gnucode.me/installing-wordpress.html

settrans -c xml /hurd/xmfls ~/gnucode.me/feed.xml
cd
ls&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Here the ls command apparently hanged.  &lt;code&gt;C-c&lt;/code&gt; ended said hanging, but
the Hurd locked up on me.  I actually saw an error message that said
something like “kbd queue full.”  And then my keyboard become
unresponsive.  After a few hours, I pressed “Ctrl-Alt-Del,” and that
saved my bacon.  That killed the hurd console, and it let me switch to
a virtual console.  That enabled me to shut down the hurd gracefully.
BUT…What went wrong?  Why did &lt;code&gt;ls&lt;/code&gt; hang?&lt;/p&gt;&lt;p&gt;Well here is a clue:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;ls ~/gnucode.me/feed.xml

ls: cannot access feed.xml': No such file or directory&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Well, httpfs does not expose feed.xml. It does not recognize that as part of the
gnucode.me website. &lt;code&gt;httpfs&lt;/code&gt; only lists webpages that are listed on
&lt;code&gt;index.html&lt;/code&gt;. So &lt;code&gt;~/gnucode.me/feed.xml&lt;/code&gt; does not translate to the local the
filesystem. If I had to guess, I would say that xmlfs tries to run but does not
check if its underlying file exists.&lt;/p&gt;&lt;p&gt;I should also mention that I am using a very minimal &lt;code&gt;.emacs.d/init.el&lt;/code&gt;. It is
possible to get doom emacs to run on the Hurd, but the last time that I tried
it, emacs locked up on me. I was forced to do a hard shutdown, which resulted in
filesystem corruption and I had to re-install. So for now, I am using a very
simple and minimal emacs. You can actually install some emacs packages via apt.
Just search for &lt;code&gt;apt search magit&lt;/code&gt; to get you started.&lt;/p&gt;&lt;p&gt;I would like to try running i3 on the hurd at some point, because that
is a very light-weight window manager, but I have not yet tried
setting up X to run.  Partly because I only have 1.5GB of RAM, and I
have heard that X tends to lock up or be really slow on the Hurd.&lt;/p&gt;&lt;p&gt;Surprizingly the Hurd only uses about &lt;code&gt;161MB&lt;/code&gt; of RAM, when I run emacs
on the console.&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;What I have done so far&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;Emacs
I would love to remap control and caps, but I am not certain how
to do that in the console.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Irc (via Erc)&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Gnus my email client
But I still need to set up the ability to send email.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Packages to install (glibc-doc-reference) requires enabling non-free
packages:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;# apt install gnupg emacs surfraw msmtp glibc-doc glibc-doc-reference&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Trying to create/open a file in emacs that ends in *.gpg crashes
Emacs.  I have no idea why.&lt;/p&gt;&lt;p&gt;Currently, msmtp cannot securely send email, because it cannot decrypt
the encrypted file that has my password.&lt;/p&gt;&lt;p&gt;My Hurd machine also has my “jbranso@dismail.de” gpg key. I was able
to import the data via an ssh session.&lt;/p&gt;&lt;p&gt;I was actually surprized that the debian wiki mentioned this command:
&lt;code&gt;service ssh restart&lt;/code&gt; and not a systemd specific command, but
apparently &lt;code&gt;man service&lt;/code&gt; is the manual that I want to read.
Apparently ssh is already running.  I verified this with:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;echo $pw1 | sudo -S service --status-all | grep ssh

[ + ]  ssh&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;I really should set up Sergey's terrible MDNS responder, so that I can ssh in
the Hurd more easily, but that is a task that I will set for a later date. I
should also possibly update my hard drive to a larger drive. I think the current
one has 100GB or so. Maybe less. And it might not be a bad idea to set up an SSD
or DVD drive via the CD-ROM bay and try the rumpdisk out. I would also like to
be able to publish my blog from the Hurd too, but I have been unsuccessful to
install Haunt on my Hurd box. I should also try to install Guix on it, but I am
concerned about hard drive space at the moment.&lt;/p&gt;&lt;p&gt;Anyway, you can take a look at my &lt;a href=&quot;https://notabug.org/jbranso/hurd-home&quot;&gt;hurd
home&lt;/a&gt; git directory if you like. Safe
travels!&lt;/p&gt;</content></entry></feed>