DebianThis forum is for the discussion of Debian Linux.
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 got a virus or something on my linux partition, so I had to reinstall windows, so I did. Then I realized that I had to reinstall grub, so I booted into knoppix and tried to run grub-install /dev/hda3. It didn't work, so I formated my /boot partition not thinking about the fact that my kernel is there. now I need to reinstall it, but i don't know how. I don't have a /usr/src/linux folder.
A virus on your Linux system? Highly unlikely, but there's always the proverbial exception...
Anyway, did you try installing grub as root? (or with the sudo command, provided Knoppix has that. Don't know about that). If all fails, re-installation isn't that difficult, just save your data on the Knoppix system before re-installing.
A virus on your Linux system? Highly unlikely, but there's always the proverbial exception...
Anyway, did you try installing grub as root? (or with the sudo command, provided Knoppix has that. Don't know about that). If all fails, re-installation isn't that difficult, just save your data on the Knoppix system before re-installing.
Sorry, I meant I got a virus on my windows partition.
OK. This might work or might not. Boot up knoppix on Live cd.
Download the kernel image and the grub package (grub stores a lot of its files on /boot so you need to reinstall that too), assuming you have etch 4.0 you want linux-image-2.6.18-4-zzz and grub
As root:
Code:
mount -v /dev/hdax /mnt/tmp
chroot PATH=/bin:/sbin:/usr/bin:/usr/sbin /mnt/tmp
Where hdax is your Debian root (/) partition
From inside the chroot, mount all of your other partitions /boot,/var,/usr,/tmp etc. Make sure you have mounted them all.
apt will work if you want to set up an internet connection inside chroot, but we already have the debs. So install them with
Code:
dpkg -i package1 package2
Once that is done:
Code:
grub-install (hd0)
Then you can exit chroot and everything should be working nicely. (We need a fingers crossed smiley)
Yes, open Synaptic and search for kernel or linux as keywords. Either one will give you a suitable kernel. But, that's not all! You also need the tools for making an initrd image and you'll need to make the /boot dir again. I think, given your inexperience, that re-installing Knoppix would be wiser and less time-consuming. It might not be the answer you're looking for because you don't learn anything from that, but for something complicated as this you lack the skills to do it properly. Over time you'll acquire those skills, but for now you're better of as a regular user IMHO.
<edit>@Daws: he's using Knoppix on his harddrive, so no Etch.</edit>
Last edited by Dutch Master; 04-21-2007 at 08:26 PM.
Daws: he's using Knoppix on his harddrive, so no Etch.
Oh yeah, well same procedure just different packages to download. Or he could just reinstall... (boooring)
EDIT:
Quote:
You also need the tools for making an initrd image
I didn't mention that because dpkg should automatically handle that. If its just /boot that was wiped then the rest of the system is still intact, initramfs/yaird/? included.
Oh come on Dutch Master, he'll learn a lot and maybe have a bit of fun fixing this!
Here are a few things that you may have to do get all the way there if there's not enough in Daws' post.
From a knoppix terminal:
Code:
su
mount /dev/hda1 /mnt (or hda2 or whatever)
mount --bind /dev /mnt/dev
mount -t proc proc /mnt/proc
mount -t sysfs sysfs /mnt/sys
chroot /mnt
mkdir /boot
cd /var/cache/apt/archives
Install the linux-image you want with dpkg -i as per Daws post.
Install grub and run grub-install (hd0) as per Daws.
You may also need to install initramfs-tools and run "update-initramfs -u -k all".
And let us know on either success or failure. I haven't had to do quite what you're doing, but I've done stuff kinda close, so let us know what works!
okay, I'm not sure if this has worked yet, but what I did was
mount /dev/hda2 /mnt/root
mount /dev/hda4 /mnt/root/boot
mount -t proc none /mnt/root/proc
chroot /mnt/root
apt-get install linux-image-2.6.18-4-386
apt-get install grub
right now it says it's generating menu.lst, but it's been doing it for a while.
Last edited by zoidburg016; 04-21-2007 at 09:01 PM.
This has an easy easy solution. If the only thing you lost was your /boot partition then you are perfectly safe. The /boot partition actually does not hold your kernel, just some vital information about the kernel needed to boot. Your actual kernel is located in /lib/modules/2.6.x - And you should have a .deb package containing your custom kernel in the /usr/src dir. If not, you can download a stock kernel from http://packages.debian.org
1) bootup using the knoppix livecd
2) As Daws said:
Quote:
Originally Posted by Daws
Code:
mount -v /dev/hdax /mnt/tmp
chroot PATH=/bin:/sbin:/usr/bin:/usr/sbin /mnt/tmp
Where hdax is your Debian root (/) partition
From inside the chroot, mount all of your other partitions /boot,/var,/usr,/tmp etc. Make sure you have mounted them all.
What this does is put you in your real installation (as if you never booted from the livecd). Make sure /mnt/tmp exists (mkdir /mnt/tmp).
3) Run grub-install
Code:
grub-install (hd0)
This will build your default grub again inside /boot and it will install the grub image to MBR of hd0 overwriting the Windows mbr.
4) Install your kernel again from the .deb (either the custom one you built in the past, or a new stock from http://packages.debian.org). This step will fill up the /boot partition again with your kernel information and automagically update grub for you.
5) Reboot and take out the livecd to boot to your real system.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.