To install a new ArchLinux installation from an existing installation, one would generally use the method described on their wiki. https://wiki.archlinux.org/index.php/Install_from_Existing_Linux#Method_1:_Using_the_Bootstrap_Image

However, I am running an x86_64 installation, and I would like to create an i686 bootable USB stick. My first idea was to replace the x86_64 bootstrap image by the i686 bootstrap image. However, the resulting USB stick turned out to be x86_64. So, that’s not quite what I was looking for.

In order to create an i686 installation from an existing x86_64, one needs to adjust the /tmp/root.i686/etc/pacman.conf file ( or /tmp/root.x86_64/etc/pacman.conf for that matter) and change the Architecture line.

Architecture = auto

into

Architecture = i686

then run the pacstrap command as described on the wiki.

After pacstrap is finished, chroot into the installed system, and install the bootloader. I’m using syslinux for this.

sh-4.2# arch-chroot /mnt
sh-4.2# pacman -S syslinux
error: failed to prepare transaction (package architecture is not valid)
:: package syslinux-6.02-4-i686 does not have a valid architecture

The “Architecture” must also be set in the target installation. In the “base” installation, nano is the available editor. Run nano /etc/pacman.conf and modify the file, then we can install syslinux.

sh-4.2# pacman -S syslinux
resolving dependencies...
looking for inter-conflicts...

Packages (1): syslinux-6.02-4

Total Download Size:    1.09 MiB
Total Installed Size:   3.24 MiB

:: Proceed with installation? [Y/n] 
:: Retrieving packages ...

etc. etc. the installation continues normally.

Installing the bootloader can take a few minutes. Be patient.

sh-4.2# syslinux-install_update -i -a -m
Syslinux BIOS install successful
Boot Flag Set - /dev/sdc1
Installed MBR (/usr/lib/syslinux/bios/mbr.bin) to /dev/sdc

Now, we need a little configuration. We still have to create an fstab, and configure the bootloader. Since we’re going to boot from USB, I will be using UUID’s to identify the right volume.

[root@8570w andre]# blkid /dev/sdc1
/dev/sdc1: UUID="a7d9a26e-abb3-461b-aacd-1ae4fe96f2e4" TYPE="ext2" PARTUUID="b71a2cfb-01" 

/etc/fstab becomes

UUID=a7d9a26e-abb3-461b-aacd-1ae4fe96f2e4	/         	ext2      	rw,relatime,data=ordered	0 1

in /boot/syslinux/syslinux.cfg, set the right root device, so it looks like

    MENU LABEL Arch Linux
    LINUX ../vmlinuz-linux
    APPEND root=UUID=a7d9a26e-abb3-461b-aacd-1ae4fe96f2e4 rw
    INITRD ../initramfs-linux.img

I have tried to boot the resulting stick in qemu-system-i386, which fails, but it boots on real hardware. (To test this, I have enabled CSM temporary on my laptop)

Now, we are this far, we can start the second phase of the project.

« »