Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
grub2 could not find kernel image: linux
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
difficultcho
n00b
n00b


Joined: 15 Mar 2013
Posts: 9

PostPosted: Fri Mar 15, 2013 10:38 pm    Post subject: grub2 could not find kernel image: linux Reply with quote

I decide to upgrade my kernel from 3.5.7 to 3.8.2. After compiling and copying /usr/src/linux/arch/x86_64/boot/bzImage to /boot/linux-3.8.2-gentoo, I modified my /boot/grub/grub.conf file. I basically just kept the old configures and duplicated my old 3.5.7 kernel and rename them to 3.8.2.

What I hope is, in the bootloader screen, I would have two kernels to choose. In case this newly compiled kernel doesn't work, I can go back to my old kernel.

But I wasn't so lucky, and here is what happened when I followed the gentoo handbook:

After I edit /boot/grub/grub.conf, I ran "grub-install --no-floppy /dev/sda". I got an error "grub-install not found". I thought, oh, I need to emerge it again... And I did. After emerging grub (I should have noticed it is grub-2.0.0), I ran the command "grub-install --no-floppy /dev/sda" again. Same error. So I googled the error, some folk suggests use "grub2-install" instead of "grub-install". Without thinking, I tried it. Happily, I got it ran, and "no errors are reported".

Then I reboot my laptop, it went to "grub>" directly. If I "exit" from the grub prompt, it will just tell me "boot: Could not find kernel image: linux"

I tried "boot: linux-3.8.2-gentoo", doesn't work. May I ask how to get my kernel back? Thanks!
Back to top
View user's profile Send private message
666threesixes666
Veteran
Veteran


Joined: 31 May 2011
Posts: 1223
Location: 42.68n 85.41w

PostPosted: Fri Mar 15, 2013 11:07 pm    Post subject: Reply with quote

sudo mv /boot/linux-3.8.2-gentoo /boot/kernel-3.8.2-gentoo

do
http://wiki.gentoo.org/wiki/GRUB2_Quick_Start#Automating_Installs

sudo grub

sudo reboot

(or sudo mv /boot/linux-3.8.2-gentoo /boot/vmlinuz-3.8.2-gentoo but i use kernel and it works well, i know linux-3.8.2 will not work)
_________________
cat /etc/*-release
Funtoo Linux - baselayout 2.2.0
consider this warning no. 1
http://ecx.images-amazon.com/images/I/81Ku-vxIb3L._SL1500_.jpg
http://wiki.gentoo.org/wiki/Special:Contributions/666threesixes666


Last edited by 666threesixes666 on Sat Mar 16, 2013 10:35 pm; edited 2 times in total
Back to top
View user's profile Send private message
BillWho
Veteran
Veteran


Joined: 03 Mar 2012
Posts: 1600
Location: US

PostPosted: Fri Mar 15, 2013 11:07 pm    Post subject: Reply with quote

difficultcho,

Could you wgetpaste your grub.cfg and /etc/ftsab files :?:
_________________
Good luck :wink:

Since installing gentoo, my life has become one long emerge :)
Back to top
View user's profile Send private message
difficultcho
n00b
n00b


Joined: 15 Mar 2013
Posts: 9

PostPosted: Fri Mar 15, 2013 11:34 pm    Post subject: temporarily fixed it Reply with quote

Thank you guys for your prompt response!

I booted from a usb drive and reinstall grub-0.97-r12 and "grub-install" again.

So now I have my grub legacy and can select two kernels at the boot screen.

But I will try to install grub2 again later, and probably encounter the same problem again. From there, I will try your suggestions.

Thanks again!


Last edited by difficultcho on Sat Mar 16, 2013 1:11 am; edited 1 time in total
Back to top
View user's profile Send private message
666threesixes666
Veteran
Veteran


Joined: 31 May 2011
Posts: 1223
Location: 42.68n 85.41w

PostPosted: Fri Mar 15, 2013 11:39 pm    Post subject: Reply with quote

like i said, grub2 does not have a grub binary. dont do the above post if your using legacy grub.

Code:

mkultra@mksrv [ ~ ]$ locate grub | grep bin
/usr/bin/grub2-editenv
/usr/bin/grub2-fstest
/usr/bin/grub2-kbdcomp
/usr/bin/grub2-menulst2cfg
/usr/bin/grub2-mkfont
/usr/bin/grub2-mkimage
/usr/bin/grub2-mklayout
/usr/bin/grub2-mkpasswd-pbkdf2
/usr/bin/grub2-mkrelpath
/usr/bin/grub2-mkrescue
/usr/bin/grub2-mkstandalone
/usr/bin/grub2-script-check
/usr/sbin/grub
/usr/sbin/grub.backup
/usr/sbin/grub2-bios-setup
/usr/sbin/grub2-install
/usr/sbin/grub2-mkconfig
/usr/sbin/grub2-mknetdir
/usr/sbin/grub2-ofpathname
/usr/sbin/grub2-probe
/usr/sbin/grub2-reboot
/usr/sbin/grub2-set-default
/usr/sbin/grub2-sparc64-setup


&

Code:

mkultra@mksrv [ ~ ]$ cat /usr/sbin/grub
#!/bin/bash
DRIVE=$(cat /etc/mtab | grep boot | awk '{print $1}' | sed 's/[0-9]*//g')
mount | grep "/boot" /etc/mtab > /dev/null
if [ $? -ne 0 ]; then
sudo mount /boot
echo "installing grub to /boot"
else
echo "installing grub to /boot"
fi
if [ ! -d "/boot/grub2" ]; then
   mkdir /boot/grub2
   exit 1;
