LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 06-01-2011, 02:18 PM   #1
User-N@me
Member
 
Registered: May 2011
Distribution: Cent0S, Fedora, Ubuntu, Debian
Posts: 32

Rep: Reputation: 0
Arrow 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
 
Old 06-01-2011, 02:37 PM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,142

Rep: Reputation: 2308Reputation: 2308Reputation: 2308Reputation: 2308Reputation: 2308Reputation: 2308Reputation: 2308Reputation: 2308Reputation: 2308Reputation: 2308Reputation: 2308
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
 
1 members found this post helpful.
Old 06-01-2011, 02:39 PM   #3
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233

Rep: Reputation: 406Reputation: 406Reputation: 406Reputation: 406Reputation: 406
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.
 
1 members found this post helpful.
Old 06-01-2011, 02:58 PM   #4
User-N@me
Member
 
Registered: May 2011
Distribution: Cent0S, Fedora, Ubuntu, Debian
Posts: 32

Original Poster
Rep: Reputation: 0
Thanks for the advices.

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 ).

Last edited by User-N@me; 06-01-2011 at 02:59 PM.
 
Old 06-02-2011, 07:46 AM   #5
User-N@me
Member
 
Registered: May 2011
Distribution: Cent0S, Fedora, Ubuntu, Debian
Posts: 32

Original Poster
Rep: Reputation: 0
Question

Update :

- 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)


I'm lost here

Last edited by User-N@me; 06-02-2011 at 07:51 AM.
 
Old 06-02-2011, 07:10 PM   #6
User-N@me
Member
 
Registered: May 2011
Distribution: Cent0S, Fedora, Ubuntu, Debian
Posts: 32

Original Poster
Rep: Reputation: 0
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 ?

Last edited by User-N@me; 06-02-2011 at 07:11 PM.
 
Old 06-02-2011, 08:28 PM   #7
User-N@me
Member
 
Registered: May 2011
Distribution: Cent0S, Fedora, Ubuntu, Debian
Posts: 32

Original Poster
Rep: Reputation: 0
Question

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 ?)
 
Old 06-02-2011, 09:32 PM   #8
User-N@me
Member
 
Registered: May 2011
Distribution: Cent0S, Fedora, Ubuntu, Debian
Posts: 32

Original Poster
Rep: Reputation: 0
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 !
 
  


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
Failed to start kernel 2.6.29 with android patch keblues Linux - Embedded & Single-board computer 1 11-18-2010 03:12 AM
How do i patch 2.4.21-37 kernel with antidote2 security patch suchi Linux - Kernel 4 09-05-2006 02:29 AM
portage patch failed to apply doralsoral Linux - Software 2 05-12-2005 03:27 PM
Unable to patch 2.6.11.7 kernel with Reiser4 mm patch SlackwareInAZ Slackware 9 04-26-2005 06:33 AM
debian-patch-debianlogo w/2.6.5 kernel-patch-lpp Outabux Debian 11 05-20-2004 01:21 PM

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

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