FedoraThis forum is for the discussion of the Fedora Project.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I've set up a working FC6 system which I am trying to clone onto some of my other machines. The problem is that the cloned systems are hanging during the boot process, even though the file system appears OK.
The procedure I'm following is as follows... This process has worked faultlessly for FC3/4/5 and I've done it *many* times on many different machines with different hardware without trouble.
1) Set up the FC6 system I want to clone. I custom-partition so that there's one "/" partition and a swap partition. "/" is formatted as ext3.
2) Boot knoppix on this machine. Mount the "/" partition and take a full tar backup onto a network partition.
3) Boot knoppix on the machine where I want to dump the clone and mount the network partition containing the cloned tarfile.
4) run fdisk to create "/" and a swap partition on /dev/hda. Format the "/" partition as ext3.
5) untar the tarfile off the network onto /dev/hda1 (the "/" partition).
6) run grub-install --root-directory=/mnt/hda1 /dev/hda
7) Reboot knoppix and the cloned fedora system should reboot happily - but it doesn't
During boot, the last few lines on the console read as follows:
blah blah blah
kjournald starting. Commit interval 5 seconds
EXT3-fs: recovery complete
EXT3-fs: mounted filesystem with ordered data mode.
Setting up other filesystems.
Setting up new root fs.
no fstab.sys, mounting internal defaults
Switching to new root and running init.
umounting old /dev
umounting old /proc
umounting old /sys
exec of init (/sbin/init) failed!!!: No such file or directory
Kernel panic - not syncing: Attempted to kill init!
And there it hangs...
The system from which I cloned displays exactly the same console output up until the "exec of init (/sbin/init) failed!!! (of course, it doesn't fail and continues)
For some reason, its not finding the "/" partition, but I'm sure "/" is there and its an identical clone of the source machine, including /sbin/init which apparently cannot be found. I'm betting there's something funny about the way I format the drive and restore the tarfile that breaks the way that FC6 boots, but which worked just fine under previous versions.
Any ideas or advice??? Is there another (better) way of cloning an FC5 system onto a different dimension hard drive?
(I've considered partimage, but my source disc is 40GB and I have several computers with smaller drives. Partimage won't restore to a smaller partition than the source. I think this is also the case with dd)
But you could, as far as I know, use dd to create a smaller image than 40GB, which would fit to the new drive. I think you can pass a parameter to dd that tells how much you want to copy.
You could also try out cpio archiving, I might not know it's every difference to tar but one thing is that tar refuses to archive special files whereas cpio doesn't. It's worth a try at least.
Code:
man cpio
helps you use it. Basic functioning:
Code:
ls | cpio -ov > archive.cpio
would create a file archive.cpio which includes every file that ls command produced (as a list). So first you'll create a list of files, then you'll pipe it to cpio and direct to a file. You could also (as root)
Code:
cd /
find ./ -name * | cpio -ov > archive.cpio
which should, if I'm right, create a list of every single file under root partition and create a cpio archive from them (read man find to make sure or find more information).
To unarchive a cpio archive file: first cd to the directory where you wish the contents to be unarchived (cpio has a switch to archive/unarchive the files so that they will get dropped back to exactly where they were on the copy-out'ed system): here we first move to root, then check out the contents of the archive (second line) and if it seems ok, the last line unarchives the contents.
Code:
cd /
cpio -ivt < /path/to/archive.cpio
cpio -iv < /path/to/archive.cpio
Try out and see if it works better (might not, but it's worth a try).
Thanks for the suggestions. I believe that dd makes a literal sector by sector copy of the drive without discriminating between empty and used sectors. So you can't use dd to copy from a large partition onto a smaller one, and you run into trouble copying from a smaller partition to a larger one too. As I understand, dd is designed to copy between like-sized partitions.
cpio generated the same results as tar. That is, a restored backup of FC6 it doesn't boot this way either.
I've now also tried restoring a tar backup onto *the same* partition that it came from. This also doesn't work with FC6 but as mentioned before, works with previous fedora versions!
I'm suspecting the problem has something to do with a difference between the knoppix 5.0.1 and FC6 versions of either
fdisk
mke2fs
tar
grub-install (or grub in general).
I've made progress on my own problem... still confused.. Can anybody help point out why this works...
Instead of booting knoppix 5.0.1, I have booted the FC6 installation disc and used rescue mode.
When the FC6 rescue mode found my /dev/hda1 partition, I told it to mount read-only.
At the command prompt, I immediately unmounted the partition, and formatted using the same mke2fs command I issued under knoppix.
Then I mounted my network nfs partition holding my tar backup and the newly formatted /mnt/hda1
I untarred the FC6 backup off the network partition onto the hard drive - again using an identical command as I'd folloed under knoppix.
I then tried to grub-install, and found a bug in the FC6 rescue disk.... The grub-install script looks for grub in /sbin/grub, yet it's located at /usr/sbin/grub. After manually copying /usr/sbin/grub to /sbin/grub, I ran the identical grub-install command that I'd run under knoppix.
I then rebooted - and FC6 came up perfectly.
So there's a difference between mke2fs, tar or grub between knoppix-5.0.1 and FC6. Which one is it and what is it that is different that's causing the problem???
Several days ago, I posted (above) that I'd made progress on restoring FC6 from a tar backup. Alas, it now looks as though this one occasion was a fluke. I have not been able to repeat it.
The symptoms are the same as noted before. When I tar up an FC6 installation, rebuild a hard drive using mke2fs and then untar back, the system won't boot. I've tried around ten more systems since my one success above, and all fail the same way. When I reformatted that one system that worked and tried again, it also failed using the same approach that worked before.
When I install FC6 off DVD, it works every time on all machines that fail to restore from tar backup.
I've got two old FC5 backups. Both of these untar and boot no problems on all machines.
I am now pretty sure its not grub. Grub seems to load the kernel and initrd OK every time. Its when changing over from the initrd filesystem to the hard drive that the boot hangs - allegedly not finding "/sbin/init".
I've been wondering whether the FC6 kernel has included some sort of mandatory selinux requirements that are not fulfuled when you simply do a mke2fs and restore from a security-unaware tarfile.
I also noticed that if I format the drive as an ext2 filesystem (ie don't use the -j parameter to mke2fs), then the FC6 boot craps out even earlier.
I am now pretty sure its not grub. Grub seems to load the kernel and initrd OK every time. Its when changing over from the initrd filesystem to the hard drive that the boot hangs - allegedly not finding "/sbin/init".
I've been wondering whether the FC6 kernel has included some sort of mandatory selinux requirements that are not fulfuled when you simply do a mke2fs and restore from a security-unaware tarfile.
I am doing a similar thing between 2 computers for testing purposes. I am using 'rsync', but that should'nt matter.
I use now FC6. I have selinux disabled, never tried it with selinux enabled.
The only times I had the 'kernel panic, not syncing' it was due to either a misconfigured '/etc/fstab' os a misconfigured '/boot/grub/menu.lst'.
Doenst look to be your problem, since you are cloning a /dev/hda1 to a /dev/hda1 in the new machine, which is not my case. I have to change '/etc/fstab' to mount the correct partitions, and in 'menu.lst' I have to take care of the lines 'root (hd?,?)' and 'kernel ....'.
Anyhow, since you restore thru knoppix, from knoppix do a 'chroot /mnt/hda1' and take a look at the new system.
A completely different problem are the hardware differences between the 2 machines and how the kernel modules are built.
A kernel will happily boot on a IDE disk, but it will fail on a USB disk (and probably SATA) if the usb kernel
driver is not built into the kernel or, if built as a module, in 'initrd'.
This will give a kernel panic, and it will not find '/bin'/init' because it can't mount the root file system.
It may just be an issue with the LABEL=/ thingy in /etc/fstab and /boot/grub/grub.conf .
I found that sometimes the copied system needs to have the /dev/hda1 ( or whatever ) instead of using LABEL=
At any rate, here's how I do it.
I make a gz file while still booted into my original system by using find and cpio. That saves me the step of booting up with a livecd.
echo -e "/mnt/backup/fedora\t192.168.0.0/24(ro,sync,nohide) ## use tab, not spaces" >/etc/exports
exportfs -ra
service nfs restart
Now, I bootup the client system using CD#1 and typing linux rescue to get to the command prompt. I like to use CD#1 as it has good nic detection and doesn't load up a bunch of stuff. If you want to use Knoppix, just boot into runlevel three ( knoppix 3 ) .
Once booted up, I format the partition, mount it and the nfs share which is located on the machine 192.168.0.1 .
Code:
mkfs.ext3 /dev/hda1
mkdir /mnt/hda1 /mnt/local
mount /dev/hda1 /mnt/hda1
mount 192.168.0.1:/mnt/backup/fedora /mnt/local
# Check to see if the nfs share shows up ok.
cd /mnt/local
ls
Now, you can proceed to unzip the backup into your new system...
After that is done, you need to change the hostname and empty existing ip/hw address info. This is done in the chroot environment.
Code:
chroot /mnt/hda1
mount -t proc /proc proc
# Change the hostname of the client machines. For example:
sed -i 's/sony/mudd1/' etc/sysconfig/network
# Check it
cat etc/sysconfig/network
# I empty these files because my original system has a static ip address.
# You may need to use system-config-network after booted into the new system.
>etc/sysconfig/network-scripts/ifcfg-eth0
>etc/sysconfig/network-scripts/ifcfg-eth1
# I edit the fstab and grub.conf using vi editor as indicated at the start of this post.
# Now, I exit the chroot environment and un-mount everything.
umount /proc
Ctrl d or type: exit
umount -a
Finally, I setup grub in the mbr.
At the prompt ( sh-3.1# ), it goes like this...
Code:
sh-3.1# grub
grub> find /sbin/init ### I do that just to see if grub can find my new system
grub> root (hd0,0)
grub> setup (hd0)
grub> quit
Reboot and try it. On the new system, it noticed a different video card and prompts me to reconfigure the xserver.
It may just be an issue with the LABEL=/ thingy in /etc/fstab and /boot/grub/grub.conf .
I found that sometimes the copied system needs to have the /dev/hda1 ( or whatever ) instead of using LABEL=
At any rate, here's how I do it.
I make a gz file while still booted into my original system by using find and cpio. That saves me the step of booting up with a livecd.
echo -e "/mnt/backup/fedora\t192.168.0.0/24(ro,sync,nohide) ## use tab, not spaces" >/etc/exports
exportfs -ra
service nfs restart
Now, I bootup the client system using CD#1 and typing linux rescue to get to the command prompt. I like to use CD#1 as it has good nic detection and doesn't load up a bunch of stuff. If you want to use Knoppix, just boot into runlevel three ( knoppix 3 ) .
Once booted up, I format the partition, mount it and the nfs share which is located on the machine 192.168.0.1 .
Code:
mkfs.ext3 /dev/hda1
mkdir /mnt/hda1 /mnt/local
mount /dev/hda1 /mnt/hda1
mount 192.168.0.1:/mnt/backup/fedora /mnt/local
# Check to see if the nfs share shows up ok.
cd /mnt/local
ls
Now, you can proceed to unzip the backup into your new system...
After that is done, you need to change the hostname and empty existing ip/hw address info. This is done in the chroot environment.
Code:
chroot /mnt/hda1
mount -t proc /proc proc
# Change the hostname of the client machines. For example:
sed -i 's/sony/mudd1/' etc/sysconfig/network
# Check it
cat etc/sysconfig/network
# I empty these files because my original system has a static ip address.
# You may need to use system-config-network after booted into the new system.
>etc/sysconfig/network-scripts/ifcfg-eth0
>etc/sysconfig/network-scripts/ifcfg-eth1
# I edit the fstab and grub.conf using vi editor as indicated at the start of this post.
# Now, I exit the chroot environment and un-mount everything.
umount /proc
Ctrl d or type: exit
umount -a
Finally, I setup grub in the mbr.
At the prompt ( sh-3.1# ), it goes like this...
Code:
sh-3.1# grub
grub> find /sbin/init ### I do that just to see if grub can find my new system
grub> root (hd0,0)
grub> setup (hd0)
grub> quit
Reboot and try it. On the new system, it noticed a different video card and prompts me to reconfigure the xserver.
Unfortunately, I haven't had good luck with this process. The error I receive is as follows:
(cd / ; find . -xdev | cpio -voc > /mnt/backup/fedora/linux.cpio.gz)
.
.
.
./mnt
./mnt/backup
./mnt/backup/fedora
cpio: mnt/backup/fedora/linux.cpio.gz: field width not sufficient for storing file size
If anyone knows why this happens, please let me know.
Gads, I hate it when people dig up my old posts so everyone can see how stupid they are.
Fist off, the LABEL=/ part is because the partitions are actually labeled at install time. You can do that manually when you create a partition.
For example:
Code:
e2label /dev/hda1 /
Just be aware that if you already have a partition labeled as / you need to give the next one another label like /1 and reference it accordingly in the /etc/fstab.
If you want to label swap partitions, I do it like this...
Code:
swapoff -a
mkswap -c -v1 -L SWAP-sda3 /dev/hda3
swapon -a
For the cpio part, you might have good luck with the print0 like this...
(cd / ; find . -xdev print0 | cpio -voc > /mnt/win/backup/linux.cpio.gz)
Figured I better check in with my progress as you were kind enough to reply.
Below is what I've tried:
To successfully use the command,
(cd / ; find . -mount | cpio -voc > /mnt/backup/fedora/linux.cpio.gz)
(mount same as xdev)
I had to nfs mount the directory /mnt/backup/fedora on the built system.
That appeared to have worked. Then everything thereafter also worked.
Thanks also for pointing out that the label may need to be /1 (it did).
Just used "e2label /dev/hda1 /1". The system now comes up, but I've
got some network issues I'll need to iron out.
Thanks again for all of your help. This looks like a winner.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.