Skip to content

Learning Arch - I have a whole new respect for Arch experts! Any helpful learning methodologies?

I've been working my way through the Arch install guide on the official wiki and have created a basically usable system on a VM. Of course I'm making a f'ton of mistakes along the way, so I'm scrubbing the VM each time I reach a 'goal' and make sure I can replicate my work via learning by repetition, while improving on the details:

make sure I've got my partitions aligned and working, including EFI...

then get a working system boot to bash...

then get network connectivity....

.... lather, rinse, repeat.

It occurs that my 'put it together', 'take it apart', 'put it back together' methodology may have been improved upon by folks who learn systems the same way I do. Are there any tips or tricks you'd care to share for learning?

Thank you kindly, and thanks to all of you who've contributed to the excellent docs available!

133 points47 comments
Open on Reddit
About this post
Posted
Archived
Score
133 · 100% up
Kind
Text
ID
d0cm05

Author

6
posts
42
comments
1
media
View profile

47 comments

If you are rebuilding the system a lot then I highly recommend you start to script the process. There are a lot of steps and it is very easy to forget one every now and then or remember exactly when you did last time.

A nice way to do this is create a bash script, host it on GitHub or GitLab, use a URL shorter to make it easier to type the URL in the Live environment. Then you can wget it and run it on the Live environment after optional modification.

Then you will have a far more repeatable setup that you can tweak and improve over the iterations while speeding up each iteration.

You might be interested in my blog post on this which goes into more details and hows some good tricks for how to script various parts of a typical install process.

73 points

This. I stopped backing up or thinking about my laptop at all. Everything worthwhile is stored in a git repo, including the configuration of the machine. Learning how to automate the process will teach you a ton about how it works as well.

18 points

You either can do it by bash, which is perfectly fine or use software like ansible or chef for that, maybe a little bit more easy to write yaml files.

Also hosting the script on Github/Gitlab is cool, but without network not really helpful. I suggest creating your own customized USB stick with an Archiso where your script is already included. The How-To for that can also be found in the Arch Wiki.

Happy learning!

8 points

With Ansible or Chef you have bootstrap them on the live environment first, or at least ssh access, and then you have a two part install process. While doable, I found it to be more things to learn and more setup with very little actual benefit. I mean, the bootstrap script I made for Ansible was 86 lines and that was before all of the Ansible yaml needed to actually configure the system.

A bash script is not that complicated for a one off run like this. Try writing a installer in Ansible or Chef that is that is easier to read or less than the 109 lines of bash my installer is while keeping the number of things you need to do on the ISO to a minimum ie: wifi-menu; curl -sL https://example.com/script | bash.

Unless you are going to install the same image in quick succession to a large number of machines or legitimately need an offline installer you will spend far more time building the ISO than configuring the network so is not worth the effort. With a script you can simply reboot and reuse the same standard off the shelf ISO over and over.

7 points

I tried to do this once but I realized that every install I do on a different system will differ wildly based on the physical system and the use case for it.

Is it bios or efi? Is it going to be a server, my personal desktop, a simple system for my mom or a media center? Do I want to use ext4, btrfs or something else? Encrypted or not?

This is just a small sample of the different systems I've installed over the years. There's just too many variables to realistically include in a script. I just end up doing it by hand even if I have a script.

Just my 2 cents.

3 points

Is it bios or efi?

These days everything support EFI so I like to enforce all my systems to use it for consistency. It is very rare to find a system that does not support EFI so modifying the script on the fly (or deleting the bootloader parts of it and doing those steps manually) for those systems is a none issue.

Is it going to be a server, my personal desktop, or a media center?

I use meta-packages for these, then the installer script just needs to install a single meta-package depending on what I want the system to do. For example, I have mdaffin-desktop for general desktops, mdaffin-base for minimal systems, mdaffin-dell-xps for my laptop and mdaffin-router for my router. Each of these build on the others, as such they all include mdaffin-base for example and mdaffin-dell-xps is a small addition over mdaffin-desktop.

This allows be to maintain and keep in sync multiple different systems with minimal effort.

a simple system for my mom

