I'm attempting to create a liveCD (arch) intended to be installed frugally (to avoid messing with UEFI on my laptop, more precisely).
What I am currently planning to do:
pre-allocate a space for the medium, make an ext2 partition there, mount it, install to it as root (simply pacman -S base base-devel... with the mounted location as root).
Question 1: What bootloader should I use and how would I install it? Maybe I should make a partition table on the raw space?
Install all other needed packages, unmount it, then install it as a frugal install using unetbootin.
Question 2: is it going to be persistent this way?
Question 3: Is there any additional action needed for UNetbootin to make it bootable?
I may be able to provide some assistance, but I'm having trouble figuring out exactly what you are intending. The problem may be with my definition of "frugal install". I understand a frugal install to be the compressed disk image copied to a hard disk partition, and then you boot the image from that HD partition. I'm having trouble reconciling that definition of "frugal" with your desire to not mess with your UEFI and also with the pacman -S install you propose. I don't want to inadvertently send you down the wrong path If it turns out I can help.
I have booted disk images created by ARCHISO frugally, using both grub legacy and syslinux. I've never tried unetbootin as I make the boot media manually. I also have never played with an UEFI boot system so I can be of no help there. As I understand it neither grub legacy or syslinux will work (yet) with it.
Persistence is possible booting an image created by ARCHISO. If you've not already done so I'd suggest reading through the wiki page on ARCHISO, and also the external links at the bottom of the wiki article. I found them all most useful. I don't think the wiki goes much into persistence, but I can probably help there if that is what you want. The readme files shipped with ARCHISO are also a great source of information.
the goal I have for unetbootin is to install the ready ISO (it automatically handles the windows bootloader config)
I currently have two (possible) methods of making an image.
Way 1: manually creating an iso file (dd if=/dev/zero of=myiso.iso bs=1M count=(( desired size in MB )) ), creating a filesystem on it and installing to it as if to a hard drive after mounting it.
Way 2: mkarchiso ((manual setup, because I only want x86_64))
I want to have a working (preferably rw) image of arch, saved on an ntfs filesystem that I could boot to using the windows bootloader.
although I've switched to arch alone (no other OSs) on all but one of my computers, this one is a laptop. It has problems entering the BIOS and has the UEFI secureboot on. Although I turned secureboot off, I'm worries some windows drivers and a few features (such as the in-windows "reboot to EFI settings" button) may not be re-installed if I ever need windows again (as well as CUP8 for my college). As such, I would make a "frugal" or "loop" installation that would live on the SSD and then, possibly, just bump it's size up (if it's possible XD).
I'm familiar with the mkarchiso method (method 2), so I'll confine my response to that.
1) In the work/root-image/etc/mkinitcpio-archiso.conf file as described in the wiki you need to ensure that the hooks you provide will give you access to any device you are likely to need before you load your full system. The list I use is:
HOOKS="base udev timestamp memdisk archiso_shutdown archiso archiso_loop_mnt archiso_kms block filesystems usbinput"
Archiso changes now and again and I don't know if the list in the wiki is completely caught up. The list above worked as of 5 days ago.
2) In the work/iso/arch/boot/syslinux/syslinux.cfg file as described in the wiki you add a couple of extra entries as below:
APPEND archisolabel=MY_ARCH archisodevice=/dev/YOUR_DEVICE cowdevice=/dev/YOUR_DEVICE
Where YOUR_DEVICE is something like hda3, hdb1, etc (the actual NTFS partition you are using to hold your frugal install). The cowdevice is how you get your persistent memory.
3) Create the ISO using mkarchiso.
Now I'm getting outside my comfort zone. As I understand it UNetbootin should be able take that ISO and do a frugal install and set up your boot loader. Never used it myself so I can't really verify that. If it does I'd suggest maybe you want to use that tool and skip everything below. The APPEND line options above need to be provided as a kernel line option at boot. You need to make sure UNetbootin does that for you. If you never, ever intend to boot directly from your created ISO, and if you don't use the manual install method below, then step 2 is not strictly necessary. You must however make sure UNetbootin supplies the APPEND line options to the kernel at boot.
To do it manually:
4) Create a mount point for the ISO (I usually use somewhere in /tmp) and mount it using the command:
mount -t iso9660 YOUR_ISO MOUNT_POINT
Then copy everything from MY_ARCH to your frugal partition we've been calling: YOUR_DEVICE.
5) Enter the MY_ARCH directory on your frugal partition and find these files: archiso.img and vmlinuz. They will be buried depending on how you set up your file structure in mkarchiso. Copy or move them to be in the root of your frugal partition.
6) If you are using a bootloader that can redirect, like grub legacy, you just need to add an entry like this:
#(n) Your Frugal Install title Your title: root (hd1,1) kernel (hd1,1)/vmlinuz archisodevice=/dev/YOUR_DEVICE cow_device=/dev/YOUR_DEVICE archisobasedir=MY_ARCH ro initrd (hd1,1)/archiso.img
7) If you are using a bootloader like syslinux you need set up chain loading and it is a little more involved.
7a) Mount your YOUR_DEVICE to some where, lets call it YOUR_FRUGAL_DIR.
7b) First run extlinux on your frugal partition
extlinux -i YOUR_FRUGAL_DIR
7c) Find the files chain.c32 and menu.c32 on your source system and copy them to YOUR_FRUGAL_DIR
7d) Create a syslinux.cfg file in YOUR_FRUGAL_DIR that contains these lines:
timeout 1 ui menu.c32 LABEL Frugal LINUX ../vmlinuz INITRD ../archiso.img APPEND archisodevice=/dev/YOUR_DEVICE cow_device=/dev/YOUR_DEVICE archisobasedir=MY_ARCH ro
7d) Add an entry like this to your syslinux bootloader:
LABEL frugal MENU LABEL Frugal COM32 chain.c32 APPEND hd1 2
Hard drive and partition numbers should match your install and will not likely be the same as I've listed here. Note also that grub numbers drives and partitions starting at 0. Syslinux numbers drives starting at 0, but partitions starting at 1.
To reiterate, I've no experience with an UEFI machine, so you probably do not want to touch anything I've written in steps 4-7, but someone else may find it helpful. I think I've covered most everything. Hope you find something in here you can use.
The wiki is currently outdated, I used manual setup ( directly using mkarchiso ), everything went "according to plan" but when I got to creating the iso it wound up being 13mb large. Am I supposed to copy / move root-image into work/iso?
I beileve you are correct on the manual setup section of the wiki not being completely current. A couple of months back I remember having to add the -C switch (should point to a pacman.conf file) to all invocations of mkarchiso. I discovered this by looking through the script file build.sh supplied in archiso, which I only did when builds (see 3rd paragraph below) suddenly stopped working. That switch is not in the wiki text, and I seriously doubt that is the only change.
If you can run through the more automatic process using build.sh you should get a good ISO. You are correct, 13MB is too small. The smallest I've managed is about 100MB.
As an alternative, a week or so ago I finally completed and posted a series of build scripts that will allow one to specify packages in text files, and then automatically run through the archiso process to build an ISO. Link is here:https://bbs.archlinux.org/viewtopic.php?id=155865. I only suggest this as I'm actually at work right now (which I need to get back to) and then I'm tied up until very late this weekend before I'll be able to look into this in more detail.
I think I should add reviewing the wiki to my list of things to do.
I'll attempt your scripts. However, I'd like to take a look at my method one as well, because there's but very little missing.
Essentially, one can use an iso as a filesystem, simply with mkfs.ext2 myimage.iso .
We can install things to it and get it ready. Then something along busybox would be done. We can have a traditional iso with nothing but the kernel, a few base packages and isolinux which would just mount the image on root.
Or something similar. I'm unfortunately not familiar with the way images boot (a fairly big problem of mine). But if I manage to find a way to essentially "transform" an installation on an image into a bootalbe iso, I'll surely make my own script for it.
(( pardon my wording, I have slight problems with communication ))
Here's an update to the progress I've made in the 1st way:
install packages that are later included in the iso
create an iso that is bootable (with isolinux)
boot from required kernel
actually getting into the system (see note)
Right now my structure is
root (normal arch directories, you can look into your HDD root, well that) boot initrd.img kernel isolinux isolinux.bin isolinux.cfg
contents of isolinux.cfg:
default main label main kernel /boot/kernel append initrd=/boot/initrd.img
Code to generate ISO:
mkisofs -o test.iso -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -l root
Result: iso boots (qemu) and is capable of loading the kernels. However it dies right after because it can't find root ( ' ' ).
Right now I'm trying to figure out the proper way of making the device show up in /dev consistently (I can't find it at all atm though).
When this is done though, it should be fairly simple to make a small set of bash scripts that will do the job quicker and have persistence.