LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-27-2006, 02:38 PM   #1
Peit
LQ Newbie
 
Registered: Oct 2003
Posts: 23

Rep: Reputation: 15
Question grub-install - old install has lost /dev/hdxx


Hello!

I'm trying to revive my Ubuntu install after i had to reinstall windows. I boot an Ubuntu live cd, and chroot into the installation. But i cannot run 'grub-install /dev/hda' because i seem to have lost the hard disk device files in /dev/. I have no idea how they disappeared.

I tried to symlink the /dev/hda file to /mnt/hda3/dev/ (the installation) before chrooting, but it makes grub-install hang.

Any idea's?

Thanks!
 
Old 08-28-2006, 05:37 AM   #2
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
Quote:
Originally Posted by Peit
I boot an Ubuntu live cd, and chroot into the installation. But i cannot run 'grub-install /dev/hda' because i seem to have lost the hard disk device files in /dev/. I have no idea how they disappeared.
I am not sure what you mean by "having lost the device files." I am not up to date on the 2.6 kernel, but my impression is that the newer kernels (or a process in user space) actually create the necessary entries in /dev dynamically. In the old days, if the files actually disappeared (seems unlikely) you would have had to recreate them. In either case, to do what you are trying to do, you must make sure that the partition which contains the /dev filesystem you will be using when you chroot is mounted dev rather than nodev, or you will not be able to access your devices when you chroot. If it has automatically been mounted nodev, you can change it with the mount command, specifying remount as one of the options, i.e.:

mount -o remount,dev{, other options} /dev/hda3

Quote:
I tried to symlink the /dev/hda file to /mnt/hda3/dev/ (the installation) before chrooting
No! Definitely not! (I don't know how to say that gently! )
 
Old 08-28-2006, 06:27 AM   #3
Peit
LQ Newbie
 
Registered: Oct 2003
Posts: 23

Original Poster
Rep: Reputation: 15
Thanks alot for the help blackhole54!

However, i did not succeed.

hda3 did not mount automatically when starting the live cd, so i mounted it myself using:

Code:
mount -t ext3 -o dev /dev/hda3 /mnt/hda3/
After that i chrooted into /mnt/hda3, but /dev/ (/mnt/hda3/dev/ actually) is still quite empty. I have only 157 devices listed there! I wonder how they got deleted...

Is there any way to get the devices back, or i should do a reinstall?

Quote:
Originally Posted by blackhole54
No! Definitely not! (I don't know how to say that gently! )
It seemed like a good idea at the time
 
Old 08-28-2006, 09:28 AM   #4
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
Quote:
Originally Posted by Peit
Is there any way to get the devices back, or i should do a reinstall?
Maybe a reinstall will ultimately be easier, but I do have something you might try first. Unfortuantely, I have no experience with this, just book learning. (Read: I just read the man page a few minutes ago! ) So you should probably check this out a little yourself before typing the commands.

I think the command you need is mknod. You need the "major and minor device numbers" for each entry you want to create. Should be documented somewhere ... Or I think you can probably just get them from a long ls output for the device from a running system. (For example, when I do

ls -l /dev/hda

it would apear the major,minor device numbers are 3,0.)

And then I think what you want to do, is with the partition mounted:

Code:
chroot /mnt/hda3 mknod -m 660 /dev/hda b 3 0
I am using /dev/hda as an example. You would need to do it for each device, or create a cleaver for loop. (As I said, I am not certain about this, but I don't think you are going to screw things up any worse than they are!) You might be able to do it w/o chrooting:

Code:
mknod -m 660 /mnt/hda3/dev/hda b 3 0
I would definitely try a single entry to see how it goes before trying to automate!

Quote:
After that i chrooted into /mnt/hda3, but /dev/ (/mnt/hda3/dev/ actually) is still quite empty. I have only 157 devices listed there!
The fact that there are any entries rather argues against my theory of them being dynamically created, I think!

Quote:
It seemed like a good idea at the time
Yeah, I've had a number of those in my time!

-------

If you do decide to try this I would be interested in how it worked (or failed).

Good luck!

Last edited by blackhole54; 08-28-2006 at 09:31 AM.
 
  


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
How can I install Grub to /dev/sda1 stardotstar Linux - Software 3 02-13-2006 09:55 PM
/dev/hdxx = partition name rblampain Linux - General 2 08-02-2005 11:27 PM
grub-install /dev/root auspicious Linux - Software 1 05-22-2005 06:21 AM
grub-install /dev/hda2 Please help !! mickeyboa Fedora 3 01-16-2005 02:41 AM
Grub Lost Fedora After Mandrake Install NinjaBaby Fedora 2 12-21-2004 09:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:25 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