I would never install an Arch based system for someone else and if I did then it would just be another meta-package for them.

Do I want to use ext4, btrfs or something else?

I tend to only use one filesystem for all my systems. Why would you want to use a different one on every system? But even if you did you can include it as an option at the start if you want, or if there is just a one off system you want to be different download and modify the script for the system.

Encrypted or not?

This option is easy to add as a question or flag in the installer or even just have one installer for each.

There's just too many variables to realistically include in a script.

There are only as many variable as you want to create. You can get a long way by normalizing your installs to a more standard base and only tweaking exceptional builds when you encounter them.

Even if you do tweak things on every install it is far easier to start with a base script and delete or change the parts you want to be different than it is to do everything from memory each time. You can even do partially scripted installs if you want - only scripting the common bits that you always do.

3 points
unknown author10 hidden

Here’s my personal cheat sheet for Arch with EFI partition. The numbers for partitions will be different depending on the size of your HDD/SSD. It’s exhaustive but incredibly useful.

ping google.com (ctrl+c to stop)

timedatectl set-ntp true timedatectl status

lsblk cgdisk /dev/sda (create two partitions) sda1 (300M - ef00 - boot) sda2 (11G - 8200 - swap) sda3 (remainder - 8300 - system)

lsblk (to confirm)

mkfs.fat -F32 /dev/sda1 mkswap /dev/sda2 swapon /dev/sda2 mkfs.ext4 /dev/sda3

mount /dev/sda3 /mnt mkdir /mnt/boot mount /dev/sda1 /mnt/boot df (to confirm)

nano /etc/pacman.d/mirrorlist (remove unnecessary, update, and/or uncomment necessary)

pacstrap /mnt base base-devel

genfstab -U /mnt genfstab -U /mnt >> /mnt/etc/fstab

cd /mnt/etc

cat fstab

~

arch-chroot /mnt

ln -sf /usr/share/zoneinfo/(zone)/(sub zone) etc/localtime hwclock —systohc

nano /etc/locale.gen (uncomment en_US.UTF-8)

locale-gen echo “LANG=en_US.UTF-8” > /etc/locale.conf

nano /etc/hostname (name the PC)

nano /etc/hosts

127.0.0.1 localhost

::1 localhost

127.0.1.1 (PC name).localdomain (PC name)

systemctl enable dhcpcd

passwd (to change root password)

useradd -m (name) passwd (name) usermod -aG wheel,audio,video,storage,power,optical,lp (name of user) groups (name)

pacman -S vim visudo (uncomment wheel group)

pacman -S grub efibootmgr grub-install —target=x86_64-efi —efi-directory=/boot —bootloader-id=GRUB

pacman -S os-prober

grub-mkconfig -o /boot/grub/grub.cfg

Reboot (eject USB installer)

(Log in as user)

(Install display server, display drivers, desktop environment, window manager, display manager, etc.)

16 points

Some very helpful ideas there. I may use this as a template to combine with my own notes on setting up LVM and encrypted partitions. I also want to spend time learning grub inside and out so I can work some of the grub magic I've seen colleagues and others pull off.

My ultimate goal is mastery and security of the system and not just getting to an 'easy to use GUI' where I don't have to learn anymore. That means being able to apply best hardening practices, etc... and not just following recipes.

5 points

Try systemd-boot instead of grub. It's much more reasonable and easier to understand

2 points
unknown author

Yeah. Everyone's recipe is different. If anything, this could just be the simple ingredients needed for an eventual "ricing" of your own.

Edit: Text has been edited above to see what's clearly in bash. If you want a real challenge, try i3 or any other tiling manager.

1 points

useradd -m (name) passwd (name) usermod -aG wheel,audio,video,storage,power,optical,lp (name of user) groups (name)

Just adding to wheel group would be enough.

4 points

In certain cases (as with recent issue with Light) additional groups such as Video may be needed. It all depends on the use cases

3 points
unknown author

That's true. The other groups were added for my own personal setup as the statement above would suggest.

0 points

If you'd like to automate that partitioning, you could use sgdisk like

