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 » Mon Jul 20, 2009 12:41 am

After removing some unnecessary packages (a lot more could surely be removed) and copying the remaining directories/files to a new file system image (which basically is a full defrag) and bundling/compressing the entire installation it comes out to right around 500MB.

In tar.bz2 format the resulting archive is just under 450MB and with zip it's just over 515MB:

Code: Select all

drwxr-xr-x 6 root root      4096 2009-07-20 00:00 ubuntu
-rw-r--r-- 1 root root 449501531 2009-07-20 01:22 ubuntu.tar.bz2
-rw-r--r-- 1 root root 515427375 2009-07-20 01:25 ubuntu.zip
Extracted files that end up on NTFS (it's Fedora even though the directory is still named ubuntu):

Code: Select all

./ubuntu:
total 44
drwxr-xr-x 4 root root  4096 2009-07-20 00:50 disks
drwxr-xr-x 2 root root  4096 2009-07-19 23:32 docs
drwxr-xr-x 2 root root  4096 2009-07-19 23:59 install
-rwxr--r-- 1 root root 25214 2008-10-27 12:37 Ubuntu.ico
drwxr-xr-x 2 root root  4096 2009-07-19 23:29 winboot

./ubuntu/disks:
total 3270524
drwxr-xr-x 3 root root       4096 2009-07-20 00:03 boot
-rw-r--r-- 1 root root 3145728000 2009-07-20 00:43 root.disk
drwxr-xr-x 2 root root       4096 2009-07-19 23:46 shared
-rw-r--r-- 1 root root  200000000 2009-07-15 23:21 swap.disk

./ubuntu/disks/boot:
total 21320
-rwxr--r-- 1 root root  507665 2008-10-24 03:29 abi-2.6.27-7-generic
-rwxr--r-- 1 root root   90889 2009-07-16 20:10 config-2.6.27.5-117.fc10.i686
-rwxr--r-- 1 root root   91364 2008-10-24 03:29 config-2.6.27-7-generic
drwxr-xr-x 2 root root    4096 2009-07-20 00:04 grub
-rwxr--r-- 1 root root 6672121 2009-07-19 18:17 initrd-frankenstein.img
-rwxr--r-- 1 root root 8422867 2009-07-15 23:43 initrd.img-2.6.27-7-generic
-rwxr--r-- 1 root root  124152 2008-09-11 15:11 memtest86+.bin
-rwxr--r-- 1 root root 1029585 2008-10-24 03:29 System.map-2.6.27-7-generic
-rwxr--r-- 1 root root    1073 2008-10-24 03:31 vmcoreinfo-2.6.27-7-generic
-rwxr--r-- 1 root root 2570960 2009-07-16 20:10 vmlinuz-2.6.27.5-117.fc10.i686
-rwxr--r-- 1 root root 2244272 2008-10-24 03:29 vmlinuz-2.6.27-7-generic

./ubuntu/disks/boot/grub:
total 16
-rwxr--r-- 1 root root  191 2009-07-15 23:42 default
-rwxr--r-- 1 root root   30 2009-07-15 23:42 device.map
-rwxr--r-- 1 root root 5204 2009-07-19 18:28 menu.lst

./ubuntu/disks/shared:
total 0

./ubuntu/docs:
total 0

./ubuntu/install:
total 0

./ubuntu/winboot:
total 416
-rwxr--r-- 1 root root    806 2008-10-27 12:37 menu.lst
-rwxr--r-- 1 root root 192307 2008-10-27 12:37 wubildr
-rwxr--r-- 1 root root 209235 2008-10-27 12:37 wubildr.exe
-rwxr--r-- 1 root root   8192 2008-10-27 12:37 wubildr.mbr
As you can see the root filesystem is 3GB (when mounted it's 1.6GB used and 1.3GB free). If you don't defrag the partition before bundling it will not compress nearly as small when tarring or zipping.

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

Post by byrdman » Mon Jul 20, 2009 8:46 am

Sweet!! I know there are some out there looking for the ability to use wubi for fedora, but some that think its too cheese...
But now since I have a fedora player AND a ubuntu player, I am wondering which version to use? I think I know your opinion, but is doing what you did too much for what we need? or because it has been done once, is it easy to replicate?

Also, now that I have the ubuntu system working, how should I go about making an iso of it?

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 20, 2009 9:54 am

Actually I think my opinion might be to go with Ubuntu/Wubi for booting Linux on an NTFS partition. It's well tested and seems to work well and it's supported. I noticed that my Fedora setup sometimes hangs when I restart it (init 6). I haven't had a chance to look into it but it's something to do with not being able to unmount the file system or it unmounts too soon, etc. If you are feeling comfortable with the Ubuntu setup I would go with that.

One question, why would you want to make an ISO out of it? I thought this was something you would try and distribute over the network (500MB is a lot to send over the network though).

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

Post by byrdman » Mon Jul 20, 2009 10:28 am

I guess I meant how to customize the ubuntu setup with wubi exactly as I have it now(packages removed, firefox customized, cron jobs, etc.)

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 20, 2009 10:34 am

Do you mean so you can run the installer and have it install using Wubi? I guess I was thinking you wouldn't use Wubi to install it. You would just zip up the installation like I mentioned in the previous post and transfer it to the machine and then extract it and then modify the boot.ini (you also have to place the two grub4dos/Wubi boot files in the root directory).

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

Post by byrdman » Mon Jul 20, 2009 11:18 am

yes, your right...my apologies for miscommunicating. I guess how would I take the machine I have running ubuntu and all the stuff I modified and put it on another machine remotely.
Please excuse the ignorance with this because dealing with filesystems and images and all the stuff you are doing is fairly new to me. I would now have to get the running ubuntu system on a CD or usb drive, I can ship it up the the remote location, have them insert it, I can remote in and from there...? What would I do?

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 20, 2009 11:34 am

Sure thing. I'll make a step by step list of how I believe I would do what you are asking.

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 20, 2009 9:09 pm

Ok, there really isn't much to it. Once you boot to your wubi install and get everything set up exactly the way you want all you really have to do after that is reboot back into Windows and bundle up the two wubildr* files in C:\ and the entire C:\ubuntu directory structure. I just put them all into a zip file. The disk image can really be as large as you want with as much free space as you want and it should zip down to the same size as if you have a small file system with little free space. HOWEVER, in order for that to be true the file system has to be defragged.

So what I did was boot into Windows and copied the files I wanted to zip up to a Linux server where I could defrag the root disk image and create the zip file bundle with everything in it.

On the Linux server say you have a working directory /wubi and it is shared via Samba. While booted into XP on the wubi machine open \\linuxserver\wubi and copy These files/directories to that share:

Code: Select all

C:\wubildr
C:\wubildr.mbr
C:\ubuntu
On the Linux server you'll create a new blank file system image of whatever size you want (I'll make it 3GB) and then copy all the files off the old image onto the new image and discard the old image:

Code: Select all

[root@linserver ~]# cd /wubi/ubuntu/disks
[root@linserver disks]# mkdir mntold
[root@linserver disks]# mkdir mntnew
[root@linserver disks]# dd if=/dev/zero of=root.new bs=1M count=3072
[root@linserver disks]# mkfs.ext3 root.new
[root@linserver disks]# mount root.disk mntold -o loop
[root@linserver disks]# mount root.new mntnew -o loop
[root@linserver disks]# cd mntold
[root@linserver mntold]# cp -a * ../mntnew
[root@linserver mntold]# cd ..
[root@linserver disks]# umount mntnew
[root@linserver disks]# umount mntold
[root@linserver disks]# rmdir mntnew
[root@linserver disks]# rmdir mntold
[root@linserver disks]# rm root.disk
[root@linserver disks]# mv root.new root.disk
[root@linserver disks]# cd /wubi
[root@linserver disks]# zip -r kiosk wubildr wubildr.mbr ubuntu
Now you should have a "kiosk.zip" file in /wubi that should contain everything you need and it should be somewhere around 500MB in size. Copy that file by whatever means you can to another Windows machine and extract it to C:\. The only thing you should have to do to make it boot is add the line to your C:\boot.ini:

Code: Select all

c:\wubildr.mbr="Ubuntu"
Put that in the "default=" line if you want it to boot by default instead of XP so it ends up looking something like this:

Code: Select all

[boot loader]
timeout=10
default=c:\wubildr.mbr
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /noexecute=optin /fastdetect
c:\wubildr.mbr="Ubuntu"
That's pretty much it.

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

Post by byrdman » Tue Jul 21, 2009 4:26 pm

Well, after all day working with this...it failed... :(

Well not really all day, but it did take a while to copy and stuff. But after the splash screen it threw up an error...and it could be because I am on a different machine(?) They are both Intel boards but they could be different chipsets(?)
The error is as follows:

[code][quote]
Gave up waiting for root device. Common problems:
- Boot args (cat /proc/cmdline)
- Check rootdelay= (did the system wait long enough?)
- Check root= (did the system wait for the right device?)
- Missing modules (cat /proc/modules; ls /dev)
ALERT@ /dev/disk/by-uuid/2C883EB9883E80FE does not exist. Dropping to a shel!

Busy Box v....etc...etc...
(initramfs) _
[/code][/quote]

Any ideas? I will try again on a similar machine and see it that makes a difference.

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 21, 2009 5:32 pm

I think I know what is wrong and it should be an easy fix. The UUID would be different on a different machine and you'll have to change the boot/grub/menu.lst file to reflect what the UUID is of the disk you are sending the image to. I assume you didn't test this on the same machine you copied from? When I tested I copied back to the same machine. I should have thought of that! Now we have to figure out how to obtain the UUID of the disk from Windows.

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 21, 2009 6:34 pm

Well, I haven't yet found a way to get the disk UUID from within Windows but I may have found a better solution. Use the volume label instead of the UUID. This requires setting a volume label (if it doesn't already have one set) on your C: drive. I just set the volume label on mine to "C" and then in my ubuntu/disks/boot/grub/menu.lst changed the "root=UUID=XXXXXXXXXXXXX" in the kernel line to "root=LABEL=C".

That should do it. Sorry about that!

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

Post by byrdman » Tue Jul 21, 2009 9:25 pm

Hey, don't apologize for my lack of brain. I will try that tomorrow. Volume label is something we can easily get during install time.
Another question, could I get into the filesystem in a similar way to the 'hack live CD' tip you made?
because when I did mine, it zipped down to 1.7GB. I know I would have to remove some more stuff and change things like the user that it logs in as, etc...

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 Jul 22, 2009 5:45 am

You were into the filesystem if you followed those last instructions. You should currently have your /wubi/ubuntu/disks/root.disk. Just mount the root.disk "mount /wubi/ubuntu/disks/root.disk /mnt -o loop" and "chroot /mnt" and do your business and then "exit" to get back out of the chroot.

How much space is actually used on that filesystem? I can't imagine it only zips down to 1.7GB if you had done some cleanup and followed my instructions. After mounting the root.disk and before chrooting it do a "df -h /mnt" and copy paste the output here.

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

Post by byrdman » Wed Jul 22, 2009 4:34 pm

I wonder if I am missing a step...I tried the ubuntu zip again after I got in and removed a ton of packages, over 180MB, and the zip file was still at 1.7GB...
I will try again tomorrow...hmmm

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 Jul 22, 2009 4:45 pm

You forgot the step about copy/pasting the "df" output that I asked for. :) You can remove all the software you want and it's not going to zip any smaller if you don't do the defrag step (creating the new filesystem and copying the files over to it). The reason you have to do that is when you remove software it doesn't actually delete the data, it just frees up the inodes of the files removed.

Post Reply