0

I'm trying to create a customized package of CentOS 7, which could be placed in an internal hard drive of a non-virtualized server, and booted to RAM using a bootloader (e.g. grub) in a UEFI environment.

The emphasis is to create a single package (e.g. ISO, initramfs or something) which could be booted from a hard drive to RAM, so that every boot would guarantee that a predefined OS would be loaded. This means that no modified settings or files would be saved (persistent), other than log files, which would be redirected to a hard drive. The amount of RAM is not going to be an issue.

The Requirements: 1) OS is Rhel/Fedora/CentOS 2) OS is not installed on a hard drive, is loaded to RAM (e.g. tmpfs) 3) OS is booted from a single file/package at boot

What I have tried thus far: Using a VMware virtual machine, I have created a minimal custom Live ISO image of CentOS 7, using a kickstart script to define the settings and contents of the image, and used livecd-creator to create the actual Live ISO.

I've also downloaded a official CentOS-7-x86_64-LiveKDE-1810 ISO for testing to see if I could get a CentOS based live ISO to boot from a hard drive in the first place.

Both of these ISOs work if mounted and booted from a CD/DVD Drive on a VMware virtual machine as well as in a typical server hardware.

The errors I run into: Having tried different types of grub menuentries with different kernel parameters, I haven't managed to get either one of these ISOs to boot from an internal hard drive. I don't know if the problem is in the ISO files, the kernel parameters in the grub menuentries or in both.

Examples of menuentries I have tried, and the URLs from which I found them:

http://man7.org/linux/man-pages/man7/dracut.cmdline.7.html

#iso-scan/filename
#Using iso-scan/filename with a Fedora/Red Hat/CentOS Live iso should
#just work by copying the original kernel cmdline parameters

menuentry 'Custom Centos7 {
 insmod iso9660
 insmod loopback               
 set isolabel='live_ks-x86-201902131038'
 set isofile='livecd-live_ks-201902131038.iso'
 loopback loop (hd0,gpt3)/images/$isofile
 linuxefi (loop)/isolinux/vmlinuz0 boot=isolinux iso-scan/filename=$isofile root=live:LABEL=$isolabel rd.live.image 
 initrdefi (loop)/isolinux/initrd0.img
}

The above menuentry leads to a situation where the boot displays the following message:"dracut-initqueue[409]: /sbin/iso-scan: line 37: rmdir: command not found. I'm not sure what this means..

If I try the above with the LiveKDE ISO, e.g. changing the following:

set isolabel='CentOS-7-x86_64-LiveKDE-1810' set isofile='CentOS-7-x86_64-LiveKDE-1810.iso'

I get an error: "dracut-initqueue[749]: mount: you must specify the filesystem type". This persists even if I specify the filesystem type with rootfstype, e.g.:

linuxefi (loop)/isolinux/vmlinuz0 boot=isolinux iso-scan/filename=$isofile root=live:LABEL=$isolabel rd.live.image rootfstype=auto

I've also tried the different entries from here: https://gist.github.com/Pysis868/27203177bdef15fbb70c

menuentry "CentOS 7 test" {
set isolabel='live_ks-x86-201902131038'
set isofile="/images/livecd-live_ks-201902131038.iso"
loopback loop (hd0,gpt3)$isofile
linuxefi (loop)/isolinux/vmlinuz0 noeject inst.stage2=hd:LABEL=UNJEB:$isolabel
initrdefi (loop)/isolinux/initrd0.img  

Also tried the above with: linuxefi (loop)/isolinux/vmlinuz0 noeject inst.stage2=hd:LABEL=UNJEB:/$isofile

but both of these end in the following failed statement: "Failed to Switch Root: Specified switch root path /sysroot does not seem to be an OS tree, os-release file is missing". I'm not sure to which this refers to, so not sure where to check for the os-release file.

I have read that it's common to have the wrong label, so I have checked that the label of the ISO is correct by using losetup and blkid, e.g.:

sudo losetup loop8 /boot/images/livecd-live_ks-201902131038.iso
sudo blkid /dev/loop8

Other posts I've checked:

How do I boot from ISO file stored on hard disk?

https://www.centos.org/forums/viewtopic.php?t=55412

The Question: The problem is that I'm not sure if the problem is with the ISOs, the kernel parameters or both. Does somebody have working kernel parameters for a CentOS 7 Live ISO, which I could test and replicate? Or is there something I could check or modify in my initrd0.img file?

I also noticed that livecd-creator uses isolinux as a bootloader for the ISO, so it came to mind to try a different bootloader, e.g. syslinux, but I haven't got around to testing it.

Or would I be better of trying to achieve the goal with some other method e.g. adding all the necessary packages to initramfs and using that, or trying to boot a squashfs or something?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.