sgdisk -Z -o -n 1:0:+300MiB -t 1:ef00 -n 2:0:+11GiB -t 2:8200 -n 3:0:0 -t 3:8304 /dev/sda
3 points

Your approach is sound. I did that but mostly without VMs (nothing more fun than bricking your own machine a bunch of times)

However, I do think you should try to get to a system you find usable day to day. From there, actually use the system. With that type of experience, you'll see what you need/don't need. You'll learn a lot that way as well.

13 points

If you break your main box, it just motivates you to learn quicker :)

5 points

That’s how I learned over the course of a year of tinkering around and messing with various things.

2 points

RTFW is the best methodology for learning most things.

Additionally practicing read twice do once is worthwhile.

(Be sure you understand the change youre making before making it)

8 points

I could not disagree more.

With that entire comment.

0 points

Primary source for arch as a distro is the wiki. Primary source for packages are their upstreams and manpages.

If youre doing something and you don't understand what youre doing, how do you know its the right thing to do?

Read twice, act once.

If not this, what do you suggest then?

Ask questions on reddit and hope you dont get spoonfed garbage? Pay someone to read it for you? Use existing configs off the internet without comprehending them?

1 points

I just recently had to do a second install. This time everything went a lot smoother and faster, partially because I had the experience from the first attempt and remembered more of what I had to do and why, partially because of better hardware (that doenst keep creating errors out of nowhere).

I've always found that if a man page or the arch wiki doesn't work for me, usually because I was incompetent/messed something up/flat out didn't understand what was being done, I'd watch a youtube video. Seeing someone actually doing the thing I want makes everything make a lot more sense to me and ensured that despite whatever I was doing wrong, I was still on the right track.

Also, if I ever see something in the process which I don't know/couldn't explain to someone else, I always take some time to stop my install and learn what that component is, how it functions, why it's necessary etc. I don't personally want to repeatedly install Arch, mainly because I don't intend on letting OS installation take up the limited amount of personal time I have. I'd rather spend it troubleshooting problems on an application I want/need that probably has more nuanced issues that require deeper knowledge of the system to solve (which in turn means I learn more).

8 points

Try doing something uncommon and has no easily available documentation on it:

  • Trying to run a linux executable from 2002
  • Spawning your own shoutcast compatible web radio station and full mixing deck using JACK2
  • Trying to setup postfix+dovecot without any database integration, with different domain aliases and full IMAP support including SIEVE and also using maildir style mailboxes in user's home
  • Try to install a remote socks proxy that can forward not only TCP but also UDP connections and do it seamlessly for every network packet
  • Try to bootstrap a complete GNU userspace for raspberry pi from scratch

According to my experience it will take at least 2 months to learn to make each of the examples run perfectly. All of them requires reading pages of old documentation and reading source code of different projects. Go into shit, go mad and learn to do it yourself. IMO installing Arch only teaches the names and basic configuration of a couple components in a Linux distro. It requires far more effort to see how cogs in different parts of a distro connect each other.

4 points

Any helpful learning methodologies?

Yeah, instead of installing it as a VM, install Arch (along with Xorg and a window manager) as a dual boot on a laptop with Nvidia hybrid graphics.

4 points

Honestly, IMO,

A linux distro is only useful when being used. You will only understand to a certain point, if you keep resetting too early on.

I'm clearly not the type of person that memorizes every single obscure command (that may change anyway). It's more important to know that a part that does X exists. I think I wouldn't have understand linux as a whole if I didn't use it as a primary system. ( I don't even have Windows anymore since I suck at making partition, while attempting to setup LVM's lvmcache. Good riddance anyway)

Maybe try setting up linux on LVM (or bcache). I'm not a big fan of full disk encryption like LUKS, but it's a thing you might want to look at.

Arch specific: Try making your own package through PKGBUILD and makepkg. IMO learning makepkg is the entrance to understanding Arch

3 points

Try to get gaming working. You'll be a master by the time you get real Nvidia drivers running with Vulkan and DX 11 _^

Learn to find and sort through error logs so you know exactly what to look up. Fix one problem at a time and one day everything will just work.

