Tried to patch my kernel and probably failed : what do ?
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.
Tried to patch my kernel and probably failed : what do ?
Ok here's the problem : I tried to patch the kernel of my Debian server with GrSecurity but when I rebooted I couldn't SSH the server anymore, but my host has a rescue system that lets me SSH the server so I can fix things.
So maybe the kernel patching failed, maybe it's a only a problem with Grub.
I don't really know what to do to fix this. If I messed up the kernel what can I do ? Can I just fix the problem by modifying the grub entries to only boot on the old kernel (I don't even know if it's here anymore, I'm quite the n00b) ?
Well for now I'll just try to mount the partitions (won't let me do "mount: can't find /dev/sda1 in /etc/fstab or /etc/mtab" )
Help, hint, tips appreciated !
edit : to be clearer my main question is : how can I determine if it's because the kernel is messed up or because the system wouldn't boot properly ?
edit 2 : is there a way to create a log of what happens at boot so I can have an idea about what's wrong ?
Last edited by User-N@me; 06-01-2011 at 02:45 PM.
Reason: editing out the word that rhymes with duck
Tip no 1. Don't type 'the soldier's four letter word' that rhymes with duck
Tip no 2. cd to kernel top source, and run this command
Quote:
find -name '*.rej'
If there's none of those, chances are grsecurity went in ok. You can unpatch if it's a mess(man patch). I did grsecurity a long time back - on HLFS iirc. There are control utilities with man pages, and you can allow stuff and ban stuff - was it paxctl? Don't quote me.
Even if you give up on your local source tree, you can reinstall another or grab a tarball from kernel.org
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233
Rep:
well the simplest way would be to boot to the previous version of the kernel you had installed, unpached (you DID keep a copy right?)
otherwise you will have to install an un-patched copy of the kernel and try from there
i myself have never really patched a kernel but i have compiled them and usually i keep a backup of the previous kernel in /boot such that there is an entry for it in the grub boot menu to quickly and easily revert to in case something goes south.
I think I still have my old kernel because I installed a newer one that I downloaded and then patched, so even in the worse case I hope I will be able to use it back.
I'll try the grub stuff and tip n°2 after watching a movie, after 3 days doing nothing but server administration I need a break (the last 2 night I even dreamed about doing linux work, crazy 0_o ).
- find -name '*.rej' didn't find anything
- I activated bootlogd in the hope I could see what's going on and I got this "(Nothing has been logged yet.)" not about sure what it implies ...
So after this I tried to deal with GRUB2 but I don't really know what to edit (most stuff are scripts and the few .conf I can find I'm not supposed to edit... GRUB1 seemed much simplier to deal with ) so I just moved config-2.6.32.41-grsec, initrd.img-2.6.32.41-grsec, System.map-2.6.32.41-grsec and vmlinuz-2.6.32.41-grsec in another directory where I assume GRUB won't find them, but it didn't work, I still can't boot.
The worse is I don't even know if GRUB is even loading at all... how could I check that to know at least what is broken ?
What specific files should I check and edit in GRUB ? (assuming it's even loading)
Hmm ok I'm improving with the mounting and the chrooting, I realized that I hadn't mounted my partition where is all the content of usr, so now I can run stuff like update-grub (good news because grub2 really doesn't seem to be made to be edited via nano ...)
I just tried update-grub and got this
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.32-5-amd64
Found initrd image: /boot/initrd.img-2.6.32-5-amd64
grep: /proc/mounts: No such file or directory
grep: /proc/swaps: No such file or directory
Cannot find list of partitions! (Try mounting /sys.)
done
But I hadn't mounted the swap partition so I guess it's normal, but because of this I had the idea to check etc/fstab and I see no mention of the swap partition, do you guys think that it could be the problem : my server can't boot because for some reason it doesn't mount the swap at boot anymore ?
In fact my fstab file look fine, the strange one was the one from the virtual machine
I still have the same problem with update-grub even with the swap on. There's nothing in /proc/ but to fix that the only thing would be to boot the kernel right ? Considering I have mounted and chrooted every partition I have (exept sda2 which is "extended" I don't what it is and how to mount it) and activated the swap, can I boot my kernel in command line ? (how ?)
Ok so this was indeed a problem with fstab ! /proc wasn't mounted
So I added this line : proc /proc proc defaults 0 0
I can boot on the old kernel, not the new one though, in my sda5 the symbolic links to the kernel are only for the old kernel, I'll try to fix that, but at least the server is up !
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.