Wednesday, 10 April 2013

Archlinux instalation via chroot from other Linux.


I want to leave it here, in order to simplify my life if I decide to install Arch next time.

Initial assumption

Desired partition for Arch linux is /dev/mapper/vg-arch. 

Preparation
mount -t iso9660 -o loop arch.iso /mnt/archiso
cp -a /mnt/archiso ~/customiso
cd some partition with enogth free space on it
unsquashfs -d /mnt/archiso/arch/x86_64/squashfs-root root-image.fs.sfs
mkdir arch
mount -o loop squashfs-root/root-image.fs arch
mount -t proc none arch/proc
mount -t sysfs none arch/sys
mount -o bind /dev arch/de v
mount -o bind /dev/pts arch/dev/pts
cp -L /etc/resolv.conf arch/etc

Now we ready to chroot:

chroot arch bash
  
Installation process in chroot 
mount /dev/mapper/vg-arch /mnt
pacman-key --init
pacman-key --populate archlinux
pacstrap /mnt base base-devel

Since my root is on lvm partition I need to do additional work:
# Add lvm2 to HOOKS in file /etc/mkinitcpio.conf :
HOOKS="... lvm2 ..."
mkinitcpio -p linux
view raw arch_lvm hosted with ❤ by GitHub

 
Add arch kernel to grub2:
vim /etc/grub.d/40_custom
menuentry 'Arch-Linux' --class gnu-linux --class gnu --class os {
insmod part_msdos
insmod ext2
set root='(hd0,msdos5)'
search --no-floppy --fs-uuid --set=root uuid
linux /boot/vmlinuz-linux root=/dev/mapper/vg-arch ro
initrd /boot/initramfs-linux.img
}
update-grub
view raw edit_grub_conf hosted with ❤ by GitHub



When I ran grub update my ubuntu instalation also found installed arch and created entry for it in grub-config. But later I was able to load from entry created by me, but not from entry created by ubuntu.

So, we can now chroot in newly installed Archlinux. I was able use pacman normally only after I've disabled CheckSpace option in /etc/pacman.conf

 
Setup network:
# I do not like new naming convention for interfaces
# So next line allow to use old one :)
ln -s /dev/null /etc/udev/rules.d/80-net-name-slot.rules
pacman -S ifplugd
cd /etc/network.d
ln -s examples/ethernet-dhcp
systemctl enable net-auto-wired.service

Then I've configured system.

No comments:

Post a Comment