LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 12-13-2012, 09:43 AM   #1
onufry
LQ Newbie
 
Registered: Jul 2005
Posts: 10

Rep: Reputation: 0
Question Ubuntu 12.04 server. Residual hardware information in system image preventing boot.


Hello!

In short
I'm having a problem with booting up the Ubutu server 12.04 on different computer that was orignally installed.
The boot process hangs at upstart. Mountall spawns two processes that do not ever finish.


Background
The purpose was to make an image of system so it can be quickly deployed on several computers (computing nodes in cluster).

The installation was standard:
  1. partition for swap, and /
  2. minimal install + ssh server
  3. static IP
  4. ldap for user accounts
  5. nfs-mounted /home
At this point I tested everything (in computer A) and prepared system image:
Code:
tar -cvpzf /mnt/data/ubuntu-12.04-node.v1.tar.gz --exclude=/proc --exclude=/lost+found --exclude=/sys --exclude=/mnt --exclude=/media --exclude=/dev --exclude=/home --exclude=/tmp /
I made systemrescuecd-usb and booted up the computer B.
I made some scripts to do the work for me. In particular:
  1. To partition the hard drive with parted
  2. To make filesystems and mount dev/sda2 to /mnt/sys
  3. To extract system image:
    Code:
    tar -xpzf ubuntu-12.04-node.v1.tar.gz -C /mnt/sys/
  4. To make missing dirs (dev, proc, sys, ... )
  5. To delete MAC address associated with ethx
    Code:
    sed -i '6,$ d'  /mnt/sys/etc/udev/rules.d/70-persistent-net.rules
  6. To change IP in int /mnt/sys/network/interfacess
  7. To change hostname
  8. To chroot and install grub:
    Code:
    #!/bin/bash
    mount -o bind /dev /mnt/sys/dev
    mount -o bind /proc /mnt/sys/proc
    mount -o bind /sys /mnt/sys/sys
    
    cat > /mnt/sys/root/grubfix.sh << END
    #!/bin/bash
    update-grub2
    grub-setup /dev/sda 
    grub-install /dev/sda
    END
    
    chmod +x /mnt/sys/root/grubfix.sh
    chroot /mnt/sys /root/grubfix.sh
    
    rm -fr /mnt/sys/root/grubfix.sh
I confirmed the changes and rebooted the machine.


Problem
The boot process hanged just after "init-bottom .. done."

I managed to get more information by appending init=/bin/sh to the kernel line in grub.
I spawned new console at tty2
Code:
getty -8 -n -l /bin/sh 38400 tty2 &
And run the init in verbose mode:
Code:
exec init --verbose
It halted after spawning mountall deamon:
Code:
init: mountall state changed from spawned to post-start
The ps at tty2 told me that there are two mountall processes and one is "<defunct>"
Killing them did not change anything for the first one, and made "<defunct>" the second one.

I've run mountall --verbose at tty2 and got information that it stucks after reading and processing everything at /etc/fstab. It prints what is what (/, /dev, /proc, swap, ...) at that's it.

According to what I managed to google, I exprimented with fstab and even uninstalled nfs.
No effect.

I suspect that I missed some hardware realted infomration that should be deleted prior to booting on a different machine.

Any suggestions are very, very welcome.

Regards,
Onufry

Last edited by onufry; 12-13-2012 at 09:48 AM.
 
Old 12-17-2012, 08:29 AM   #2
dr_agon
Member
 
Registered: Sep 2007
Location: Poland
Distribution: Ubuntu LTS
Posts: 105
Blog Entries: 12

Rep: Reputation: 26
Forgive me for pointing out something you may find obvious, but since it hangs on mounting - nowadays linux installations create by default fstab entries with UUIDs of the devices to mount (also grub passes UUID to kernel root= parameter) - did you corrected it?
I frequently clone system between two machines, and I just converted everything to old "/dev/sd*" notation.

What are your kernel boot options?
 
Old 12-17-2012, 09:03 AM   #3
onufry
LQ Newbie
 
Registered: Jul 2005
Posts: 10

Original Poster
Rep: Reputation: 0
I don't mind at all. In fact, I'm still hoping it's something obvious.

Since I'm using the same layout for each computer I have written /etc/fstab with /dev/sdx's.
Also I did check if the grub.conf get generated correctly (with current machine UUIDs).

The boot parameters are default one. From the /boot/grub/grub.cfg:
Code:
menuentry 'Ubuntu, with Linux 3.2.0-34-generic' --class ubuntu --class gnu-linux --class gnu --class os {
        recordfail
        gfxmode $linux_gfx_mode
        insmod gzio
        insmod part_msdos
        insmod ext2
        set root='(hd0,msdos2)'
        search --no-floppy --fs-uuid --set=root 50447bf8-ed33-4e7b-acfc-a0a89a81a7c1
        linux   /boot/vmlinuz-3.2.0-34-generic root=UUID=50447bf8-ed33-4e7b-acfc-a0a89a81a7c1 ro   
        initrd  /boot/initrd.img-3.2.0-34-generic
}
As I've written, to debug I add the "init=/bin/sh" to the "linux" line.


Also. There are two updates.
1. Since I'm on a schedule for the deployment of this cluster, I did the "traditional" install for most of the nodes (kept one for testing). Of course they work without a question. I have limited time for testing now, but maybe in Jan/Feb I will diff (everything that can be diffed) between two fully deployed nodes.
2. I've got an idea today to cross check any threads regarding "making custom distro." I've come across:
http://en.gentoo-wiki.com/wiki/Custom_Stage4 which is in essence exactly what I've been doing. So I updated my scripts accordingly (things I did miss):
  1. before mounting /dev and chrooting
    Code:
    mknod -m 660 /mnt/sys/dev/console c 5 1
    mknod -m 660 /mnt/sys/dev/null c 1 3
    mknod -m 600 /mnt/sys/dev/initctl p
  2. and inside chroot
    Code:
    rm -fr /etc/mtab
    touch /etc/mtab

No effect. The boot process hangs at mountall.

Regards,
Onufry

Last edited by onufry; 12-17-2012 at 09:05 AM.
 
Old 12-18-2012, 12:24 AM   #4
dr_agon
Member
 
Registered: Sep 2007
Location: Poland
Distribution: Ubuntu LTS
Posts: 105
Blog Entries: 12

Rep: Reputation: 26
You can edit boot commands directly in grub shell when booting, and test if something helps. Try to replace the UUID with /dev/sd... and boot with "single" option.
Remove from /etc/fstab everything not necessary (you do not need swap or /home to test boot).
But I think you already checked this.

If you still have problem, try different way of cloning (if you have the same sizes of boot partitions on both machines).
  • boot both the source and target machine from some live linux distro to have the root partitions unmounted - I use SystemRescueCD
  • setup basic networking
  • duplicate the whole boot partition using dd and nc over the network (there are how-tos on the net, use 'conv=notrunc' option for dd)
  • optionally mount the target system partition and change the IP configuration (or just disconnect the cable to avoid IP conflict)
  • reboot target using live distro's grub to manually boot system from target HDD partition (set root= and supply correct 'linux' and 'initrd' lines)
In this way you avoid any configuration problems on the target partition you may have ommited or introduced after un-taring the backup, and you have the grub loader available (from live distro) to play with. It requires CLI and more keystrokes, but this is the method I use.
I know that it is not the solution, rather a workaround, but maybe it helps.
BTW: you can easily store the partition image to a file using dd and gzip to make a "snapshot" for recovery or cloning.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot Boot Ubuntu Server After Acronis Image VitalSpark798 Linux - Server 2 05-30-2009 04:34 PM
How to get hardware information in Ubuntu 8.04 kevin_chn Ubuntu 2 08-21-2008 03:08 AM
can`t boot into ubuntu- vista bootloader preventing it fullmetaljacket Linux - Newbie 15 07-07-2008 09:14 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 09:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration