mass producing linux

Place to discuss Fedora and/or Red Hat
Post Reply
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 Aug 04, 2009 6:07 pm

Also don't forget to make sure the LABEL= section contains the label of your C drive (mine is 'C').

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 Aug 04, 2009 9:16 pm

If you did want to use a newer kernel here is how you would replace the kernel modules in the initrd:

Extract the frankenstein initrd (assuming your zip archive structure working root dir is /iso/wubi-fedora):

Code: Select all

# mkdir /tmp/initrd
# cd /tmp/initrd
# zcat /iso/wubi-fedora/ubuntu/disks/boot/initrd-frankenstein.img  | cpio -idv
The modules are in the initrd image just like they are on the root file system. Usually there is just a minimal subset of modules in the initrd though. Just copy that same list of modules from the /lib/modules/<kernelversion> in the root file system image to the initrd image's /lib/modules/<kernelversion> then remove the old modules directory. If your root.disk file is mounted on /mnt/root and say you really wanted to use that new kernel you mentioned and it was installed in the image you could copy the necessary modules to the initrd directory structure like so:

Code: Select all

# cd /tmp/initrd/lib/modules
(make new kernel dir)
# mkdir 2.6.27.25-170.2.72.fc10.i686
(change into old kernel dir)
# cd 2.6.27.5-117.fc10.i686
(create same directories in new that exist in old)
# for i in `find -type d`; do mkdir -p ../2.6.27.25-170.2.72.fc10.i686/$i; done
(copy new modules with same name as old modules into new modules dir)
# for i in `find -type f`; do cp -a /mnt/root/lib/modules/2.6.27.25-170.2.72.fc10.i686/$i ../2.6.27.25-170.2.72.fc10.i686/$i; done
(remove old module directory structure)
# cd ..
# rm -rf 2.6.27.5-117.fc10.i686
Now you just have to create the new initrd from this directory structure:

Code: Select all

(go back to the root of the initrd directory stucture)
# cd /tmp/initrd
# find | cpio -H newc --quiet -o | gzip -9 > initrd-frankenstein.img
Now you should have a new initrd-frankenstein.img in the current directory with the new kernel modules. Replace the frankenstein image in your zip archive with this one and boot the new kernel. Don't forget to put the new kernel in your zip archive and set the menu.lst boot line to boot it.

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

Post by byrdman » Wed Aug 05, 2009 7:29 am

Slowly moving forward!! But learning a lot!! Thank you!
Another issue, I put the other kernel back in there and did everything like you mentioned but the Logical Volumes came back to bite me in the arse.
Should I rebuild the image machine, or since I have the root file system backed up, can I just format the original machine so it doesn't have the logical volumes in the partition tables

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 » Wed Aug 05, 2009 8:09 am

How are the logical volumes biting you? It's still just an ext3 file system. If you copied the "/etc/fstab" I mentioned into the image it *should* be fine I would think, unless there is something I am not thinking of. But yes, you can certainly re-install and partition the drive without logical volumes but you'll have to reconfigure and set everything back up.

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

Post by byrdman » Wed Aug 05, 2009 8:58 am

I did, but didn't I have to change the fstab because I was using Logical Volumes?

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 » Wed Aug 05, 2009 9:08 am

byrdman wrote:I did, but didn't I have to change the fstab because I was using Logical Volumes?
You have to use the fstab I pointed you to because the file systems are mounted completely differently. They are loop devices mounted on a NTFS fuse file system. The image you created from the logical volume drive *should* work if you replace the fstab with the one I gave you.

Also, I wonder if it wouldn't be wise to add "noselinux" to the kernel boot parameters.

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

Post by byrdman » Wed Aug 05, 2009 3:43 pm

Funny how when I follow your instructions, things just work!! :)

Now that we are down to the final stage of creation of this, I started thinking of what I can modify when I mount the root.disk and chroot into the filesystem? For example, I could not change the hostname by simply typing hostname {newhostname}
I was able to add users and such but was not sure of what I can change by doing a chroot?
Another question was can I delete everything out of the ubuntu/disks/boot folder? Except the vmlinuz-2.6.27.5-117...of course

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 » Wed Aug 05, 2009 3:49 pm

Well, you actually should be able to do just about anything you want in a chroot. You may have to mount /proc after doing the chroot though (unmount it again before exiting the chroot and before unmounting the root.disk). You change the host name in the etc/sysconfig/network file (HOSTNAME=xxxxx). You might want to add it to the end of the loopback address line (localhost) /etc/hosts also (don't remove localhost though).

Also, remember you can boot the image, change whatever you want, shut down and copy the image back to your archive directory structure and re-zip it.

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

Post by byrdman » Mon Oct 26, 2009 2:55 pm

been a while since I have done the images but wanted to ask another question...

I have a system that I have created as a default on how the system should be. I booted to this system via a Live Fedora 11 bootable USB drive.
I mounted the root filesystem as /mnt/root. I mounted the second usb as /mnt/usbstick.
I created a root.disk on the /mnt/usbstick and mounted that as /mnt/newroot.

When I try and cp -a /mnt/root/* /mnt/newroot/ the system freezes up and restarts X, thus killing my terminal session. Any ideas?

The goal is to get my default system's filesystem inside a F11 liveUSB so when I boot a new system with my USB drive, all I have to do is change the name and I am ready to go.

Make sense?

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 Oct 26, 2009 5:37 pm

Sounds like something is broke to me. :) Have you tried doing this same thing without X running? Compare the output of "dmesg" prior to doing the copy with the output after the problem.

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

Post by byrdman » Mon Oct 26, 2009 7:24 pm

its not really a 'freeze' or lock up, its more like the machine slowly gets slower until I have to reboot.

is there another way to get an image of this PC?

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 Oct 26, 2009 7:42 pm

What if you boot from a LiveCD or RescueCD and do the same copy?

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

Post by byrdman » Mon Oct 26, 2009 7:47 pm

here is what I am doing, just to recap incase I am missing something.

1. booting to a F11-LiveCD from USB
2. making /mnt/root; /mnt/usbstick; /mnt/rootdisk
3. mounting /dev/sda2/ (laptop's root filesystem - F11) to /mnt/root
4. mounting /dev/sdc2/ to /mnt/usbstick
5. dd of=/dev/zero if=/mnt/usbstick/root.disk bs=1M count=3072
6. mkfs.ext4 /mnt/usbstick/root.disk
7. mount /mnt/usbstick/root.dsik /mnt/rootdisk -o loop
8. cp -a /mnt/root/* /mnt/rootdisk/

the HD light flashes on the laptop and on the usbstick like its copying and after about 5-7 minutes, the laptop gets bogged down. Even in runlevel 3.
after 10 minutes, I have to powercycle, and start over.

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 Oct 26, 2009 8:07 pm

I assume when you say you are booting LiveCD from USB you mean from a USB pendrive. I am suggesting you boot from an actual CD and see if you have the same problem. Also, do you have any swap mounted and if so, where. Also when did ext4 enter the picture? I thought we were working with ext3. I have not yet used ext4 on anything as I've heard of people having problems with it in it's early stages.

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

Post by byrdman » Mon Oct 26, 2009 8:26 pm

yes, I am booting from a USB pendrive. maybe that's my problem. The F11 laptop, which doesn't have a cd drive, has the ext4 fs on it. can I make it ext3 with out a reload? if not, no biggie

Post Reply