Looping Through Line in a File in Bash

I wanted to install vim package on FreeBSD 13.0, and did so without realizing that there were over 86 additional dependency packages installed. This was done with pkg install -y vim command. Anyway, I wanted to clean up by removing vim and those dependencies after all this is a headless server. Removing vim package doesn’t remove the installed dependencies. Fortunately, I was able to copy and paste the names of dependency packages and save it to a file. My first thought was to just go through each line in that file and run pkg delete -y PACKAGE. In the past I needed to do similar thing in a bash script or command to loop through the content of a file per line. Guess what? I no longer remember how to do that. Hence I’m writing this post to remind my future self in case I need to do this similar thing again. ...

April 17, 2021 · 2 min · 226 words · kenno

Labeling an exFAT Partition File System

I just formatted an external drive with exFAT file system with the intention to share this drive between Windows/Linux/macOS. When the drive is mounted on my Fedora desktop, it shows as: /dev/sde1 on /run/media/kenno/E17F-B2B1 type exfat ()(rw,nosuid,nodev,relati...) I want to give it a name, so it’ll be mounted as: /run/media/kenno/DRIVE_NAME. On Linux system, we can use a tool called exfatlabel to get or set the exFAT file system. I already created a partition and format it (mkfs.exfat /dev/sde1) on /dev/sde1 partition. ...

April 10, 2021 · 1 min · 203 words · kenno

Work Around for Dracut and LUKS Issue on Pre-release Fedora 34

I’ve been running Fedora 34 pre-release version even before it became beta. Everything has been working so far until recently when a package dracut was updated from 0.58 to 0.58-1. What is dracut? Good question. It’s an initramfs infrastructure used on Fedora system. Find out more from Dracut. The issue that introduced in version 0.58-1 on F34 is that it prevents any machines that use LUKS encryption for root partition to boot. The issue has been reported here. As of today, there is not yet a fixed version of dracut for F34 yet. ...

April 10, 2021 · 2 min · 319 words · kenno

Clean Up Systemd Journal Logs

On my Fedora 33 system, the systemd journal is persistently logged. Over time, the size of the log accumulate quite a lot. # du -shx journal/ 4.2G journal/ I already cleaned up the log twice in the past, but I already forgot how to do it. To fix my short-term memory, I’m going to document how I do this by following this blog post Clear systemd journal. The command for cleaning up old logs is journalctl with the option --vaccume-time=OLDER_THAN_TIME. To read more about this, we can check the journactl manual page. (man journalctl and search for vacuume key word.) ...

March 26, 2021 · 1 min · 166 words · kenno

Create libvirt Virtual Network From an XML File

I have a need to setup a virtual network on a VM-host server. Usually, I just use the virt-manager gui application to create this task. However, I’d like to do this via command line this time. Why? Well, why not? It’s always fun to learn new thing. :) libvirt keeps network configuration in XML files under /etc/libvirt/qemu/networks/. Here is what I have on one of my machines: # ls -1 /etc/libvirt/qemu/networks/*xml /etc/libvirt/qemu/networks/classroom.xml /etc/libvirt/qemu/networks/default.xml /etc/libvirt/qemu/networks/kubernetes.xml /etc/libvirt/qemu/networks/minikube-net.xml /etc/libvirt/qemu/networks/other.xml /etc/libvirt/qemu/networks/storage.xml /etc/libvirt/qemu/networks/student.xml We can use also list all the available libvirt-related virtual networks using virsh command: ...

March 22, 2021 · 3 min · 543 words · kenno