Taylorbyte.com

Documentation Wiki

Arch Linux GPT SSD

Boot with Arch CD (archlinux-2011.08.19-core-dual.iso) found at http://www.archlinux.org/download/

Download packages for GPT partitioning in booted installation CD

  • Temporarily setup networking
  • Update pacman
  • Upgrade pacman
  • Install gdisk for GPT partitioning
ifconfig eth0 up
dhclient -v eth0
pacman -Sy
pacman -S pacman
pacman -S gdisk

Prepare drive for installation

  • Partition disk with gdisk
  • Create new partiton table (makes gpt instead of msdos)
  • Create 16MB BIOS boot partition for bootloader (filesystem Hex code ef02)
  • Create root partition with the rest of the drive (filesystem Hex code 8300)
  • Write changes.
  • Reboot required to make partitions apear properly in arch setup
gdisk /dev/sda


GPT fdisk (gdisk) version 0.6.14

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): o
This option deletes all partitions and creates a new protective MBR.
Proceed? (Y/N): Y

Command (? for help): n
Partition number (1-128, default 1):
First sector (34-117231374, default = 34) or {+-}size{KMGTP}:
Information: Moved requested sector from 34 to 2048 in
order to align on 2048-sector boundaries.
Use 'l' on the experts' menu to adjust alignment
Last sector (2048-117231374, default = 117231374) or {+-}size{KMGTP}: +16M
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): ef02
Changed type of partition to 'BIOS boot partition'

Command (? for help): n
Partition number (2-128, default 2):
First sector (34-117231374, default = 34816) or {+-}size{KMGTP}:
Last sector (34816-117231374, default = 117231374) or {+-}size{KMGTP}:
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300):
Changed type of partition to 'Linux filesystem'

Command (? for help): p
Disk /dev/sde: 117231408 sectors, 55.9 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 178CD4EC-CE44-427E-9EAA-E1A474C2D7C4
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 117231374
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048           34815   16.0 MiB    EF02  BIOS boot partition
   2           34816       117231374   55.9 GiB    8300  Linux filesystem

Command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): Y
OK; writing new GUID partition table (GPT).
The operation has completed successfully.


reboot

Prepare booted installation CD for setup

  • Temporarily setup networking
  • Update pacman
  • Upgrade pacman
  • Install nfs-utils to mount remote /var/cache/pacman/ folder
ifconfig eth0 up
dhclient -v eth0

Run Arch Setup

/arch/setup
  1. Select source
  1. Select editor
  2. Set clock
  3. Prepare Hard Drive
  • Manually Configure block devices, filesystems and mountpoints
  • uuid
  • single root with btrfs
  • ignore no swap
  1. Select packages
  • base
  • base-devel
  1. Install packages
  2. Configure system
  • /etc/rc.conf
HOSTNAME="itx"

interface="eth0"

DAEMONS=(syslog-ng network sshd crond ntpd)
  • /etc/fstab
    • Add discard option to ext4 partitions on SSDs to stop wear
    • optionally add nfs mount but beware of mounting on boot as nfs can hang for a long time
UUID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx / ext4 defaults,discard 0 1

192.168.0.1:/var/cache/pacman /var/cache/pacman nfs defaults 0 2
  • /etc/mkinitcpio.conf
MODULES="btrfs part_gpt"
  • /etc/pacman.d/mirrorlist
Server = http://mirror.aarnet.edu.au/pub/archlinux/$repo/os/$arch
  • Root-Password
  1. Install bootloader
  • grub fails to install
  1. Exit Iinstall

Install GRUB on to mounted drive

  • Mount dev sys proc into /mnt
  • Update pacman
  • Upgrade pacman
  • Install GRUB 2
  • Install GRUB loader to drive
mount -o bind /dev /mnt/dev
mount -o bind /sys /mnt/sys
mount -o bind /proc /mnt/proc

pacman -r /mnt -Sy
pacman -r /mnt -S pacman
pacman -r /mnt -S grub2-bios

chroot /mnt
grub-install /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg

Install some extra packages to drive

pacman -r /mnt -S nfs-utils netcfg sudo openssh openssl vim net-tools inetutils dhclient ntp

Reboot into Arch

reboot

Login as root

Install Customised packages

  • Update pacman
  • Full system upgrade
pacman -Sy
pacman-db-upgrade

pacman -Syu

Sometimes you may encounter an error similar the following. This one can be fixed by removing a single file.

error: failed to commit transaction (conflicting files)
initscripts: /etc/profile.d/locale.sh exists in filesystem
Errors occured, no packages were upgraded.

This one can be fixed by removing a single file /etc/profile.d/locale.sh and retry pacman -Syu

other pacman errors:

error: could not determine filesystem mount points
error: not enough free disk space
error: failed to commit transaction (unexpected error)
Errors occurred, no packages were upgraded.

Solved by commenting out CheckSpace

Arch installation complete

  • At this point Arch is installed and you are ready to customise arch with what ever packages you want.
  • This is a good time to install graphics drivers before installing xorg or any packages that depend on xorg. Arch Linux ATI Catalyst

Further customisation

edit /etc/profile add a line

export EDITOR=vim

Other packages

pacman -S net-tools kde xf86-input-evdev alsa-utils xorg mesa-demos \
dhclient wpa_actiond ifplugd acpi firefox thunderbird htop vim vlc amarok \
libreoffice wpa_supplicant lm_sensors fakeroot patch k3b dvd+rw-tools \
virtualbox java-environment pidgin smbclient \
libdvdcss gtk-gnutella rtorrent iperf tightvnc x11vnc gimp tftp-hpa rsync \
samba fail2ban nmap wipe hddtemp git-core unrar htop

1) gstreamer

1) jre7-openjdk

Enable sudoers group

groupadd sudo
sed 's/^# \(%sudo.*\)/\1/g' -i /etc/sudoers

Enable Wireless (wpa_supplicant)

Example network file for wireless /etc/network.d/examples/wireless-wpa-config

cat > /etc/network.d/wpa_suppl << EOF
CONNECTION='wireless'
DESCRIPTION='A wpa_supplicant configuration based wireless connection'
INTERFACE='wlan0'
SECURITY='wpa-config'
WPA_CONF='/etc/wpa_supplicant.conf'
IP='dhcp'
# Uncomment this if your ssid is hidden
#HIDDEN=yes
EOF

sed 's/^\(#NETWORKS=.*\)/\1\nNETWORKS=(wpa_suppl)\n\nWIRELESS_INTERFACE="wlan0"/g' -i /etc/rc.conf

Make KDE start automatically

Edit /etc/rc.conf and add kdm to the DAEMONS line.

Example DAEMONS line ins rc.conf

DAEMONS=(hwclock syslog-ng network net-profiles sshd rpcbind netfs dbus crond kdm)

Add user

Adduser example

adduser user
usermod -G sudo -a user

Old useradd example

#useradd -m -g users -G audio,lp,optical,storage,video,wheel,games,power -s /bin/bash user
#mkdir /home/user
#chown user:user /home/user
#passwd user

Set user editor

su - user
cat >> ~/.bashrc << EOF

export EDITOR="nano"
EOF

Ext4

You can use ext4 with TRIM on an SSD

nano /etc/fstab

add discard mount parameters. e.g.

UUID=34e9c8f2-2ed3-4bca-b4be-5667ab3e2bde / ext4 defaults,discard 0 1

or tune2fs it

tune2fs -o discard /dev/sdaX