LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   /boot showing only grub folder and other files are not exist (https://www.linuxquestions.org/questions/linux-newbie-8/boot-showing-only-grub-folder-and-other-files-are-not-exist-923594/)

mandyapenguin 01-13-2012 08:38 AM

/boot showing only grub folder and other files are not exist
 
Hi..All,
Today in our office one of the PC(Ubuntu11.04) was not booting up and showing continuous blinking. Then I booted through Ubuntu11.04 Rescue CD and found I was able mount all partitions apart from /boot.
Here is the /boot and / partition details
Code:

/dev/sda1 is /boot  100 MB
/dev/sda2 is /  50 GB

Then I ran
Code:

fsck /dev/sda1
command to check the file system for /boot partition. It was prompting many times(nearly or more than 50 times) as whether yes or no to fix, then I killed the process and used
Code:

fsck -y /dev/sda1
It took a while and stopped itself. Then I mounted the /boot partition and found nothing was inside the /boot partition!!?,
Does this fsck command wiped out everything?
I unmounted the /boot partition and installed the grub using below steps
Code:

mount /dev/sda2 /mnt
mount /dev/sda1 /mnt/boot
grub-install --root-directory=/mnt /dev/sda

grub got installed successfully, Then I ran the below commands
Code:

mount --bind /proc /mnt/proc
mount --bind /dev /mnt/dev
mount --bind /sys /mnt/sys
chroot /mnt/ update-grub

Found it updated successfully. Then I unmounted all partitions and rebooted. But it is not booting and giving grub prompt
Code:

grub>
Then I again booted through rescue CD, and mouted /boot and / partitions as above and found apart from "grub" folder, the other files(abi-3.0.0-12-generic, memtest86+.bin, config-3.0.0-12-generic, memtest86+_multiboot.bin, System.map-3.0.0-12-generic, initrd.img-3.0.0-12-generic, vmcoreinfo-3.0.0-12-generic, vmlinuz-3.0.0-12-generic which are exist in the other machine) are not exist in the /boot partition. So please help me what can be done to recover other files and to make the system to boot up again.

FastCode 01-14-2012 08:00 AM

You should download kernel images for your distro from their site and install them.

the simple way:
Code:

mount /dev/sda2 /mnt
mount /dev/sda1 /mnt/boot
mount --bind /proc /mnt/proc
mount --bind /dev /mnt/dev
mount --bind /sys /mnt/sys
chroot /mnt
apt-get install linux-image-XXXX
update-grub

Should do the trick.

Don't forget to replace XXXX with kernel version or simply use aptitude

EDIT:
The {sometimes faster} way:
The other way(after chrooting):
They are already somewhere in pool directory in the rescue disk.
Copy them to /var/apt/cache/archive
And
Code:

mount /dev/sda2 /mnt
mount /dev/sda1 /mnt/boot
mkdir /mnt/cd
mount --bind /media/cdrom /mnt/cd
mount --bind /proc /mnt/proc
mount --bind /dev /mnt/dev
mount --bind /sys /mnt/sys
chroot /mnt
cp -r /cd/XXXX/pool/l/XXXX /var/cache/apt/archive
dpkg -i -GE /var/cache/apt/archive/linux-image*.deb
update-grub


mandyapenguin 01-15-2012 02:40 AM

Thank you very much FastCode
Code:

mount /dev/sda2 /mnt
mount /dev/sda1 /mnt/boot
mount --bind /proc /mnt/proc
mount --bind /dev /mnt/dev
mount --bind /sys /mnt/sys
chroot /mnt

Could you please guide me that how can I search the linux-image version from the internet for the below command
Code:

apt-get install linux-image-XXXX
Since I don't know the linux-image version, I installed aptitude package and ran the below commands
Code:

aptitude install linux-image
update-grub

Good Fix!, Now I got the grub menu and able to boot both of the O/S. Thanks for your kind assistance.


All times are GMT -5. The time now is 01:15 AM.