Subsections of
Posts
Subsections of Posts
life
- My Linux story
Unknown Author|June 6, 2023
- Agree to Disagree
Unknown Author|April 16, 2024
Unknown Author|June 6, 2023
Unknown Author|April 16, 2024
Subsections of life
Agree to Disagree
Why Am I Writing This ?
Recently I received a comment on a video I made for my YouTube channel, the comment was not about the video itself but rather something I said in the video that this person disagreed with. Now let me start by saying that I 100% believe that it is ok to disagree with someone, difference of opinion is a good thing, it helps keep things interesting.
I wanted to share this experience, or conversation, or interaction (whatever you want to call it) not as a negative, but as a positive. Far too many times I have seen others, or even been nyself, on the receiving end of a verbal onslaught because someone disagreed with something that was said. I have been called names, been made fun of, or treated like I was stupid and much more, simply for having a different opinion on something. Now does this bother me, no, not personally anyway, I don’t usually take offense when this happens because their actions and words speak more of them and what is going on in their life than it does about me. What bothers me is that it is getting to the point where to disagree with someone is an offense that warrants this type of behavior, and all words that they feel like spewing or actions they feel like taking are justified in their minds.
Now I want to make it perfectly clear, that the gentleman I am writing this about was not rude, or angry, or dismissive in any way, he simply did not agree with what I said and he wanted to know why I felt this way. That being said, I wanted to share this interaction because while it did not end in one of us changing our minds or opinions, we both were able to voice some of our thoughts, and then politely go on about our lives with no added negativity, and that is an outcome that is becoming less and less common in today’s world.
The Statement I Made
So what was it that I said that he disagreed with? Well, it is pretty simple, I said that “I am a firm believer that distribution doesn’t matter”. That’s it, that is all I said, distribution doesn’t matter. This is not an earth shattering idea, nor is it an attack on those who believe otherwise, it is strictly my opinion and I voiced it because, like everyone in the world, I have the right to my opinion and the right to voice that opinion.
This gentleman, who was watching my video, heard me say this, and instead of immediately attacking me or telling me how dumb or stupid my opinion is, and even instead of telling me I am wrong, simply commented with his opinion, and then offered me the opportunity to have a conversation with him about it.
I gladly accepted his offer.
Our Comment Exchange
(the following comments are copied verbatim, typos and all)
His Initial Comment
“Distro’s do matter…You can ask me why if you want…I’ve been here a lot longer than you Jake so I’m intrigued why you think one distro is the same as another”
My Response
“I appreciate you taking the time to comment, I don’t think they are all the same, but i do think that if you are willing to take the time and put in the work, you can make any distro you choose work the way you want it to. I know they have their differences and there are some specialty distros out there so I don’t think that they are the same, just similar enough to be functional and work for you no matter which one you choose.”
Him
“First of all Debian is different to Fedora is different to Arch is different to Gentoo.. Here’s the thing packages each of these use different package management and what’s available on one may not be available on another..Secondly each of them work differently..I’ve listened to Chris Titus saying like you they’re all the same..They def are not.. In fact if that was the case then any company using Linux would use all of them and they don’t.. I could go into this and it would take several A4’s to explain.. So I use Arch without sysd and no I don’t use Artix.. Each Linux system, not distro, gives you different freedom and experience.. If you’ve been here as long as I have you might understand!!! 🙂”
Me
“I know that they use different package managers and some software may not be in another distros repo and so forth, and there are different init systems and that there can be differences in the file structure of one distro when compared to another, all that still does not make them so different that I can’t do with one distro what I can do with another. All I am saying is that the differences between distros is not enough to make it so you can’t do something with one that can with another, for the most.part, as long as you are willing to put in the work. For example, I use Void Linux, I could switch to Debian and have pretty much the exact same system, same functionality on the user end, same types of software and programs(maybe not the exact software but at least something that would perform the task I need it to), same workflow, etc. I’m not trying to argue with you so I hope it does not come across that way, I appreciate your insight and always like hearing other people’s thoughts on a subject.”
Him
“I’ve used Void in fact I built my own system LFS+ So I’m going to say this again. Each system uses different resources.Each system behaves differently. Jake I’ve done this for ages and I wish you well and I’m happy you use Linux.. But all are not the same in fact they are so different.. Just be good and enjoy 🙂”
Outcome and Final thought
The outcome of this very short conversation was that we both held to our opinions, neither one of us changed our minds but we both heard another point of view and were able to politely engage with each other about a topic and maintain civility even in the face of disagreement.
So while I do believe this gentleman misunderstood what I was saying, he felt I was declaring all distros the same, when in fact that is not at all what I was saying, I was happy with the dialog we were able to have via the YouTube comments section, I am happy he was polite and respectful and I hope he feels I was the same. I want to thank him for taking the time to comment and reply and for the respect and decency he showed.
So in conclusion, be kind, be understanding, listen to hear, not just to respond, and remember it is ok if someone disagrees with you, if we all had the same opinion the world would be a pretty boring place.
God Bless.
My Linux story
How I Got Started with Linux
I have been running Linux now for about four years or so, and in that time (really it was within the first few months), I realized one thing: Windows sucks. I will never return to Windows. Sure, I have a Windows partition on my system at the moment, but only because I have to use it for my software engineering degree. Once that is finished, Windows will be gone forever.
So, what got me to switch? Let’s go back to the beginning.
From Automotive Tech to Linux Explorer
I was not a computer fan at all. We had a home computer, but it was used for online banking, email, my kids’ homeschool work, and some mild gaming (my kids, not me—I’m not much for anything beyond NES or SNES).
As an automotive technician, a lot of my resources were shifting from books to being accessible only through computers. So, I bought a laptop to access wiring diagrams, repair manuals, and that sort of thing. My laptop came with Windows (as they all do), and so that’s what I used. I hated it.
As much as I disliked using Windows, it was what I had and all I knew, so that was that.
A DIY Spirit Awakens
One day, I watched my kids playing a video game, and being the do-it-yourselfer that I am, I thought, “I bet I could make a video game.” I told my kids my plan and set to work to make the best video game ever made.
Once I started, I realized what I had gotten myself into and quickly found myself on YouTube, watching tutorials on basic coding and game engines. While watching, I noticed something different about some of the creators’ systems. I thought, “What the heck is that? How do I make my system look and act like that?”
And that’s where it all began.
Enter Linux
I found out they were using Linux, and I was sold. I knew nothing of Linux. I had only heard about it years prior from a “crazy” guy I worked with. Other than that, I had no clue what to expect or how to get it up and running on my system.
Google and YouTube to the rescue. I was so green that I actually googled, “What is better, Linux or Ubuntu?” Every time I looked up “How to install Linux,” it showed me a tutorial about Ubuntu, so I didn’t know any better.
From Ubuntu to Mint
Fast forward to me figuring out that Linux has different distros. After getting an ISO downloaded and VirtualBox set up, I created and booted a VM of Ubuntu.
As soon as the login screen showed up and I saw the awful orange and purple, I closed it down and said, “Nope.”
Next, I found Linux Mint. I went through the process of setting up a VM of Mint. Once it booted and I saw the welcoming green color scheme and the Cinnamon desktop environment, I thought, “This is more like it.”
Cinnamon was intuitive, Windows-like, and an easy transition from what I was used to, so I took right to it. I played with Mint in the VM for a while. Before long, I found myself spending more time in my VM than on my Windows machine.
I thought, “There has to be a better way.”
Goodbye, Windows
Again, Google to the rescue. I quickly learned how to partition my drive and dual boot Mint with Windows. Since I still felt I needed my security blanket, I didn’t get rid of Windows right away.
Before I knew it, I was cruising, learning everything I needed to know. I spent less and less time in Windows, and eventually, Windows became unnecessary. At that point, I wiped that side of my drive and let Mint be my daily driver.
From that point on, I was all about the Linux life—no more Windows for this guy. I actually enjoyed using my computer.
The Game That Started It All
You may be wondering, “What ever happened to that game you set out to make? Where can I find this marvel and play it?”
Well, I made it. It was horrible. I quickly erased any hint of its existence.
But that being said, I did what I set out to do: create a video game. In the end, I wound up gaining so much more than just the sense of accomplishment from creating something from a few lines of code.
I wanted to show my kids that even if you are clueless at the beginning, if you are willing to work and study, just about anything is possible. I gained all that—and this amazing neckbeard.
Oh, and the experience and knowledge of using Linux.
God bless.
Linux
- My Preferred Linux Setup
Unknown Author|February 11, 2024
Unknown Author|February 11, 2024
Subsections of Linux
My Preferred Linux Setup
Distribution
Void Linux
I started my Linux journey on Mint, followed by Manjaro, then spent the lions share of my time in Arch/Arco. So how did I end up on Void? good question. I was making a long term distro review for my youtube channel covering Void linux and liked it so much I switched. I am a firm believer in the idea that distribution doesn’t matter, until it does.
Window Manager/Desktop Environment
herbstluftwm
I spend most of my time in Herbstluftwm but thoroughly enjoy trying out all available window managers. When I used a full desktop environment, cinnamon was my favorite, it is a well put together and intuitive environment that helped me transition from windows to linux.
Shell
Bash
With so many other “Better” (not really), options such as zsh and fish, with their auto suggestion and highlighting and plugins galore, why do I still use plain old Bash? Bash is the standard that most distros come with by default, and while the other shells may have more plugins and fanciness, I can accomplish a lot of the same functionality simply by configuring Bash and not installing a bunch of plugins and bloat. I’m not saying the other Shells are not useful or you shouldn’t use them, I just personally prefer the experience of configuring Bash as it helps me to understand what is happening and how things work as opposed to just installing a plugin and moving on.
Text Editor
Vim/Neovim
Need I say more?
Tutorials
- Bash
By Jake Pedersen|June 30, 2024
- Installations
By Jake Pedersen|October 6, 2024
By Jake Pedersen|June 30, 2024
By Jake Pedersen|October 6, 2024
Subsections of Tutorials
Bash
- Awk
By Jake Pedersen|June 30, 2024
- The Bash Prompt
By Jake Pedersen|February 28, 2024
By Jake Pedersen|June 30, 2024
By Jake Pedersen|February 28, 2024
Subsections of Bash
Awk
Understanding AWK: A Beginner’s Guide with Examples
AWK is a powerful programming language designed for text processing and typically used as a data extraction and reporting tool. Named after its creators (Aho, Weinberger, and Kernighan), AWK is a versatile tool that can handle complex text-processing tasks with ease. In this post, we’ll explore three AWK commands, ranging from easy to advanced, using specific file contents and showing the output of each command. Let’s dive in!
Example 1: Easy - Extracting Specific Columns
Target File: ‘data.txt’
Lets say the above file contains the following lines:
Name Age Occupation
Alice 30 Engineer
Bob 25 Designer
Carol 27 Teacher
Awk Command
awk '{print $1, $3}' data.txt
Output
Name Occupation
Alice Engineer
Bob Designer
Carol Teacher
Explanation
- awk : The command invokes the AWK programming language.
- ’{ }’ : The curly braces contain the AWK command to be executed.
- print $1, $3 : print is and AWK function that prints text, $1 and $3 represent the first and third columns of the input file, respectively. Each $ followed by a number refers to a specific column in the input data.
- data.txt : The name of the input file to be processed.
This simple command uses AWK to print the first and third columns of data.txt. The {print $1, $3} part of the command tells AWK to display the first and third fields (columns) for each line of the file. This is a great way to quickly extract specific information from a structured text file.
Example 2: Medium - Summing Values in a Column
Target File: ’expenses.txt'
The above file contains the following lines:
Item Cost
Groceries 100
Utilities 150
Rent 1200
Transport 80
Entertain 200
Awk Command
awk 'NR > 1 {sum += $2} END {print "Total Expense:", sum}' expenses.txt
Output
Total Expense: 1730
Explanation
- awk : Invokes the AWK programming language
- NR > 1 : NR is a built-in AWK variable that represents the current record (line) number. This condition ensures that the action is only performed for the lines where NR is greater than 1, effectively skipping the header row.
- {sum += $2} : Within the curly braces, sum += $2 adds the value in the second column ($2) to the variable sum for each line. kmm* END {print “Total Expense:”, sum} : The END block is execute after all input lines have been processed, it prints the total sum of the values in the second column.
- expenses.txt : The name of the input file to be processed.
This command sums up the values in the second column of expenses.txt. The NR > 1 condition skips the header row. The sum += $2 part adds each value in the second column to the sum variable. Finally, END {print “Total Expense:”, sum} prints the total expense after processing all lines.
Example 3: Hard/Cool - Finding the longest Line in a file
Target File: ‘paragraphs.txt’
The above file contains the following paragraphs:
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Vestibulum consectetur nunc sit amet risus varius, vel facilisis velit tincidunt.
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
In quis luctus libero.
Awk Command
awk '{ if (length($0) > max) { max = length($0); longest = $0 } } END { print "Longest line:", longest }' paragraphs.txt
Output
Longest line: Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
Explanation
- awk : The command invokes the AWK programming language.
- { if (length($0) > max) { max = length($0); longest = $0 } } : Within the curly braces, this block of code is executed for each input line.
- length($0) : The length function returns the length of the current line ($0 represents the entire line).
- if (length($0) > max) : This condition checks if the length of the current line is greater than the current value of max.
- max = length($0) : If the condition is true, max is updated to the length of the current line.
- longest = $0 : The lonngest variable is updated to store the current line.
- END { print “Longest line:”, longest } : The END block is executed after all input lines have been processed. It prings the longest line found.
- paragraphs.txt : The name of the input file to be processed.
This advanced command finds the longest line in paragraphs.txt. The length($0) function calculates the length of each line. The if (length($0) > max) condition checks if the current line is longer than the previously recorded maximum length. If it is, the max variable is updated to the current line’s length, and the longest variable stores the current line. After processing all lines, the END { print “Longest line:”, longest } block prints the longest line.
Conclusion:
AWK is a powerful and flexible tool for text processing that can handle a wide range of tasks. From extracting specific columns to summing values and finding the longest line, AWK commands can be simple or complex, depending on your needs. These examples provide a glimpse into what AWK can do, but there’s much more to explore. Dive into AWK, and you’ll find it an invaluable tool in your text-processing toolkit!
The Bash Prompt
Customizing Your Bash Prompt
Is your bash prompt so ugly it makes you sad? Well look no further, in this article I am going to show you how to make your prompt the envy of the neighborhood.
The Prompt
The Bash prompt is the command-line interface feature in Unix-like operating systems, it is provided by the Bash shell (Bourne Again SHell). The prompt is the area where the user types commands and interacts with the system. It typically appears as a string of characters followed by a cursor, signaling that the shell is ready to accept input.
The PS variable (1-4)
The PS1 variable is what you use to create your primary prompt, this is the prompt most people think of and it is the prompt that lets the user know that the shell is ready to accept commands.
The PS2 variable is the secondary prompt, we won’t spend time on this, just be aware that it is the prompt that appears when the shell expects additional input to complete a command, for example when there is an unmatched parenthesis or quotation mark.
The PS3 variable is used with the select command, often used with a case statement. This is commonly used in the creation of menu scripts.
Lastly, the PS4 variable is used in conjunction with the xtrace, or -x, option and is displayed before each command is executed.
Stock Prompt
When you first install and open the Bash shell, the default prompt can be rather uninspiring, providing minimal information and lacking aesthetic appeal, it will most likely look something like this:
Custom Prompt
Fortunately, customizing the Bash prompt is a simple yet effective way to personalize your command-line experience. By incorporating different character sequences, you can not only enhance the visual appeal but also display relevant information that suits your preferences. In the following steps, I’ll guide you through the basics of customizing your Bash prompt and soon, you’ll find yourself navigating the command line with a tailored and visually pleasing prompt that suits your style and preferences, something similar to this:
The Character Sequences
To make changes to the prompt we need to use character sequences. Character sequences are used to change the appearance of your prompt, including color settings for text and background, and style settings for text including underline, bold, blinking, and bright
Before we begin, there are 2 character sequences you need to be aware of before you attempt to style your prompt and they are as follows:
\[
and
\]
These two sequences are important because they are used to enclose and indicate non-printing sequences. While these styling sequences are used to add color and style or other escape sequences to your prompt, they do not actually take up space on the command line so when you include these escape/style sequences without enclosing them in \[ and \], Bash may miscalculate the length of the prompt leading to misplacement of the cursor and this leads to character printing issues and other weird functional issues. By enclosing the non-printing sequences with \[ \] you tell the terminal to ignore these sequences when calculating the length of the prompt to ensure proper cursor placement and avoid unexpected behavior.
So take care to note in the following examples the escape sequences and the printed components of the prompts and which are wrapped and which are not.
Colors
Color is one customization you can use to create your ideal prompt, the following is a list of the color character codes, they are used in a sequence like this:
\[\e[32m\]
color | fg number | bg number |
---|---|---|
Black | 30 | 40 |
White | 37 | 47 |
Blue | 34 | 44 |
Cyan | 36 | 46 |
Green | 32 | 42 |
Red | 31 | 41 |
Yellow | 33 | 43 |
Magenta | 35 | 45 |
So for example:
PS1="\[\e[31m\]This is red text\[\e[m\] "
Will create a prompt that looks like this:
This text red text.
While:
PS1="\[\e[41m\]This is red background\[\e[m\] "
Will create a prompt that looks like this:
This is red background
Style
Text color is nice, but what if you want to dress it up a little more, you can add a little style with an underline, bright/bold colors, dim colors, blinking text, or reversed text using the following codes:
style | number |
---|---|
normal | 0 |
bold/bright | 1 |
dim | 2 |
underline | 4 |
blinking | 5 |
reversed | 7 |
Apply the style character your would lke to use as follows:
Underline:
\[\e[4;32m\]
So for example:
PS1="\[\e[4;32m\]This is green underlined text\[\e[m\] "
will create a prompt that looks like this:
This is green underlined text
Bright:
\[\e[1;32m\]
So for example:
PS1="\[\e[1;32m\]This is bright green text\[\e[m\] "
will create a prompt that looks like this: (depending on your terminal colors and settings)
This is bright green text
note the 4; or the 1; in the character sequenct, the 1; is for bright, the 4; is for underline.
Information
Now that you know how to add color and style to your prompt, lets add the real important stuff, the stuff that gives you the needed information
about where you are, what you are, who you are, and more.
The following table is a list of charater sequences and the description of what they display:
Character sequences | Displays |
---|---|
\a | The “alarm” character. Triggers a beep or a screen flash |
\d | The current date, displayed in the format Weekday Month Date (e.g., Wednesday May 13). |
\D{format} | The current date and time displayed according to format as interpreted by strftime. If format is omitted, \D{} displays current 12-hour A.M./P.M. time (e.g., 07:23:01 PM). |
\e | An escape character (ASCII (American Standard Code for Information Interchange) 27) |
\e[numberm | Denotes the beginning of a sequence to display in color. Number is a number, or pair of numbers, which specifies what color and style to use. See below for a list of colors and their number pairs. |
\e[m | Denotes the end of a sequence to display in color. |
\h | The hostname of the machine, up to the first “.” For instance, if the system’s hostname is myhost.mydomain, \h displays myhost |
\H | The full hostname of the machine. |
\j | Number of jobs being managed by the shell. |
\l | The shell’s terminal device identifier, usually a single-digit number. |
\n | A newline |
\r | Carriage return |
\s | The name of the shell (the basename of the process that initiated the current bash session). |
\t | Current time displayed in 24-hour HH:MM:SS format (e.g., 19:23:01). |
\T | Current time displayed in 12-hour HH:MM:SS format (eg. 07:23:01). |
\@ | Current time displayed in 12-hour HH:MM:SS A.M./P.M. format (e.g., 07:23:01 P.M.). |
\A | Current time in 24-hour HH:MM format, (e.g., 19:23). |
\u | The username of the current user. |
\v | Bash version number (e.g., 4.3). |
\V | Bash version and patch number (e.g., 4.3.30). |
\w | The current directory. The user’s home directory is abbreviated as a tilde ("~"). For example, /usr/bin, ~, or ~/documents |
\W | The basename of the current working directory (e.g., bin, ~, or documents). |
\! | The history number of the current command. |
\# | The command number of the current command (command numbers are like history numbers, but they reset to zero when you start a new bash session). |
\nnn | The ASCII character whose octal value is nnn. |
\ | A backslash |
\[ | Marks the beginning of any sequence of non-printing characters, such as terminal control codes. |
\] | Marks the end of a non-printing sequence. |
So now that we have a nice list of the different characters you can use and what they will display, how do you use them? Well it is simple, say you want your prompt to show the name of the current user in white and the current working directory basename in red, that would look like this:
PS1="\u \[\e[31m\]\W\[\e[m\] "
With this configuration, your prompt will look like this:
(I will use Jake as my user name, and home as the current dir)
Jake ~
Or say you don’t care about color and you just want to display the date, just do this:
PS1="\d : "
This will display a prompt that looks like this:
Wednesday May 13 :
Now that we have a good idea of what character sequences do and how to use them the question becomes, where do we configure this? There are a couple of ways you can implement your own prompt. First, if you are just looking to change the prompt for the current session, you can just open your terminal, and enter the following:
bash-5.25: PS1="<enter your prompt configuration here>"
This will change your prompt for the current session, but it will return to normal once you close your terminal. If you want to change it permanently, all you have to do is set the PS1 variable to whatever you like in either your .bash_profile, or in your .bashrc (you can use your .profile as well, if you prefer, but the other 2 files are more commonly used). Once set in one of the bash files, just close your terminal and reopen it or use the following command, and your prompt will be permanently set, at least set until your edti your PS1 variable again.
source%
Now take your new knowledge and understanding of the PS1 variable and customize and configure to your hearts desire.
Installations
- Installing Void Linux
By Jake Pedersen|February 6, 2024
By Jake Pedersen|February 6, 2024
Subsections of Installations
Installing Void Linux
Void Linux Install with BtrFS and encryption
So you want to install Void Linux, well you’ve come to the right place, so without further ado, let’s get started.
Section 1 - Select and Prepare the Device
!! NOTE: !! -ALL COMMANDS IN THIS TUTORIAL ARE RUN AS THE ROOT USER, IF YOU ARE NOT ROOT, BE SURE TO EITHER USE SUDO OR CHANGE TO ROOT
This section will cover partitioning your drive and adding encryption. There are many tools avalable to partition your drive, tools like cfdisk, parted, gparted, gdisk, etc, we will be using fdisk. As for encryption, we will be using luks1 since as of the writing of this, grub does not fully support luks2.
Step 1 - Partition
From the command line launch fdisk and point it to the device of your choosing, for this example I will use /dev/sdX. once fdisk is launched with the correct device, we need to create 2 parititons, the following are the selections needed:
fdisk /dev/sdX
Create GPT partition table
Command (m for help): g
Create EFI System Partition (ESP)
Command (m for help): n
Partition number (1-128, default 1): (enter for default)
First sector (2048-500118158, default 2048): (enter for default)
Last sector, +/-sectors or +/-size{K,M,G,T,P}...): +200M (choose 128M to 1G)
Do you want to remove the signature? [Y]es/[N]o: y
Command (m for help): t
Partition type or alias (type L to list all): 1
Create the root partition
Command (m for help): n
Partition number (2-128, default 2): (enter for default)
First sector (2099200-500118158, default 2099200): (enter for default)
Last sector, +/-sectors or +/-size{K,M,G,T,P}...): (enter for default)
Write changes to the disk
Command (m for help): w
Step 2 - Encrypt
Now that the device has been partitioned, we are ready to encrypt the root volume.
Again, since grub does not fully support luks2 we will be using luks1 using the following commands.
Encrypt the root volume with the following command:
cryptsetup luksFormat --type luks1 -y /dev/sdX2
It will warn you that this action will overwrite anything on the selected disk, type YES (all caps) to accept, then it will ask you to create and verify a password.
Now the the root volume is encrypted it is locked and cannot be edited, we need to open the root volume and give it a name with the following command: ( I am calling it cryptvoid, you can name it what ever you would like )
cryptsetup open /dev/sdX2 cryptvoid
you will be prompted for the password you just created and once verified, the encrypted root volume will be open.
Step 3 - Format Partitions
Now we are ready to format the paritions, we will make partition 1 the efi partition and install a fat filesystem and parition 2 will be the root partition with BtrFS.
format the efi parititon:
mkfs.fat -F32 -n EFI /dev/sdX1
format the root partition:
mkfs.btrfs -L Void /dev/mapper/cryptvoid
Step 4 - Create BtrFS Subvolumes
Now that we have the disk partitioned and the file systems created, now we need to create the subvolumes on the BtrFS volume.
First we will create a variable to store all the options we want to use, this is not completely necessary but will save on a lot of redundant typing
BTRFS_OPTS="rw,noatime,compress=zstd,discard=async"
- rw = read/write permissions
- noatime = no access time, prevents sys from updating access timestamp every time a file is accessed
- compress = type of compression
- zstd = using Zstandard compression algorithm
- discard = improve efficiency of solid state drives by allowing them to reclaim unused space
- async = operation will be performed asyncronously
Now we will mount the top level subvolume.
mount -o $BTRFS_OPTS /dev/mapper/cryptvoid /mnt
Now that we have the top level subvolume mounted, it is time to create the subvolumes for root, home, and snapshots
Root subvolume
btrfs su cr /mnt/@
Home subvolume
btrfs su cr /mnt/@home
Snapshots subvolume
btrfs su cr /mnt/@snapshots
Unmount cryptvoid
umount /mnt
The last step of prep before we start the base install is to mount all the subvolumes and the EFI partition
Mount the root subvolume
mount -o $BTRFS_OPTS,subvol=@ /dev/mapper/cryptvoid /mnt
We now have our encrypted volume mounted and we need to create mountpoints for home, root, and snapshots
mkdir /mnt/{efi,home,.snapshots}
Mount the home subvolume
mount -o $BTRFS_OPTS,subvol=@home /dev/mapper/cryptvoid /mnt/home
Mount snapshots subvolume
mount -o $BTRFS_OPTS,subvol=@snapshots /dev/mapper/cryptvoid /mnt/.snapshots
While a key function and benefit of BtrFS is snapshots, there are certain directories that don’t need to be included in the snapshots, we will create some nested subvolumes for these specific directories
mkdir -p /mnt/var/cache
btrfs su cr /mnt/var/cache/xbps
btrfs su cr /mnt/var/tmp
btrfs su cr /mnt/srv
Mount the EFI system parition
mount -o rw,noatime /dev/sdX1 /mnt/efi
Check mountpoints and verify they are correct using one of the following 2 commands
df -h
or
lsblk
Section 2 - Installation
With the drive now partitioned, the file system created, and all volumes and subvolumes mounted, we can begin the base installation of Void Linux
Step 1 - Mirror, C library, Architecture, and Base-system metapackage
While this step is not required it is a good idea to choose a mirror close to your location, A list of mirrors can be found at https://xmirror.voidlinux.org/. However; you can just go with the default mirror if you choose to.
The closest mirror to me is Chicago, so in this example, I will use the Chicago mirror, https://mirrors.servercentral.com/voidlinux/
.
Aside from which mirror you want to use, there are a few other choices you will need to make, one of these is which C library to use, Void gives the option of using glibc (Gnu C library) or musl (designed to be more lightweight).
- glibc: /current
- musl: /current/musl
There is also the question of architecture, you will need to select which architecture you plan to use from the following list:
- x86_64
- x86_64-musl
- i686
- aarch64
I will use x86_64 for this example
Once you decide which mirror and library you want to use (we will be using Chicago mirror and glibc library), we can create a couple more variables to make the next steps a little easier, we need to create a variable for our repo, and a variable for our architecture.
REPO=https://mirrors.servercentral.com/voidlinux/current/
ARCH=x86_64
Create directory and copy RSA keys for verifying package integrity
mkdir -p /mnt/var/db/xbps/keys
cp /var/db/xbps/keys/* /mnt/var/db/xbps/keys/
Now we can install the base system along with a few other odds and ends. (this tutorial will install vim and the linux-mainline kernel, if you want stable, install linux instead of linux-mainline)
XBPS_ARCH=$ARCH xbps-install -S -R "$REPO" -r /mnt base-system linux-mainline btrfs-progs cryptsetup vim
Step 2 - Chroot
With the base system installed we are ready to chroot into our void environment but first we need to mount a pseudo-filesystem needed for chroot
for dir in dev proc sys run; do mount --rbind /$dir /mnt/$dir; mount --make-rslave /mnt/$dir; done
Copy dns configuration into new root so xbps can download new packages inside
cp /etc/resolve.conf /mnt/etc/
chroot into system
BTRFS_OPTS=$BTRFS_OPTS PS1='(chroot) # ' chroot /mnt/ /bin/bash
Step 3 - Installation Configuration
Next we will begin to configure our new install, this will involve setting a hostname, timezone, our hosts, creating an fstab, and more.
First lets look at our rc.conf, you can find and go over the options in this file in the void docs at httsp://docs.voidlinux.org/config/rc-files.conf
we can make changes in here but it is not necessary
vim /etc/rc.conf
Set timezone, you can list out all available timezones by running the following command
ls /usr/share/zoneinfo
Once you locate the timezone you need, set the timezone in the /etc/localtime file, I will set the timezone to chicago in this example
ln -sf /usr/share/zoneinfo/America/Chicago /etc/localtime
Next we will set our locale by editing /etc/default/libc-locales and uncommenting your locale. For me this would be en_US.UTF-8 and en_US ISO-8859-1
vim /etc/default/libc-locales
Once you uncomment and save the changes, you need to reconfigure
xbps-reconfigure -f glibc-locales
Set hostname in /etc/hostname
Replace <your chosen hostname> with what ever you want your hostname to be.
echo "<your chosen hostname>" > /etc/hostname
Create the /etc/hosts file, replace myhostname with the hostname you created in the last step.
cat <<EOF > /etc/hosts
#
# /etc/hosts: static lookup table for host names
#
127.0.0.1 localhost
::1 localhost
127.0.1.1 myhostname.localdomain myhostname
EOF
Step 4 - User Management
Now we will move into user management
First we need to create the root password
passwd
Now we can create a new user and give that user a password, add them the necessary groups, and give them sudo privilege
Replace <USER> with the name of the user you are adding
useradd <USER>
passwd <USER>
usermod -aG wheel, (any other groups you want to add user to) <USER>
Now we can change the shell for the root user to bash and edit the sudoers file
chsh -s /bin/bash root
EDITOR=vim visudo
Uncomment the line that says # %wheel ALL=(ALL:ALL) ALL
Then you can also add the following line below the line you just uncommented, this is not required but it is an option
<USER> ALL=(ALL:ALL) ALL
Step 5 - REPOS
Sync repositories
xbps-install -S
This step is not required unless you want to be able to access software that does not have free licenses or if you are a gamer or need 32bit packages
xbps-install void-repo-nonfree
xbps-install -S
xbps-install void-repo-multilib
xbps-install -S
step 6 - Create fstab
Now we can create our fstab, there are multiple ways to do this but we are going to use some command line magic and make this as easy as possible
Create variables for different volumes
EFI_UUID=$(blkid -s UUID -o value /dev/sdX1)
ROOT_UUID=$(blkid -s UUID -o value /dev/mapper/cryptvoid)
LUKS_UUID=$(blkid -s UUID -o value /dev/sdX2)
Next we will use these variables and create and populate our fstab
cat <<EOF > /etc/fstab
UUID=$ROOT_UUID / btrfs $BTRFS_OPTS,subvol=@ 0 1
UUID=$ROOT_UUID /home btrfs $BTRFS_OPTS,subvol=@home 0 2
UUID=$ROOT_UUID /.snapshots btrfs $BTRFS_OPTS,subvol=@snapshots 0 2
UUID=$EFI_UUID /efi vfat defaults,noatime 0 2
tmpfs /tmp tmpfs defaults,nosuid,nodev 0 0
EOF
Step 7 - Install and setup bootloader
We are now on the homestretch, a few more commands and it will be time to reboot
Install the grub package for efi
xbps-install grub-x86_64-efi
Enable encryption
echo GRUB_ENABLE_CRYPTODISK=y >> /etc/default/grub
Edit /etc/default/grub file
vim /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="loglevel=4 rd.auto=1 rd.luks.allow-discards"
Install grub
grub-install --target=x86_64-efi --efi-directory=/efi --bootloader-id="Void"
Section 3 - Miscellaneous
Step 1 - Keyfile (optional)
Create a keyfile to avoid typing passphrase 2x on boot
Create a keyfile out of random data
dd bs=515 count=4 if=/dev/urandom of=/boot/keyfile.bin
Add a 2nd key slot to the LUKS encrypted volume with keyfile.bin as the key
cryptsetup -v luksAddKey /dev/sdX2 /boot/keyfile.bin
Secure the keyfile by setting appropriate permissions
chmod 000 /boot/keyfile.bin
Allow only root access to /boot
chmod -R g-rwx,o-rwx /boot
Setup crypttab
cat <<EOF >> /etc/crypttab
cryptvoid UUID=$LUKS_UUID /boot/keyfile.bin luks
EOF
Cofigure dracut to include the keyfile and crypttab in the initial RAM disk
echo 'install_items+=" /boot/keyfile.bin /etc/crypttab "' > /etc/dracut.conf.d/10-crypt.conf
ln -s /etc/sv/dhc /etc/runit/runsvdir/default
Step 2 - Install software/programs/tools
Install software or programs you may want to install at this time
xbps-install <list of desired programs>
Step 3 - Link services
Link services that we want to start on boot
If you want to use a wired connection
ln -s /etc/sv/dhcpcd-eth0 /var/service
ln -s /etc/sv/dhcpcd /var/service
If you want to use wifi you can use wpa-supplicant or you can install Network Manager I prefer to use Network Manager so that is what I will use as an example
xbps-install NetworkManager
ln -s /etc/sv/NetworkManager /var/service
Use xbps to verify installed programs are configured correctly
xbps-reconfigure -fa
Step 4 - Exit and Reboot
Exit chroot
exit
Reboot system
reboot
Docs
- Void Linux
Unknown Author|Unknown Date
- Bash - Bourne Again SHell
Unknown Author|Unknown Date
Unknown Author|Unknown Date
Unknown Author|Unknown Date
Subsections of Docs
Void Linux
Links to helpful documentation regarding Void Linux
-
Check the build status for Void Linux -
Void Buildbot Waterfall
-
Live images and rootfs tarballs -
Index of live/current/
-
Void Linux Github -
Void Github
-
Void Mirror List -
Void Mirrors
Bash - Bourne Again SHell
Link to helpful Bash documentation
Gnu.org
Link to Man pages
Man Pages
About
- Get to know me
By Jake Pedersen|June 7, 2023
A little information about me and my life
By Jake Pedersen|June 7, 2023
A little information about me and my life
Subsections of About
Get to know me
(~) $: whoami _
I entered this world 40+ years ago, in the Pacific Northwest, Washington state, to be a little less vague, but moved my family to Northwest Arkansas in 2017 to escape the overpopulation and increasing cost of Washington. I am married to a wonderful woman and we have 4 kids together, although two of them are hardly kids anymore. We have 4 cats ( I know I am shocked too ) even though collectively, they only have 7 eyes and 15 legs in the bunch, and 1 dog who is whole, just a little crazy.
I have been an automotive technician (or mechanic as my wife calls me) for the lions share of my life, starting in the independent world on all makes, then moving to the european market, followed by a move into the dealership side of things in the Japanese market, where I have been able to move up to gain the top level in the world of Toyota as a Master Diagnostic Technician, or MDT.
After so many years as a Technician, I have grown tired of the abuse my body takes on a daily basis but still enjoy the troubleshooting/problem solving aspect of my job as well as working with my hands to fix what was once broken. I am now, although I wasn’t always, interested in technology and so Linux has proven to be right up my alley.
I have an Associates Degree in Information Systems from Liberty University and am currently in school at WGU finishing up a Bachelors Degree in Software Engineering, and hope to be able to transition into a career in Technology/software which will afford me the ability to troubleshoot and problem solve, and work with my hands without the abuse on my body.
Thinking Biblically
- The Cross
By Dewayne Holm|March 6, 2021
By Dewayne Holm|March 6, 2021
Subsections of Thinking Biblically
The Cross
On Calvary hill in a barren land
stands a wooden cross with a tortured man.
A soldiers curse, the jeering horde,
a rattle of dice parts the robes of our Lord.
Tried three times before the Jew,
three times tried by Roman too.
The only words to pass His lips,
was Jesus claim to Messiaship.
The shouts arose to crucify,
for blasphemy this man shall die.
The numbing drink refused by the Son,
the nails are driven the deed is done.
Father forgive them they do not know,
these words fall deaf on the crowd below.
One theif rails with angered cries,
the believing theif granted paradise.
These words to the mother ‘Behold thy Son’,
her life commended to Christs loved one.
His wounds speak not of physical cost,
but the terrible anguish of innocence lost.
“My God My God, why has thou forsaken,”
but to honor the scriptures Gods love had been taken.
His humanity shown in the statement ‘I thirst",
with the words “it is finished”, Christs heart burst.
As David predicted no bones had been broken,
but is body was pierced as Zechariah had spoken.
The blood and the water flowed from His side,
full proof to the Roman that the Savior had died.
The shy turned grey, then stygian black,
the veil was rent the rocks did crack.
The curse of the law removed from the land,
the new age given the Kingdom at hand.
On Calvary hill in a barren land,
stands a wooden cross with a glorified Man.
For eternal life blessed with Gods grace.
Christ gave His life for the human race.
PRAISE THE LORD.