(unwise to attempt running a VM but for those that take the jump to Arch as their daily OS this will teach you more than you wanted to know lol)

2 points

I’ve been on it for about 6 months after moving over from Kali and basically I learned by not doing things right like the installation and having to do it over again and then messing it up after I got it installed and having to repeat the process!

2 points

Lots of important, helpful, technical tips in this thread.

But I'd like to chime in with a simple (to say, but not so much to use) advice: Don't learn Arch. Learn Linux instead.

Notice the different components and control layers. Get familiarized with tools, their configuration and behaviors. Learn the different init systems and the differences between them, sysroot structure, boot procedure, sysctl parameters, filesystems, mounts, as many buzzwords as you can come across. Mess with your installation. Break it. Rebuild it without formatting and reinstalling. Try to rely on manuals instead of step-by-step guides.

All this will enhance your knowledge and expertise of not just Arch, but any Linux distribution. The goal should be to know what Arch is made of, rather than Arch itself. Of course all this won't be revealed in a day, or a week, or a month. This is more of an ongoing procedure. But eventually you'll have seen enough things, practiced enough scenarios that you'll be an expert too.

Welcome to ArchLinux :)

2 points

My crappy advice: don't be afraid to play with it, make mistakes, then burn it down and start all over. I love learning, screwing up, figuring out why, then doing it right next time. I have the system I use daily and the one I happily break and rebuild.

TL;DR Don't be afraid to screw up and have fun.

2 points

I'd recommend keeping notes - you can use your personal space on Arch wiki for that as many Archers do. Be methodical in accumulating the knowledge there, especially as you learn and figure stuff out. You will thank your future self later and it will make the task of re-installing Arch or fixing issues much, much easier.

2 points

Why would you want to know distro specific install procedures anyway? You don't need to do it often and they are documented online. If I were you I would learn pacman if you're into arch, and possibly pgkbuild by creating some packages for pacman. That's the tool you'll use 95% of the time messing with your system. Installing arch is something you do a few times a year or less.

Granted, fdisk and grub/gummiboot is useful to know sometimes but that depends a lot on what you use your computer for.

1 points

Why would you want to know distro specific install procedures anyway?

Most importantly, I like to try to cram new things into my brain every so often to prove that an old dog can still learn new tricks. The last time I did a 'bootstrap' style Linux install (Slack, back in the day) was before systemd was a thing.

You don't need to do it often and they are documented online.

Even though I won't need to do it often in practice, I do want to be adept at it. No, I'll never do it without the documentation in front of me, but I do want to be able to understand why I'm doing each individual step: 'This is why I have to align my disk partitions to the optimal sector read size.' 'This is what I need to do to make Grub jump hoop x.' 'These are the package sets that contain the functionality I want.'

Ultimately, I want to be able to say, "I can use a devops tool like Chef or Vagrant to spin up a custom Arch environment and understand exactly what I'm doing."

1 points

If you want to learn more about the install process, go for it! I find it fascinating as well.

The sequential, building nature of the install process provides some structure to your study, IMO, which I did a decade ago, and it stood me well: Understand the sequence of install steps. For example, why is pacstrap done before chroot? Why won't pacman work as soon as you mount filesystems?

Next, I did an info or man or -h on each install command until I really understood what it was doing. For example, I often install to a new disk from my existing USB install. To avoid redownloading all packages, I discovered the c option as in pacstrap -ic, which uses the packages on the installing system. This is good when your internet speed is poor, so it will save time. You can use pacstrap to install far more packages than base, up to a full system. For example, I do pacstrap -ic /mnt base base-devel vim dialog reflector xorg etc. Also see here, Install Arch from an existing system. Fascinating. I actually tested installing Arch from Debian.

Looking at the pacstrap code is very instructional. I wanted to see how it laid down the basic directory structure, and assigned permissions.

Of all the things I learned from just the install process, I think the concept of chroot (or arch-chroot for use in the package arch-install scripts) is the most valuable, since it is the basis of rescuing very sick systems.

Linux is cool because it is a rabbit hole to the max.

Good luck.

3 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.