Tring to use USB key as a master for many installations

Go there if you encounter an unexpected error when using the softare. For installation problems, use another forum.

Moderator: feffer

Post Reply
siberian
Posts: 2
Joined: Thu Apr 01, 2010 9:51 pm

Tring to use USB key as a master for many installations

Post by siberian » Thu Apr 01, 2010 10:28 pm

Hi ppl,
I'm new here... forgive me if this matter is OT or this is the wrong section of the forum.
Here is my problem: I'm trying to create a master usb key from which I'll have to install pre-configured ubuntu 9.10 (on an ext3 partition) on many PCs.
Everything seems to work fine: I boot from my pendrive, then a script starts automatically doing these operations (among other things):

Code: Select all

sudo swapoff -a
sudo dd if=my_mbr of=/dev/sda bs=512 count=1
#sudo mkfs.ext3 /dev/sda2
sudo partimage -g0 -b -f3 restore my_image /dev/sda2
sudo tune2fs /dev/sda2 -U my-uuid
sudo halt
As I've said, I get no error, everything goes fine, but, when I reboot the system, grub shows the menu -it shouldn't- and it doesn't start automatically, when I hit enter the boot is very very slow.
Sometimes just a reboot fixes the problem, while sometimes I have to run

Code: Select all

grub-install /dev/sda
I've tried to add

Code: Select all

sudo mount /dev/sda2 /mnt/sda2
sudo grub-install --root-directory /mnt/sda2 /dev/sda
to my startup script on the usb key without any luck.

Any suggestion?

Thank you :)

feffer
Posts: 126
Joined: Tue Mar 17, 2009 4:30 am

Post by feffer » Fri Apr 02, 2010 4:34 pm

I haven't heard much about partimage being used this way. More common is something like clonezilla server, and others. Partimage is not being actively developed, but it sounds like it is working for your purpose.

Partimage copies at the block level, so unlike file-level copy, it will get the mbr. So unless the mbr is going on a different partition from the system you are restoring, I don't think the "dd if=my_mbr...." is necessary.

Grub is going through a transition, of course. I forgot whether ubuntu 9.10 is fully grub2 or not, but that might be an issue. Also insserv is new and makes the boot faster, but on the first boot, it spends time to get its ducks in a row. That might explain the slow initial boot. Of course, if these issues and maybe others were ironed out before saving the master image, they shouldn't be showing up in the restores. So maybe go back to your original system, work with it a bit more and then make a new master image.

Finally, it's probably necessary to do some tweaking on your cloned machines, no matter how good your master image is. Anyway, those are my thoughts. If you get it working, please post your solution.

Regards,
feffer

siberian
Posts: 2
Joined: Thu Apr 01, 2010 9:51 pm

Post by siberian » Tue Apr 06, 2010 8:53 pm

Thank you for your answer.
Your considerations are right, but still something was wrong with my work.

After a few days off, I've found a solution. Actually it wasn't a partimage related problem: when the system booted after the recovery, the swap partition wasn't correctly set up.
Adding

Code: Select all

sudo mkswap /dev/sda1 -U original-swap-partition-uuid
to my script solved the problem.

I've changed the grub part too:

Code: Select all

sudo mount /dev /mnt/sda2/dev -o bind
sudo mount /proc /mnt/sda2/proc -o bind
sudo mount /sys /mnt/sda2/sys -o bind
sudo chroot /mnt/sda2 grub-install /dev/sda
as I suspect

Code: Select all

sudo grub-install --root-directory /mnt/sda2 /dev/sda
is somehow not working properly for me.

After that, everything went fine and no tweaking is needed on the cloned machines.

Regards.

Post Reply