While I have been teaching myself a little about linux, it's boot processes and service configuration I have been using arch linux in virtualbox for my experimentation.
Eventually after much wiling an gnashing of teeth I managed to get a fully functional minimal arch system to the point where I can build upon it as I would in most other distributions (boots, presents a console, has a functional package manager etc).
Since an arch install involves a lot of typing (when you fail at it many many times), I created a simple script on my bootable system (sdb disk) to make my life easier. This appears to work well but I am not familiar with the details of what is really going on. Before I pass on the script or any images I have derived from it's output, please could this script be reviewed for:
Any personal info or security keys etc being exported from my running arch distro into the new image
Any unpredictability in the scripts behaviour which might be dangerous
The use of a named target drive (sda) and the pathetic default root password is deliberate.
DO NOT RUN THIS IF YOU DO NOT UNDERSTAND EXACTLY WHAT IT WILL DO
#!/bin/sh # Setting keymap echo -- Setting keymap loadkeys uk.map.gz sleep 2 # Checking internet connectivity and synchronizing to network time echo -- Checking internet connectivity and synchronizing to network time ping -c 4 archlinux.org timedatectl set-ntp true sleep 2 # Wiping out whatever is on sda and creating GPT partitions # 4MB (BIOS BOOT) grub2 partition # 4GB (Linux filesystem) swap partition # 256MB (Linux filesystem) boot partition # rest (Linux filesystem) lvm2 physical volume echo -- Wiping out whatever is on sda and creating GPT partitions fdisk -l echo " p g n +4M t 4 n +4G Y n +256M Y n Y p w " | fdisk /dev/sda fdisk -1 sleep 2 # Creating the lvm2 volumes # Make a volume group vdisk from sda4 # Make a "main" logical volume of 5GB from the vdisk echo -- Creating the lvm2 volumes pvdisplay vgcreate vdisk /dev/sda4 pvdisplay vgdisplay lvcreate -L 5g vdisk -n main -y vgdisplay lvdisplay ls /dev/mapper sleep 2 # Formatting disks as swap/ext4 echo -- Formatting disks as swap/ext4 mkswap /dev/sda2 echo "y" | mkfs.ext4 /dev/sda3 echo "y" | mkfs.ext4 /dev/mapper/vdisk-main sleep 2 # Mounting the swap and filesystems in position for installation echo -- Mounting the swap and filesystems in position for installation swapon /dev/sda2 mount /dev/mapper/vdisk-main /mnt mkdir /mnt/boot mount /dev/sda3 /mnt/boot sleep 2 # Install arch linux packages to the new filesystems echo -- Install arch linux packages to the new filesystems pacstrap /mnt base lvm2 grub net-tools genfstab -U /mnt >> /mnt/etc/fstab cat /mnt/etc/fstab sleep 2 # chrooting into the installed base echo -- chrooting into the installed base echo ' # Set the time echo -- Set the time ln -sf /usr/share/zoneinfo/Europe/London /etc/localtime hwclock --systohc sleep 2 # Create locales echo -- Create locales sed -i s/#en_US.UTF-8/en_US.UTF-8/g /etc/locale.gen sed -i s/#en_GB.UTF-8/en_GB.UTF-8/g /etc/locale.gen cat /etc/locale.gen echo LANG=en_GB.UTF-8 > /etc/locale.conf cat etc/locale.conf locale-gen sleep 2 # Persist keymap echo -- Persist keymap echo KEYMAP=uk > /etc/vconsole.conf cat /etc/vconsole.conf sleep 2 # Set network configuration echo -- Set network configuration echo archbase > /etc/hostname cat /etc/hostname echo "127.0.0.1 localhost ::1 localhost 127.0.1.1 archbase.localdomain archbase" >> /etc/hosts cat /etc/hosts cp /etc/netctl/examples/ethernet-dhcp /etc/netctl/enp0s3 sed -i s/eth0/enp0s3/g /etc/netctl/enp0s3 cat /etc/netctl/enp0s3 netctl enable enp0s3 sleep 2 # Create the initramfs echo -- Create the initramfs echo "MODULES=() BINARIES=() FILES=() HOOKS=(base udev autodetect modconf block lvm2 filesystems keyboard fsck) " > /etc/mkinitcpio.conf mkinitcpio -p linux echo " root root" | passwd sleep 2 # Install the grub bootloader echo -- Install the grub bootloader echo " GRUB_PRELOAD_MODULES=\"\$GRUB_PRELOAD_MODULES lvm\" " >> /etc/default/grub grub-install /dev/sda grub-mkconfig -o /boot/grub/grub.cfg sleep 2 # done echo -- done exit ' | arch-chroot /mnt # Manually remove any other boot media and reboot system echo -- Manually remove any other boot media and reboot system