fi
/usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg
/usr/sbin/grub2-install $DRIVEmkultra@mksrv [ ~ ]$ cat /usr/sbin/grub.backup
#!/bin/bash
DRIVE=$(cat /etc/mtab | grep boot | awk '{print $1}' | sed 's/[0-9]*//g')
mount | grep "/boot" /etc/mtab > /dev/null
if [ $? -ne 0 ]; then
sudo mount /boot
echo "installing grub to /boot"
else
echo "installing grub to /boot"
fi
if [ ! -d "/boot/grub2" ]; then
   mkdir /boot/grub2
   exit 1;
fi
/usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg
/usr/sbin/grub2-install $DRIVE

_________________
cat /etc/*-release
Funtoo Linux - baselayout 2.2.0
consider this warning no. 1
http://ecx.images-amazon.com/images/I/81Ku-vxIb3L._SL1500_.jpg
http://wiki.gentoo.org/wiki/Special:Contributions/666threesixes666
Back to top
View user's profile Send private message
kurly
Apprentice
Apprentice


Joined: 02 Apr 2012
Posts: 164

PostPosted: Fri Mar 15, 2013 11:53 pm    Post subject: Reply with quote

You should never be manually writing to files in /usr/bin. Any such advice is dangerous and should be disregarded.
Back to top
View user's profile Send private message
666threesixes666
Veteran
Veteran


Joined: 31 May 2011
Posts: 1223
Location: 42.68n 85.41w

PostPosted: Sat Mar 16, 2013 11:28 pm    Post subject: Reply with quote

its in /usr/sbin, not /usr/bin ie only in roots path.

Code:

mkultra@mksrv [ ~ ]$ grub
bash: grub: command not found
mkultra@mksrv [ ~ ]$ sudo grub
installing grub2 to /dev/sda
Generating grub.cfg ...
Found background: /usr/share/backgrounds/nebula-1-1440x900.jpg
Found linux image: /boot/kernel-3.7.8
Found linux image: /boot/kernel-3.6.8
  No volume groups found
Found Windows 7 (loader) on /dev/sda1
done
Installation finished. No error reported.


the script in the wiki post is making

Code:

/usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg
/usr/sbin/grub2-install /dev/sda


to instead be "grub" shortening the list of commands to do, things to check, places to fail, reasons for broken startups requiring live cd to repair the system, forum posts on how to fix it. its not a binary, its a bash script. it automatically mounts /boot, to find and load your kernels, and ensures you have a /boot/grub2 directory as the package management system has failed to do so. its in /usr/sbin to make it system wide rather than in ~ and requiring su -c './grub' because its not in the users path.

to the admins, i did say what the problem was, the kernel is named linux-, not vmlinuz-(version number) or kernel-(version number)

how i know thats the problem.
Code:

cat /etc/grub.d/10_linux | grep kernel | head -n 2


in case you need to know exactly what you need to name the kernel. * means anything. it absolutely requires the -

mkultra@mksrv [ ~ ]$ ls /boot/
boot.0800 config-3.6.8 config-3.7.8 grub2 kernel-3.6.8 kernel-3.7.8

grub2 is smart enough to see that 3.7.8 is higher than 3.6.8 and uses the new kernel by default. (and has a option under the latest kernel to boot previous versions if the new one fails)


no need to edit any configs. just merge latest grub, then

(as root)
Code:

mount /boot && mkdir /boot/grub2 && /usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg && /usr/sbin/grub2-install /dev/sda


(or use this if boots already mounted from you dumping your shiny new kernel in it)
Code:

mkdir /boot/grub2 && /usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg && /usr/sbin/grub2-install /dev/sda


& for every time after

Code:

mount /boot  && /usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg && /usr/sbin/grub2-install /dev/sda


(or use this if boots already mounted from you dumping your shiny new kernel in it)
Code:

/usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg && /usr/sbin/grub2-install /dev/sda


like the script does. only that the script checks to make sure its sda, or sdb or sdc and to install to those accordingly, and removes this mess and confusion of all of this.

"You should never be manually writing to files in /usr/bin" good thing its a wget command, not manual editing like it used to be.
_________________
cat /etc/*-release
Funtoo Linux - baselayout 2.2.0
consider this warning no. 1
http://ecx.images-amazon.com/images/I/81Ku-vxIb3L._SL1500_.jpg
http://wiki.gentoo.org/wiki/Special:Contributions/666threesixes666
Back to top
View user's profile Send private message
kurly
Apprentice
Apprentice


Joined: 02 Apr 2012
Posts: 164

PostPosted: Sun Mar 17, 2013 2:13 am    Post subject: Reply with quote

666threesixes666 wrote:
its in /usr/sbin, not /usr/bin ie only in roots path.
good thing its a wget command, not manual editing like it used to be.

These are both irrelevant. You should not be directing users/admins/Satan/anyone to write directly to /usr on any package-managed system, no matter how you accomplish it. I apologize for saying "/usr/bin" when I should have said "/usr/sbin" or even just "/usr". The contents of your script are not dangerous, but the method you are using to distribute it reinforces very bad habits. Remember: Gentoo has a package manager. Creating arbitrary scripts that have name collisions with existing packages (whether or not you know them to be installed) is fraught with peril.

As a total side note, you do not need to manually create /boot/grub2, either. I switched one of my machines from sys-boot/grub:0 to sys-boot/grub:2 yesterday.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum