<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Devuan on SROEMER</title>
    <link>/tags/devuan/</link>
    <description>Recent content in Devuan on SROEMER</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <copyright>Stefan Römer</copyright>
    <lastBuildDate>Thu, 30 May 2024 23:31:00 +0700</lastBuildDate><atom:link href="/tags/devuan/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Radicale installation on Devuan Daedalus 5.0</title>
      <link>/posts/2024/05/radicale_installation/</link>
      <pubDate>Thu, 30 May 2024 23:31:00 +0700</pubDate>
      
      <guid>/posts/2024/05/radicale_installation/</guid>
      <description>&lt;p&gt;Since years I am running my own CalDAV / CardDAV server to synchronize my calendars and address books.
I use &lt;a href=&#34;https://radicale.org&#34;&gt;Radicale&lt;/a&gt; for this and on my Uberspace it was installed via Python&amp;rsquo;s &lt;code&gt;pip&lt;/code&gt;,
but now it was time to move this to my own server too and I chose to install the package directly from
the Devuan repository via &lt;code&gt;apt-get install radicale&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The installation via &lt;code&gt;apt-get&lt;/code&gt; just does the installation but some additional configuration was needed
to set everything up.&lt;/p&gt;</description>
      <content>&lt;p&gt;Since years I am running my own CalDAV / CardDAV server to synchronize my calendars and address books.
I use &lt;a href=&#34;https://radicale.org&#34;&gt;Radicale&lt;/a&gt; for this and on my Uberspace it was installed via Python&amp;rsquo;s &lt;code&gt;pip&lt;/code&gt;,
but now it was time to move this to my own server too and I chose to install the package directly from
the Devuan repository via &lt;code&gt;apt-get install radicale&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The installation via &lt;code&gt;apt-get&lt;/code&gt; just does the installation but some additional configuration was needed
to set everything up.&lt;/p&gt;
&lt;p&gt;At first I modified the configuration file &lt;code&gt;/etc/radicale/config&lt;/code&gt; and did set&lt;br&gt;
&lt;code&gt;type = htpasswd&lt;/code&gt; and &lt;code&gt;htpasswd_encryption = bcrypt&lt;/code&gt; (both in the &lt;code&gt;[auth]&lt;/code&gt; section).&lt;/p&gt;
&lt;p&gt;Then I created a new htpasswd file with my user:&lt;br&gt;
&lt;code&gt;htpasswd -c -B /etc/radicale/users &amp;lt;user&amp;gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Finally I started the service and enabled it to be started automatically:&lt;br&gt;
&lt;code&gt;/etc/init.d/radicale start&lt;/code&gt;&lt;br&gt;
&lt;code&gt;update-rc.d radicale enable&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;After this the radicale server is bound to localhost and listening on port 5232.
For being accessible from the outside the following configuration must be added to the Nginx configuration (and Nginx being restarted once):&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;location /radicale/ { # The trailing / is important!
      proxy_pass        http://localhost:5232/; # The / is important!
      proxy_set_header  X-Script-Name /radicale;
      proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header  Host $http_host;
      proxy_pass_header Authorization;
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Now I only had to copy contact and calendar entries from my Uberspace instance. Done!&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>Linux Containers (LXC) on Devuan Daedalus 5.0</title>
      <link>/posts/2023/10/lxc_on_devuan_linux/</link>
      <pubDate>Tue, 31 Oct 2023 16:38:00 +0700</pubDate>
      
      <guid>/posts/2023/10/lxc_on_devuan_linux/</guid>
      <description>&lt;p&gt;I started some investigation about how to run Linux Containers on Devuan Linux 5.0
(Daedalus), as I run it on my server. For this I first did set up a local VM which
replicates my virtual server. I use qemu for this and created a script called
&lt;a href=&#34;https://github.com/sroemer/dotfiles/blob/main/.local/bin/vm-netcup&#34;&gt;vm‑netcup&lt;/a&gt;
which is part of my &lt;a href=&#34;https://github.com/sroemer/dotfiles/&#34;&gt;dotfiles&lt;/a&gt; repository and
sets qemu parameters accordingly.&lt;/p&gt;
&lt;p&gt;Installation via &lt;code&gt;apt-get install lxc&lt;/code&gt; works as expected. So far so good - but things
should not go that smoothly for much longer.&lt;/p&gt;</description>
      <content>&lt;p&gt;I started some investigation about how to run Linux Containers on Devuan Linux 5.0
(Daedalus), as I run it on my server. For this I first did set up a local VM which
replicates my virtual server. I use qemu for this and created a script called
&lt;a href=&#34;https://github.com/sroemer/dotfiles/blob/main/.local/bin/vm-netcup&#34;&gt;vm‑netcup&lt;/a&gt;
which is part of my &lt;a href=&#34;https://github.com/sroemer/dotfiles/&#34;&gt;dotfiles&lt;/a&gt; repository and
sets qemu parameters accordingly.&lt;/p&gt;
&lt;p&gt;Installation via &lt;code&gt;apt-get install lxc&lt;/code&gt; works as expected. So far so good - but things
should not go that smoothly for much longer.&lt;/p&gt;
&lt;h4 id=&#34;cgroups&#34;&gt;cgroups&lt;/h4&gt;
&lt;p&gt;LXC relies on cgroups, a Linux kernel feature for isolation, limitation and accounting of
resource usage of processes. On distributions using systemd this is set up by systemd,
but with Devuan I chose to not use systemd.&lt;/p&gt;
&lt;p&gt;You guessed it: &lt;code&gt;lxc-checkconfig&lt;/code&gt; and &lt;code&gt;ls /sys/fs/cgroup&lt;/code&gt; show that cgroups are not set up
by default (at least not with my minimal installation). LXC can work with cgroups v1 but
cgroups v2 provide a cleaner, unified hierarchy and therefore are my preferred way.&lt;/p&gt;
&lt;p&gt;To mount the cgroup v2 filesystem at boot time, I simply created an additional entry in
the &lt;code&gt;/etc/fstab&lt;/code&gt; file:&lt;br&gt;
&lt;code&gt;none    /sys/fs/cgroup    cgroup2    defaults    0 0&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;In case you want to use cgroups v1 you can install the &lt;code&gt;cgroupfs-mount&lt;/code&gt; package which
installs a service to perform the required mounts at boot time.&lt;/p&gt;
&lt;p&gt;That&amp;rsquo;s all that is required to set up cgroups for LXC.&lt;/p&gt;
&lt;h4 id=&#34;unpriviledged-vs-priviledged-containers&#34;&gt;unpriviledged vs. priviledged containers&lt;/h4&gt;
&lt;p&gt;In short: We want unpriviledged containers whenever possible. Those map user ids inside the
container to a different range on the host and therefore are the safest option. For example
user id 0 (root) in an unpriviledged container would be mapped to user id 100000 on the host.
A user id 0 (root) on a priviledged container on the other hand also would be root on the
host.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;/etc/subuid&lt;/code&gt; and &lt;code&gt;/etc/subgid&lt;/code&gt; contain the ranges for mapping uid and gid on the host,
but those values also need to be reflected in the lxc configuration as described below.&lt;/p&gt;
&lt;h4 id=&#34;configuration&#34;&gt;configuration&lt;/h4&gt;
&lt;p&gt;For configuration LXC distinguishes between system and container configuration. See the
according man pages lxc.container.conf and lxc.system.conf for further information.&lt;/p&gt;
&lt;p&gt;By default LXC on my system used &lt;code&gt;~/.local/share/lxc/&lt;/code&gt; for container storage. This resulted
in LXC complaining about the users home directory not having x permission for the root user
of the container and starting the container failed.&lt;/p&gt;
&lt;p&gt;Therefore I decided to move the container storage to &lt;code&gt;/var/lib/lxc/&amp;lt;user&amp;gt;&lt;/code&gt;. This
directory needs to be created as root and owernship as well as permissions need to be set
as follows:&lt;br&gt;
&lt;code&gt;chown &amp;lt;user&amp;gt;:&amp;lt;group&amp;gt; /var/lib/lxc/&amp;lt;user&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;code&gt;chmod 711 /var/lib/lxc/&amp;lt;user&amp;gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Once this is done we can continue as regular user. We create a file &lt;code&gt;.config/lxc/lxc.conf&lt;/code&gt;
and configure the container storage path in it:&lt;br&gt;
&lt;code&gt;lxc.lxcpath = /var/lib/lxc/&amp;lt;user&amp;gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;/etc/lxc/default.conf&lt;/code&gt; contains the system wide container default configuration. We copy
this file to &lt;code&gt;~/.config/lxc/default.conf&lt;/code&gt; and modify it to create our user specific defaults.&lt;/p&gt;
&lt;p&gt;Be aware that this file only contains the default configuration used during creation of a
new container. Once created every container has its own configuration file in its according
folder within the container storage path.&lt;/p&gt;
&lt;p&gt;We now add the following lines for configuration of the uid and gid mapping. The values used
here must match the values defined in &lt;code&gt;/etc/subuid&lt;/code&gt; and &lt;code&gt;/etc/subgid&lt;/code&gt; for the according user:&lt;br&gt;
&lt;code&gt;lxc.idmap = u 0 100000 65536&lt;/code&gt;&lt;br&gt;
&lt;code&gt;lxc.idmap = g 0 100000 65536&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Additionaly we change the AppArmor profile as follows:&lt;br&gt;
&lt;code&gt;lxc.apparmor.profile = unconfined&lt;/code&gt;&lt;/p&gt;
&lt;h5 id=&#34;creating-a-new-container&#34;&gt;creating a new container&lt;/h5&gt;
&lt;p&gt;For creation of a new container we use the &lt;code&gt;lxc-create&lt;/code&gt; command. &lt;code&gt;lxc-create -t download -n &amp;lt;container-name&amp;gt;&lt;/code&gt;
is a good start and provides an interactive way to create a new container. In my case I want to
install the &lt;code&gt;3.18&lt;/code&gt; release for the &lt;code&gt;amd64&lt;/code&gt; architecture of the &lt;code&gt;alpine&lt;/code&gt; distribution.&lt;/p&gt;
&lt;p&gt;This all also can be packed into the command directly:&lt;br&gt;
&lt;code&gt;lxc-create -t download -n &amp;lt;container-name&amp;gt; -- --dist alpine --release 3.18 --arch amd64&lt;/code&gt;&lt;/p&gt;
&lt;h5 id=&#34;network&#34;&gt;network&lt;/h5&gt;
&lt;p&gt;With all this set up the container still fails to start because it cannot set up its network.
By default unprivileged containers cannot use any networking. We need to create an additional
configuration file &lt;code&gt;/etc/lxc/lxc-usernet&lt;/code&gt; as root. This file must have an entry to allow the
user to add veth devices - up to 16 in in my case - to the lxcbr0 bridge:&lt;br&gt;
&lt;code&gt;&amp;lt;user&amp;gt; veth lxcbr0 16&lt;/code&gt;&lt;/p&gt;
&lt;h5 id=&#34;using-the-container&#34;&gt;using the container&lt;/h5&gt;
&lt;p&gt;To start an already existing container the command &lt;code&gt;lxc-start -n &amp;lt;container-name&amp;gt;&lt;/code&gt; is used.
With everything I described above done the container does start without issues. Previously
appearing &lt;code&gt;tmpfs: Bad value for &#39;uid&#39;&lt;/code&gt; error message were related to the Devuan container
image used. The errors disappeared after I switched to using the Alpine Linux image.&lt;/p&gt;
&lt;p&gt;Once the container is running we can start a process in the container with &lt;code&gt;lxc-attach&lt;/code&gt;.
For example &lt;code&gt;lxc-attach -n &amp;lt;container-name&amp;gt; bash&lt;/code&gt; will provide shell access to the container.&lt;/p&gt;
&lt;p&gt;For stopping the container again we use &lt;code&gt;lxc-stop -n &amp;lt;container-name&amp;gt;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;In case the container isn&amp;rsquo;t running we directly can run a command in it with &lt;code&gt;lxc-execute&lt;/code&gt;.
For example &lt;code&gt;lxc-execute -n &amp;lt;container-name&amp;gt; bash&lt;/code&gt; will provide shell access as before.&lt;/p&gt;
&lt;h4 id=&#34;conclusion&#34;&gt;conclusion&lt;/h4&gt;
&lt;p&gt;I am not done with this topic yet but for now this is a good foundation and a playground to
further investigate if I want to run containers on the server. I might update this post at
some point if I have any points worth mentioning.&lt;/p&gt;
&lt;p&gt;Especially the network setup was barely touched here and could be a topic for a separate post
at some point. For now that&amp;rsquo;s it &amp;hellip;&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>I ordered a new virtual server</title>
      <link>/posts/2023/10/a_new_virtual_server/</link>
      <pubDate>Sat, 14 Oct 2023 00:00:00 +0700</pubDate>
      
      <guid>/posts/2023/10/a_new_virtual_server/</guid>
      <description>&lt;p&gt;After running my own server for some years in the past I did move on to using an &lt;a href=&#34;https://uberspace.de/&#34;&gt;Uberspace&lt;/a&gt;.
Uberspace as a hoster is great and offers a lot of flexibility but it has its limitations anyway (for example it is not
possible to run a VPN server). I am planning to run a VPN server and also like the admin work overall. So I ordered a
small virtual server (VPS 200 G10s) from &lt;a href=&#34;https://www.netcup.de/&#34;&gt;Netcup&lt;/a&gt; again.&lt;/p&gt;</description>
      <content>&lt;p&gt;After running my own server for some years in the past I did move on to using an &lt;a href=&#34;https://uberspace.de/&#34;&gt;Uberspace&lt;/a&gt;.
Uberspace as a hoster is great and offers a lot of flexibility but it has its limitations anyway (for example it is not
possible to run a VPN server). I am planning to run a VPN server and also like the admin work overall. So I ordered a
small virtual server (VPS 200 G10s) from &lt;a href=&#34;https://www.netcup.de/&#34;&gt;Netcup&lt;/a&gt; again.&lt;/p&gt;
&lt;h4 id=&#34;why-did-i-choose-netcup&#34;&gt;Why did I choose Netcup?&lt;/h4&gt;
&lt;p&gt;The answer to that is easy. It&amp;rsquo;s cheap and I did have some good experience with it already.
For 3.25 Euro/month I get a VPS with 2vCPUs, 2GB RAM and 40GB SSD. For the virtualization they use KVM and via the
web interface I can mount any ISO file and install whatever OS I like. The drawback of their cheap virtual servers
is the quite low minimum availability of just 99.6% but for my use case that&amp;rsquo;s not an issue.&lt;/p&gt;
&lt;h4 id=&#34;which-os-did-i-install&#34;&gt;Which OS did I install?&lt;/h4&gt;
&lt;p&gt;After initially even considering &lt;a href=&#34;https://www.gentoo.org/&#34;&gt;Gentoo&lt;/a&gt; Linux I quickly dropped that idea due to the
limitations of the virtual hardware. I then - after some research - did a kind of test installation of Alpine Linux.
It was the first time ever I used &lt;a href=&#34;https://www.alpinelinux.org/&#34;&gt;Alpine&lt;/a&gt; and I must say that I am pretty impressed
with it - especially due to its low footprint. Anyway I decided to stick with something I know better and trust a bit
more in the long term.&lt;/p&gt;
&lt;p&gt;I installed &lt;a href=&#34;https://www.devuan.org&#34;&gt;Devuan&lt;/a&gt; Linux - Devuan Daedalus 5.0.
For those who are not aware, Devuan is a fork of &lt;a href=&#34;https://www.debian.org&#34;&gt;Debian&lt;/a&gt; Linux which does not use systemd and
therfore I can count on the great selection of software available for Debian while still using the good old sysvinit.&lt;/p&gt;
&lt;p&gt;As always I did a minimal installation and add what is required for my needs from there. My base installation with
&lt;a href=&#34;https://nginx.org/&#34;&gt;Nginx&lt;/a&gt;, &lt;a href=&#34;https://certbot.eff.org/&#34;&gt;Certbot&lt;/a&gt; and unattended upgrades uses about 60MB of RAM.
A nice small footprint as well even if its not as small as Alpine Linux (but that&amp;rsquo;s expected).&lt;/p&gt;
&lt;h4 id=&#34;further-plans&#34;&gt;Further plans?&lt;/h4&gt;
&lt;p&gt;With Nginx and Certbot up and running I already moved the website on to the new server.
Additionally I want to install the following components:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://gitea.com/&#34;&gt;Gitea&lt;/a&gt; git server, bug tracker, etc.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://radicale.org/&#34;&gt;Radicale&lt;/a&gt; CalDAV and CardDAV server&lt;/li&gt;
&lt;li&gt;Mail server (probably &lt;a href=&#34;https://www.postfix.org/&#34;&gt;Postfix&lt;/a&gt; and &lt;a href=&#34;https://www.dovecot.org/&#34;&gt;Dovecot&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.wireguard.com/&#34;&gt;WireGuard&lt;/a&gt; VPN server&lt;/li&gt;
&lt;li&gt;&amp;hellip; and eventually more&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Regarding all this I am not in a hurry. For now I am using the Uberspace and my virtual server in parallel and before
installing any of those components I want to do some research about &lt;a href=&#34;https://linuxcontainers.org/&#34;&gt;Linux Containers&lt;/a&gt;.
So far I do not have experience with containers of any kind and I am not a huge fan of Docker and its approach of
isolating single applications. Linux Containers on the other hand are available on any Linux system, are OS-level
virtualization and do not rely on infrastructure controlled by a single company.
So my idea is to isolate some parts of my installation into Linux Containers (probably using Devuan images as well).
Therefore I should gain some flexibility when updating the main server OS and be able to move and update some parts
independently.&lt;/p&gt;
&lt;p&gt;In any case containers are an interesting topic and digging deeper into it will be worth it &amp;hellip;&lt;/p&gt;
</content>
    </item>
    
  </channel>
</rss>
