<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Linux on Matus Stafura</title>
    <link>https://stafura.dev/tags/linux/</link>
    <description>Recent content in Linux on Matus Stafura</description>
    <generator>Hugo</generator>
    <language>en-US</language>
    <lastBuildDate>Thu, 16 Jul 2026 07:59:24 +0200</lastBuildDate>
    <atom:link href="https://stafura.dev/tags/linux/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Automatically Restart MariaDB on Crash in Ubuntu with systemd</title>
      <link>https://stafura.dev/auto-restart-mariadb-ubuntu-systemd/</link>
      <pubDate>Thu, 16 Jul 2026 07:59:24 +0200</pubDate>
      <guid>https://stafura.dev/auto-restart-mariadb-ubuntu-systemd/</guid>
      <description>&lt;h2 id=&#34;why-do-you-need-to-autorestart-db&#34;&gt;Why do you need to autorestart DB?&lt;/h2&gt;&#xA;&lt;p&gt;Database can crash from any problems like when the system runs out of memory, full disk and so on. And the website will be down until you notice it and restart the database manually.&lt;/p&gt;&#xA;&lt;p&gt;The bare minimum you can do is to set it to restart automatically in Linux with systemd.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Note that this will not start DB when it is manually stopped.&lt;/p&gt;</description>
    </item>
    <item>
      <title>How to Automatically Update a Git Repo on Login in Linux</title>
      <link>https://stafura.dev/how-to-automatically-update-a-git-repo-on-login-in-linux/</link>
      <pubDate>Tue, 16 Sep 2025 00:00:00 +0000</pubDate>
      <guid>https://stafura.dev/how-to-automatically-update-a-git-repo-on-login-in-linux/</guid>
      <description>&lt;h2 id=&#34;why-would-you-want-to-do-this&#34;&gt;Why would you want to do this?&lt;/h2&gt;&#xA;&lt;p&gt;Yeah, yeah, it happens even to the best of us.&lt;/p&gt;&#xA;&lt;p&gt;You start committing changes to your repo, and then you forget to push them.&lt;/p&gt;&#xA;&lt;p&gt;Then you go to another machine, and you realize that your repo is outdated.&lt;/p&gt;&#xA;&lt;p&gt;BRUH!&lt;/p&gt;&#xA;&lt;p&gt;To prevent this, you can easily set up a systemd user service that runs a script to &lt;code&gt;git pull&lt;/code&gt; your repo every time you log in.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Limiting resources with ulimit in Linux</title>
      <link>https://stafura.dev/limiting-processes-with-ulimit-in-linux/</link>
      <pubDate>Mon, 03 Feb 2025 00:00:00 +0000</pubDate>
      <guid>https://stafura.dev/limiting-processes-with-ulimit-in-linux/</guid>
      <description>&lt;h3 id=&#34;what-is-ulimit&#34;&gt;What is ulimit&lt;/h3&gt;&#xA;&lt;p&gt;&lt;code&gt;ulimit&lt;/code&gt; is a builtin shell command that allows us to restrict system resources, for example the number of processes, number of open files, maximum logins.&lt;/p&gt;&#xA;&lt;h3 id=&#34;display-the-limits&#34;&gt;Display the limits&lt;/h3&gt;&#xA;&lt;p&gt;The see the current resource limits for the logged-in user, run:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8be9fd;font-style:italic&#34;&gt;ulimit&lt;/span&gt; -a&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h4 id=&#34;example-output&#34;&gt;Example Output&lt;/h4&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;-t: cpu &lt;span style=&#34;color:#8be9fd;font-style:italic&#34;&gt;time&lt;/span&gt; &lt;span style=&#34;color:#ff79c6&#34;&gt;(&lt;/span&gt;seconds&lt;span style=&#34;color:#ff79c6&#34;&gt;)&lt;/span&gt;              unlimited&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;-f: file size &lt;span style=&#34;color:#ff79c6&#34;&gt;(&lt;/span&gt;blocks&lt;span style=&#34;color:#ff79c6&#34;&gt;)&lt;/span&gt;              unlimited&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;-d: data seg size &lt;span style=&#34;color:#ff79c6&#34;&gt;(&lt;/span&gt;kbytes&lt;span style=&#34;color:#ff79c6&#34;&gt;)&lt;/span&gt;          unlimited&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;-s: stack size &lt;span style=&#34;color:#ff79c6&#34;&gt;(&lt;/span&gt;kbytes&lt;span style=&#34;color:#ff79c6&#34;&gt;)&lt;/span&gt;             &lt;span style=&#34;color:#bd93f9&#34;&gt;8192&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;-c: core file size &lt;span style=&#34;color:#ff79c6&#34;&gt;(&lt;/span&gt;blocks&lt;span style=&#34;color:#ff79c6&#34;&gt;)&lt;/span&gt;         &lt;span style=&#34;color:#bd93f9&#34;&gt;0&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;-m: resident &lt;span style=&#34;color:#8be9fd;font-style:italic&#34;&gt;set&lt;/span&gt; size &lt;span style=&#34;color:#ff79c6&#34;&gt;(&lt;/span&gt;kbytes&lt;span style=&#34;color:#ff79c6&#34;&gt;)&lt;/span&gt;      unlimited&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;-u: processes                       &lt;span style=&#34;color:#bd93f9&#34;&gt;22678&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;-n: file descriptors                &lt;span style=&#34;color:#bd93f9&#34;&gt;2048&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;-l: locked-in-memory size &lt;span style=&#34;color:#ff79c6&#34;&gt;(&lt;/span&gt;kbytes&lt;span style=&#34;color:#ff79c6&#34;&gt;)&lt;/span&gt;  &lt;span style=&#34;color:#bd93f9&#34;&gt;735404&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;-v: address space &lt;span style=&#34;color:#ff79c6&#34;&gt;(&lt;/span&gt;kbytes&lt;span style=&#34;color:#ff79c6&#34;&gt;)&lt;/span&gt;          unlimited&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;-x: file locks                      unlimited&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;-i: pending signals                 &lt;span style=&#34;color:#bd93f9&#34;&gt;22678&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;-q: bytes in POSIX msg queues       &lt;span style=&#34;color:#bd93f9&#34;&gt;819200&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;-e: max nice                        &lt;span style=&#34;color:#bd93f9&#34;&gt;0&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;-r: max rt priority                 &lt;span style=&#34;color:#bd93f9&#34;&gt;0&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;-N 15:                              unlimited&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;setting-resource-limits&#34;&gt;Setting resource limits&lt;/h3&gt;&#xA;&lt;p&gt;If you want to limit the number of processes for a user&lt;/p&gt;</description>
    </item>
    <item>
      <title>How to Install and Configure Redis on a Separate DigitalOcean Droplet for Magento</title>
      <link>https://stafura.dev/how-to-install-and-configure-redis-on-a-separate-digitalocean-droplet-for-magento/</link>
      <pubDate>Thu, 23 Jan 2025 00:00:00 +0000</pubDate>
      <guid>https://stafura.dev/how-to-install-and-configure-redis-on-a-separate-digitalocean-droplet-for-magento/</guid>
      <description>&lt;p&gt;Install redis on separate droplet to offload Redis from the Magento monolith.&lt;/p&gt;&#xA;&lt;h3 id=&#34;create-a-droplet-for-redis&#34;&gt;Create a Droplet for Redis&lt;/h3&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s create a droplet for Redis in DigitalOcean (DO from now on).&lt;/p&gt;&#xA;&lt;p&gt;I chose the following minimal parameters (you can scale later):&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Basic Droplet&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Premium AMD&lt;/strong&gt;: 1GB RAM, 25GB NVMe SSD, 1000GB transfer.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;IMPORTANT: Make sure the new droplet is within the same VPC and Region as your Magento server.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;h3 id=&#34;redis-installation&#34;&gt;Redis installation&lt;/h3&gt;&#xA;&lt;p&gt;Once the droplet is successfully created, SSH into the droplet and install Redis:&lt;/p&gt;</description>
    </item>
    <item>
      <title>My first homelab</title>
      <link>https://stafura.dev/my-first-homelab/</link>
      <pubDate>Mon, 20 Jan 2025 00:00:00 +0000</pubDate>
      <guid>https://stafura.dev/my-first-homelab/</guid>
      <description>&lt;p&gt;Finally, I found the time to set up my first homelab. To get hands-on experience with advanced Linux topics, virtualization, and Kubernetes, I needed a dedicated server. The truth is, you don’t need anything fancy—an old laptop can work just fine. I opted for a mini version since I might need to carry it to different locations.&lt;/p&gt;&#xA;&lt;h3 id=&#34;specs&#34;&gt;Specs&lt;/h3&gt;&#xA;&lt;p&gt;Let me introduce the HP EliteDesk 800 i5-6500T. It&amp;rsquo;s second-hand but in excellent condition.&lt;/p&gt;</description>
    </item>
    <item>
      <title>How to download torrents with transmission and docker</title>
      <link>https://stafura.dev/how-to-download-torrents-with-transmission-and-docker/</link>
      <pubDate>Mon, 13 Jan 2025 00:00:00 +0000</pubDate>
      <guid>https://stafura.dev/how-to-download-torrents-with-transmission-and-docker/</guid>
      <description>&lt;p&gt;Since I set up &lt;a href=&#34;https://stafura.dev/my-first-homelab/&#34;&gt;my new homelab&lt;/a&gt;, I wanted to separate processes that could run independently on another PC. One of those processes is downloading torrents, which previously required my PC to be running and consumed valuable space.&lt;/p&gt;&#xA;&lt;h3 id=&#34;requirements&#34;&gt;Requirements&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;docker installed&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;installation&#34;&gt;Installation&lt;/h3&gt;&#xA;&lt;p&gt;Create a file named &lt;code&gt;docker-compose.yaml&lt;/code&gt; and add the following content:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;---&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ff79c6&#34;&gt;services&lt;/span&gt;:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#ff79c6&#34;&gt;transmission&lt;/span&gt;:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#ff79c6&#34;&gt;image&lt;/span&gt;: lscr.io/linuxserver/transmission:latest&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#ff79c6&#34;&gt;container_name&lt;/span&gt;: transmission&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#ff79c6&#34;&gt;environment&lt;/span&gt;:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      - PUID=1000&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      - PGID=1000&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      - TZ=Etc/UTC&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#ff79c6&#34;&gt;volumes&lt;/span&gt;:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      - ./config:/config&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      - ./downloads:/downloads&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      - ./watch:/watch&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#ff79c6&#34;&gt;ports&lt;/span&gt;:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      - &lt;span style=&#34;color:#bd93f9&#34;&gt;9091&lt;/span&gt;:&lt;span style=&#34;color:#bd93f9&#34;&gt;9091&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      - &lt;span style=&#34;color:#bd93f9&#34;&gt;51413&lt;/span&gt;:&lt;span style=&#34;color:#bd93f9&#34;&gt;51413&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      - &lt;span style=&#34;color:#bd93f9&#34;&gt;51413&lt;/span&gt;:&lt;span style=&#34;color:#bd93f9&#34;&gt;51413&lt;/span&gt;/udp&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#ff79c6&#34;&gt;restart&lt;/span&gt;: unless-stopped&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;running-transmission&#34;&gt;Running transmission&lt;/h3&gt;&#xA;&lt;p&gt;While in the folder containing the &lt;code&gt;docker-compose.yaml&lt;/code&gt; file, start the container. The volumes will be automatically created.&lt;/p&gt;</description>
    </item>
    <item>
      <title>How to install man pages on an ubuntu docker image</title>
      <link>https://stafura.dev/how-to-install-man-pages-on-an-ubuntu-docker-image/</link>
      <pubDate>Thu, 19 Dec 2024 00:00:00 +0000</pubDate>
      <guid>https://stafura.dev/how-to-install-man-pages-on-an-ubuntu-docker-image/</guid>
      <description>&lt;p&gt;As I am preparing for a Linux exam, I need to practice various commands on a separate Docker image and refer to manuals while using it.&lt;/p&gt;&#xA;&lt;p&gt;By default, Docker images are minimal, and the Ubuntu image does not include &lt;code&gt;man&lt;/code&gt; pages.&lt;/p&gt;&#xA;&lt;p&gt;For instance, when you try to access a manual page, you encounter the following message:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@54354b49f7a9:/# man man&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;This system has been minimized by removing packages and content that are&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;not required on a system that users &lt;span style=&#34;color:#ff79c6&#34;&gt;do&lt;/span&gt; not log into.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;To restore this content, including manpages, you can run the &lt;span style=&#34;color:#f1fa8c&#34;&gt;&amp;#39;unminimize&amp;#39;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;command. You will still need to ensure the &lt;span style=&#34;color:#f1fa8c&#34;&gt;&amp;#39;man-db&amp;#39;&lt;/span&gt; package is installed.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;To address this, you can use the &lt;code&gt;unminimize&lt;/code&gt; command in the Dockerfile to restore the missing components. Here&amp;rsquo;s how:&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
