Skip to content

Instantly share code, notes, and snippets.

@hamsolodev
Created January 16, 2013 01:09
Show Gist options
  • Save hamsolodev/4543753 to your computer and use it in GitHub Desktop.
Save hamsolodev/4543753 to your computer and use it in GitHub Desktop.

Arch Linux install notes

Notes on installing Arch Linux from scratch, using LVM partitions.

There's no installer as such; instead, there's a series of tasks carried out on the commandline to partition the disk and bootstrap base packages &c.

Followed the Installation Guide, with forays into other wiki pages to gather configuration options as required.

Boot installation media

Logs in as root automatically.

Partitions

Used fdisk to create one big Primary Partition of type 8e (“Linux LVM”). The Arch wiki page on Partitioning warns against use of cfdisk, since it starts the first partition at sector 63—which is incompatible with Grub 2, which we need to use in order to have the /boot partition within a Logical Volume.

LVM

First, load the dm-mod module with modprobe dm-mod.

Make the partition created above into a LVM Physical Volume:

pvcreate /dev/sda1

Create a Volume Group backed by the newly create Physical Volume:

vgcreate vg0 /dev/sda1

Create some Logical Volumes within our Volume Group—for root, boot, var, usr, and home:

lvcreate -L 250M vg0 -n root
lvcreate -L 100M vg0 -n boot
lvcreate -L 500M vg0 -n var
lvcreate -L 1.5G vg0 -n usr
lvcreate -L 500M vg0 -n home

Format Logical Volumes

Going to use ext4 for everything:

mkfs -t ext4 /dev/mapper/vg0-root
mkfs -t ext4 /dev/mapper/vg0-boot
mkfs -t ext4 /dev/mapper/vg0-var
mkfs -t ext4 /dev/mapper/vg0-usr
mkfs -t ext4 /dev/mapper/vg0-home

Mount

First, mount the root volume onto /mnt:

mount /dev/mapper/vg0-root /mnt

Then create mountpoints for the other volumes:

mkdir /mnt/{boot,var,usr,home}

Finally, mount the volumes:

mount /dev/mapper/vg0-boot /mnt/boot
mount /dev/mapper/vg0-var /mnt/var
mount /dev/mapper/vg0-usr /mnt/usr
mount /dev/mapper/vg0-home /mnt/home

Configure WiFi

…mention netcfg setup, with the UTF-8 chars in ESSID…

To bring the link up:

`ip link set wlan0 up`

To scan for networks:

`iw dev wlan0 scan`

Then make a netcfg file in /etc/network.d, and netcfg -u <somename>.

Install the base system

First, edit /etc/pacman.d/mirrorlist to pick a mirror geographically close to me. I picked the iiNet FTP server. Then install the base system using pacstrap /mnt base base-devel.

Install GRUB 2 bootloader

This is a straightforward install of Grub 2 package (required since /boot is a Logical Volume):

arch-chroot /mnt pacman -S grub-bios

Generate an /etc/fstab

I like using the UUID of volumes:

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

Also, change the /etc/fstab entry for user, so the “pass” option is 0.

Configure the system

All these sub–steps should be carried out while chrooted into the system. This is required because we'll be running commands to configure locales and whatnot.

arch-chroot /mnt

hostname, timezone & locale

Edit the /etc/hostname file and enter the desired hostname.

Symlink the appropriate zoneinfo file into /etc/localtime:

ln -s /usr/share/zoneinfo/Australia/Melbourne /etc/localtime

The Arch Linux wiki page on Locales was the source of information used to arrive at my desired configuration.

Enable some locales by uncommenting them in /etc/locale.gen: en_AU.UTF-8, en_GB.UTF-8, en_US.UTF-8.

To set a system–wide locale, with fallbacks, edit /etc/locale.conf and add the following lines:

# Enable UTF-8 with Australian settings.
LANG="en_AU.UTF-8"
# specify some fallback locales
LANGUAGE="en_AU:en_GB:en"
# Keep the default sort order, which means files starting with '.' appear first
LC_COLLATE="C"

Then, run locale-gen to generate the locales (don't think edits to /etc/locale.conf require running it again).

Console keymap and font

TODO Arch Linux wiki page on keymaps. I'll want to remap Caps Lock to Ctrl.

RAM disk config

The Arch Linux wiki make on mkinitcpio was used to derive appropriate settings for my system, given that /boot was on a Logical Volume, as was /.

See mkinitcpio -H <hook name> for help on a specific hook. I'm not entirely sure what order the below hooks should be added.

Edit the file /etc/mkinitcpio.conf, and make sure the following HOOKS are present…

Since root device is on LVM (after block, before filesystems):

lvm2

Since /usr is its own partition (after lvm2):

shutdown  # allows /usr to be properly unmounted
fsck  # to allow fsck of /usr at boot
usr  # mount /usr immediately after / and ensure graceful unmount at reboot

In addition, it is necessary to tell grub where the root partition is. Edit /etc/default/grub and change GRUB_CMDLINE_LINUX to include:

root=/dev/mapper/vg0-root

Run grub-mkconfig -o /boot/grub/grub.cfg, to take into account updates to /etc/default/grub. Then run mkinitcpio -p linux to create the initial RAM disk.

GRUB installation to MBR

See the Arch wiki page on GRUB2.

grub-install --target=i386-pc --recheck --debug /dev/sda
mkdir -p /boot/grub/locale
cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo

Change root pw, exit chroot, unmount volumes, reboot

A simple passwd, followed by exit, and a umount /mnt/{boot,home,var,usr}. Finally a reboot.

Final steps

When first rebooting the new system, permanently enabling DHCP networking must be done with: systemctl enable dhcpcd. Start it now too.

Install avahi pacman -S avahi nss-mdns, and change the hosts: line in /etc/nssswitch.conf to:

hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4

Enable avahi: systemctl enable avahi-daemon, systemctl start avahi-daemon.

Install net-tools (for ifconfig etc.) and OpenSSH: pacman -S net-tools openssh, then enable (if desired) the ssh service: systemctl enable sshd.

Install rsyslog: pacman -S rsyslog, and enable the service systemctl enable rsyslog.

Install ufw, and configure the basics: pacman -S ufw, systemctl enable ufw, systemctl start ufw, ufw default deny, ufw allow SSH, ufw enable.

Use tune2fs to reduce the amount of reserved space used by each ext4 volume…any other options?

ThinkPad X200

Arch wiki page on Lenovo ThinkPad X200. How to reduce power consumption.

Install Xorg, with an appropriate driver, and emacs with pacman -S xorg-apps xorg-server xf86-video-intel xorg-xinit emacs.

Installed TLP, power saving tools for ThinkPads. This adds some commands:

`bluetooth` (turn bluetooth on or off)
`wifi` (turn wifi on or off)
`tlp-stat` (print stats about tlp)

Followed the instructions on Arch Linux wiki page on KEYMAP to remap some keys.

Set the console font after reading Arch Linux wiki page on Fonts. Ended up installing terminus-font and using ter-114n. Note that to make the font persist, I had to add i915 to MODULES in /etc/mkinitcpio.conf in order to load the graphics driver early!

weird kworker issue

?????

AUR

Read the Arch wiki page on AUR and modify my /etc/makepkg.conf to enable options to improve performance on multi–core systems.

systemd

Read a lot on Arch wiki page on Systemd/User to get systemd --user working to manage my XOrg session (requires xorg-launch-helper from AUR), as well as run my SSHConfigFS and dropboxd instances.

CUPS for HP LaserJet P1102W

Using hp-setup -i <ipaddr> will download the “proprietary driver”, but still doesn't work?!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment