mass producing linux

Place to discuss Fedora and/or Red Hat
Post Reply
byrdman
administrator
administrator
Posts: 225
Joined: Thu May 08, 2003 1:59 pm
Location: In the cloud

Post by byrdman » Mon Jul 13, 2009 1:40 pm

well, it looks like I might need help creating a single cd iso using kickstart. I used Revisor and kickstart config to create my first attempt of a bootable cd, but I am getting a Kernel Panic: not syncing: no init found. Try passing init= option to kernel...
Not to sure about this?
The attempt is to wipe the disk and install my very small iso that will just run the OS with firefox and apache pointed to itself.

here is my ks.cfg

Code: Select all

#platform=x86, AMD64, or Intel EM64T
#version=F10
# Firewall configuration
firewall --enabled --ssh
# Root password
rootpw --iscrypted $1$Ba0CpJrv$YZDM/CH8Q/rbmQqmevV..0
# Network information
network  --bootproto=dhcp --device=eth0 --onboot=on
# X Window System configuration information
xconfig  --defaultdesktop=GNOME --depth=32 --resolution=1024x768 --startxonboot
# System authorization information
auth  --useshadow  --passalgo=md5
# Use text mode install
text
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# SELinux configuration
selinux --disabled
# Install OS instead of upgrade
install
# Use CDROM installation media
cdrom
# Reboot after installation
reboot
# System timezone
timezone --isUtc America/Chicago
# System bootloader configuration
bootloader --location=mbr
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
part swap  --fstype="swap" --recommended --bytes-per-inode=4096
part /  --fstype="ext3" --grow --size=1 --bytes-per-inode=4096



%packages
@base-x
@editors
@gnome-desktop
@graphical-internet
@web-server
~
~

%end
Right before the 'Kernel Panic' message, it says, 'Failed to execute /init'

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Mon Jul 13, 2009 2:56 pm

I'll start working on this tonight and see what I can come up with. Were you working off of some sort of tutorial like this one?

http://fedoraproject.org/wiki/FedoraLiveCD/LiveCDHowTo

It might be easier to start with the rescue CD and customize it for this particular project. It's already a stripped down bootable CD with most/all of the tools we'll need. Should be able to just modify the startup to run our custom scripts/menus and include your ISO and away we go. I'll dig into making a custom version of the Rescue CD this evening during the rain delay of home run derby. ;)

byrdman
administrator
administrator
Posts: 225
Joined: Thu May 08, 2003 1:59 pm
Location: In the cloud

Post by byrdman » Mon Jul 13, 2009 4:05 pm

That would be awesome...for some reason, all my iso's I make with Revisor and Kickstart-conf seem to always panic the Kernel, which is causing my boss to panic! :)

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Mon Jul 13, 2009 11:33 pm

Well, I have been playing around a little and first thing I remembered is that there is no separate Fedora 10 rescue CD. I was able to take an existing Fedora 10 Live CD and modify it by changing the boot screen and booting into runlevel 3, remove packages, created a fake menu option to restore system, etc. I've got 2.2GB free so hopefully your disk image is that small.

Can you give me some specifics about the machines that will be wiped and replaced?

- How much RAM/Disk, do they have only CD or might they all have DVD drives?
- How large is the disk image you want to burn (after the file system is shrunk to just over the size of your data)?
- Can I assume one IDE hard disk?
- Are all of these machines configured pretty much the same?
- How much time do we have to get this recovery CD built?

I could whip up a few scripts/instructions on how to take a stock F10 Live CD image and extract it so it can be modified and then have another script that puts it back together into a "Kiosk-Restore.iso". I can list all of the things that I modify before it gets put back together. I figure if I had a test machine and your image (assuming it will fit in 2.2GB) I can have this done in another night.

Sorry I spent much of the night watching the home run derby. :)

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Tue Jul 14, 2009 7:58 am

If you want I'll try and list out all the steps I took to get the base kiosk restore ISO in the next few hours and post them here. Then all we have to do is add menu/scripts and disk image and you can do the testing and get it how you like. I was up until after 3:00am working on this but it should go pretty quick and painless if I get the steps written up well enough.

byrdman
administrator
administrator
Posts: 225
Joined: Thu May 08, 2003 1:59 pm
Location: In the cloud

Post by byrdman » Tue Jul 14, 2009 8:17 am

Most likely, these machines will only have CDROMs. They have 1GB of RAM and at least 30GB HDD.
They all have only one hard drive but some of the older ones would be IDE and some of the newer ones would be SATA. All the machines are configed very simple with XP Pro, 1 partition. The only type of connections we would configure them for is eth0 or possibly a Sprint Air card (Sierra Wireless 598 which loaded and worked on F10 in a laptop after 1 reboot.)

From what I am trying to get my builds to be are under 700MB (1 CD) but because someone brought up the issue that some might not be set to boot to CD first, to which someone else brought up the point that if we are going to have techs onsite, we might as well build USB devices and have them boot to USB...

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Tue Jul 14, 2009 8:28 am

Since I'm using the Live CD as a base you don't have to be limited to 700MB as it is a compressed file system (It will have to be under 700MB after compressing though). As I said, I have 2.2GB to play with on the compressed file system in the CD image the way I have it now. Either way the image would be pretty much the same on both CD and USB stick. Obviously you could go much bigger with a USB stick though. I'll try and get some directions together for creating the ISO image and test it.

byrdman
administrator
administrator
Posts: 225
Joined: Thu May 08, 2003 1:59 pm
Location: In the cloud

Post by byrdman » Tue Jul 14, 2009 9:12 am

We may go the USB route because on a test PC (similar to one that would be out in the field, the USB Boot device went to first in the boot priority list once it was put in) So I am redoing my image in Revisor as a 'Optical Live' (for some reason USB Live doesn't allow me to select it) and will let you know what happens.
Should I even be using Revisor? It seems that is what the google searches are returning when searching for 'creating a custom install cd fedora 10'
Also, if it is a Live version, can I get it to automatically install with the ks.cfg rather then running off of the USB...

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Tue Jul 14, 2009 9:59 am

Ok, here's how I stripped down a Fedora Live CD and converted it into a base Kiosk Restore CD (minus actual menu/scripts and image). You should probably do all of this on the same version of OS that the Live CD you are hacking is running but I'm not sure that it HAS to be the same.

1) Create a working directory and put a copy of the Fedora Live ISO there:

Code: Select all

[root@linux ~]# mkdir /iso
[root@linux ~]# cd /iso
[root@linux iso]# wget ftp://ftp.uci.edu/mirrors/fedora/linux/releases/10/Live/i686/F10-i686-Live.iso
2) Mount the ISO and copy the goodies out into a working Kiosk Restore Image Directory:

Code: Select all

[root@linux iso]# mkdir f10live
[root@linux iso]# mount F10-i686-Live.iso mnt -o loop
[root@linux iso]# mkdir Kiosk-Restore
[root@linux iso]# cp -a f10live/* Kiosk-Restore
3) You can modify the boot menu as needed by replacing Kiosk-Restore/isolinux/isolinux.cfg with my modified version:

Code: Select all

[root@linux iso]# wget http://voidmain.is-a-geek.net/files/Kiosk-Restore/isolinux/isolinux.cfg
[root@linux iso]# cp isolinux.cfg Kiosk-Restore/isolinux
4) Mount the compressed file system image and copy out the underlying ext3 file system so it can be mounted and modified:

Code: Select all

[root@linux iso]# mkdir mnt
[root@linux iso]# mount Kiosk-Restore/LiveOS/squashfs.img mnt -o loop -t squashfs
[root@linux iso]# mkdir squashfs
[root@linux iso]# cp -a mnt/* squashfs
[root@linux iso]# umount mnt
[root@linux iso]# mkdir ext3fs
[root@linux iso]# mount squashfs/LiveOS/ext3fs.img ext3fs -o loop
Now you have your 3GB ext3 Live root file system mounted so it can be modified as you wish.

5) First lets copy a new service script that will eventually have code to do the Kiosk Restore and fix selinux:

Code: Select all

[root@linux iso]# wget http://voidmain.is-a-geek.net/files/Kiosk-Restore/ext3fs/etc/selinux/config
[root@linux iso]# cp config ext3fs/etc/selinux
[root@linux iso]# wget http://voidmain.is-a-geek.net/files/Kiosk-Restore/ext3fs/etc/rc.d/init.d/kiosk
[root@linux iso]# chmod +x kiosk
[root@linux iso]# cp kiosk ext3fs/etc/rc.d/init.d
[root@linux iso]# wget http://voidmain.is-a-geek.net/files/Kiosk-Restore/ext3fs/usr/local/bin/kiosk-restore.py
[root@linux iso]# chmod +x kiosk-restore.py
[root@linux iso]# cp kiosk-restore.py ext3fs/usr/local/bin
To remove packages and change things just use the "chroot" command. CAUTION: Make sure you are in a chrooted window before removing packages or you will be removing packages from your host system rather than from the Live CD image. Same goes for setting root password disabling services and the rest of what is in the next step.

6) First lets just turn off services, set a root password (not really needed but can come in handy later for getting a normal logon shell) and add a service for our installation.

Code: Select all

[root@linux iso]# chroot /iso/ext3fs
[root@linux /]# passwd root (set a root password)
[root@linux /]# chkconfig --add kiosk
Use "chkconfig servicename off" to turn off any services that aren't in this list (again in the chrooted shell):

Code: Select all

[root@linux /]# chkconfig --list | grep :on
cpuspeed       	0:off	1:on	2:on	3:on	4:on	5:on	6:off
haldaemon      	0:off	1:off	2:off	3:on	4:on	5:on	6:off
irqbalance     	0:off	1:off	2:off	3:on	4:on	5:on	6:off
kiosk          	0:off	1:off	2:off	3:on	4:off	5:on	6:off
mdmonitor      	0:off	1:off	2:on	3:on	4:on	5:on	6:off
messagebus     	0:off	1:off	2:on	3:on	4:on	5:on	6:off
microcode_ctl  	0:off	1:off	2:on	3:on	4:on	5:on	6:off
setroubleshoot 	0:off	1:off	2:off	3:on	4:on	5:on	6:off
udev-post      	0:off	1:on	2:on	3:on	4:on	5:on	6:off
7) I removed all packages using "rpm -e" except for what is left in this list (again from within the chrooted shell):

http://voidmain.is-a-geek.net/files/Kio ... t/rpms.txt

(Above list created using "rpm -qa | sort > /root/rpms.txt" from within the chrooted shell). I removed NetworkManager as well but if you wanted to keep Networking on the bootable disk you might want to keep that and various other things.

Ok, now comes the fun (and easy) part, putting it all back together and testing.

8) Exit from your chrooted shell and unmount the ext3fs and create a new Kiosk-Resore.iso:

Code: Select all

[root@linux /]# exit
[root@linux iso]# rm /iso/Kiosk-Restore/LiveOS/squashfs.img
[root@linux iso]# mksquashfs /iso/squashfs /iso/Kiosk-Restore/LiveOS/squashfs.img
[root@linux iso]# mkisofs -o Kiosk-Restore.iso \
      -J -r -hide-rr-moved -hide-joliet-trans-tbl -V Kiosk-Restore \
      -b isolinux/isolinux.bin -c isolinux/boot.cat \
      -no-emul-boot -boot-load-size 4 -boot-info-table \
      /iso/Kiosk-Restore
If everything went right you should now have a base bootable restore CD that will simply boot quickly to a menu stub that does nothing (at the moment). If you press ENTER it will go to a text login screen where you can login with root and the password you set (but once menus/scripts are created there will be no need to logon). You can boot the ISO in QEMU without actually burning it to CD to test it:

Code: Select all

[root@linux iso]# qemu -m 512 --cdrom Kiosk-Restore.iso
I have one little quirk when booting it in QEMU is that the arrow keys do not work on the boot menu. The keypad arrows work though (everything works fine from a burned and booted CD).

Once you get to this place adding in your disk image is trivial and hooking in restore scripts (these would go in the kiosk service script).

Have fun!
Last edited by Void Main on Tue Jul 14, 2009 10:02 pm, edited 3 times in total.

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Tue Jul 14, 2009 10:04 am

PS. I think you can use the same script utility that dumps the regular LiveCD to USB pen to write this one to USB pen. I may have a couple of complaints if it's looking for a specific volume label as I changed the volume label but I think it should work. I'll try and test that this afternoon.

So basically you could make this work from either CD or USB pen.

byrdman
administrator
administrator
Posts: 225
Joined: Thu May 08, 2003 1:59 pm
Location: In the cloud

Post by byrdman » Tue Jul 14, 2009 10:17 am

starting on it now...one question, will what you just did format the HD and remove the partitions and install on the harddrive? I am downloading the iso so I will let you know

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Tue Jul 14, 2009 10:31 am

No, the script to perform those actions has to be created yet. Once you get everything extracted in these steps all you would have to do is make additions/modifications to the ext3fs and recreate the image. I didn't know if you wanted me to create those scripts or if you wanted to. It would be cool if I could get hold of your file system image and I could work on the scripts/menus. I guess I could just create any old minimal Linux install image in a virtual machine to use as a test.

byrdman
administrator
administrator
Posts: 225
Joined: Thu May 08, 2003 1:59 pm
Location: In the cloud

Post by byrdman » Tue Jul 14, 2009 10:40 am

NO, I could do it (I think) but wanted to knowif it was already done. would the scripts be similar to a kickstart config file?

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Tue Jul 14, 2009 10:52 am

No, they would just be a regular shell script that would perform the tasks that you wanted to do. I would create a script with a few menu options:

1) Restore Kiosk (erases hard drive)
2) Exit to text login

If they select option one it would roughly perform the following:

- Ask if they are sure they want to do it
- fdisk /dev/sda (or parted, etc) to wipe any existing partitions and create the new root and swap partition
- dd the image file to /dev/sda1 (if that is what you made your root partition)
- mkswap /dev/sda2 (if that is what you made your swap partition)
- resize2fs /dev/sda1
- install grub

Option 2 would just exit and give a login prompt where they could login as root and do whatever might be needed from a shell

It's possible a reboot would be necessary after the fdisk and that can be logically added into the script roughly as follows:

- after the fdisk send a message that system will be rebooted and restore will contine after reboot.
- "init 6"
- At the beginning of the menu script you could check to see if an ext3 partition is already on the hard drive and if it is continue the restore with the dd, resize2fs, mkswap, etc.

After it's finished you could send a message to remove the CD and reboot to hard drive. Is that roughly what you had in mind?

P.S. All of those steps should be able to be scripted so no user input is necessary.

byrdman
administrator
administrator
Posts: 225
Joined: Thu May 08, 2003 1:59 pm
Location: In the cloud

Post by byrdman » Tue Jul 14, 2009 11:27 am

For the most part, that is what I had in mind. Although it would be ideal if a normal employee at said location could just take {CD | USB Drive} and put it in the PC and rebooted. Its dangerous, I know but maybe having a menu that pops up and asks for a passphrase to continue would be better because I can just see USB drives getting in the wrong hands and someone giving it to their kids and the kids taking it home and rebooting and voila, their windows system is gone and they are now running linux....hey, we might be on to something! :)

Anywho...its doing the mksquash now so I will see where I am at once I am done. Thanks for all of this. this is incredible...my knowledge is growing so there must me some more live brain cells in my head!! :lol:

Post Reply