LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Laptop and Netbook
User Name
Password
Linux - Laptop and Netbook Having a problem installing or configuring Linux on your laptop? Need help running Linux on your netbook? This forum is for you. This forum is for any topics relating to Linux and either traditional laptops or netbooks (such as the Asus EEE PC, Everex CloudBook or MSI Wind).

Notices

Reply
 
Search this Thread
Old 03-17-2011, 08:46 PM   #1
shadowbox12
Member
 
Registered: Mar 2010
Posts: 50

Rep: Reputation: 3
Need help chainloading grub to my SD card


I found some instructions on this here:
http://www.mydellmini.com/forum/gene...orkaround.html

But they don't seem to work. Here's the lowdown:
Hardware is an older Dell laptop. It has an SD card slot but doesn't support booting from SD. I've been told grub can chainload another bootloader on another drive. What I want to do is have it chainload the bootloader on my SD card.

Software is Ubuntu 10.10. For testing purposes I have loaded the same version on both the hard drive and SD card, so they use the same kernel.

My hard drive is sda and is partitioned as follows:
sda1 Windows
sda2 NTFS partition for sharing files between OS
sda3 ext3 /boot
sda5 LVM volume containing 4 smaller volumes, one each for / /var /swap /home

SD card shows as sdc when plugged into a USB SD reader and /media/mmc(long string of numbers) when in the internal slot.
sdc1 ext3 /boot
sdc5 ext3 /

I have downgraded grub2 to grub legacy since there is more documentation and it is easier to understand. Grub legacy is loaded on MBR of both sda and sdc. I edited the menu.lst on sda to create an entry to point to the UUID of sdc. I just copied the entry from the menu.lst on sdc. Since the versions are the same they use the same vmlinuz and initrd files already found in sda1.

I added the following lines to my initramfs-tools/modules file on sda: mmc_core, mmc_block, sdhc, sdhc_pci then rebuilt the initrd. lsmod shows the modules as loaded on boot. Everything boots fine when the SD is plugged into the USB SD reader. I can boot from grub on sdc or chainload it into sdc from sda. Both boot into the SD card when its in the USB dongle. When its in the internal SD card slot, neither boots and I get Error 15 file not found.

I've tried specifying the full path to the kernel in menu.lst, ie (hd0,2)/vmlinuz.x.y.z.img The idea being if I load the kernel from sda3 (hd0,2) it can load the rest of the files from the sd card at that point, but it doesn't happen.

My research so far has suggested Error 15 relates to a missing stage2 grub loader. The instructions I followed said the only files I needed to copy from sdc to sda were the initrd and vmlinuz but then suggested to be on the safe side to copy all of /boot. I did not do this because I didn't want to overwrite my existing stage1 and stage2 files which would make my sda unbootable. Is there a way to have 2 sets of these? Is there something else I'm overlooking?
 
Old 03-18-2011, 09:10 AM   #2
aus9
Guru
 
Registered: Oct 2003
Posts: 5,056

Rep: Reputation: Disabled
Edit

I think there is a better instruction and includes a grub.conf for grub2

https://bbs.archlinux.org/viewtopic.php?pid=760477

Last edited by aus9; 03-18-2011 at 09:19 AM.
 
1 members found this post helpful.
Old 03-19-2011, 08:37 PM   #3
shadowbox12
Member
 
Registered: Mar 2010
Posts: 50

Original Poster
Rep: Reputation: 3
That link looked promising initially, but after having tried to follow the author's steps, I've gotten bogged down again. The problem is that the instructions the author gives are for Arch linux, and I'm not able to translate them into the steps for Ubuntu.

He's also being rather vague about exactly what he's doing, ie "I chrooted into my system according to this wiki link" Did he only chroot into the sd card or did he follow other steps on the wiki? And a fairly critical piece of it seems to be this mkinitcpio which I gather is exclusive to Arch Linux, so how that applies to initramfs in Ubuntu I don't know.

I followed all the links referenced in the thread and in one of them 2 people discussed installing Ubuntu on an SD card by mapping / to the sd card and /boot to a usb drive. I figured that was worth a try, so I reinstalled Ubuntu and mapped / to the sd card and /boot to my hard drive sda3. That didn't work out well and the new grub2 didn't want to play nicely with the exiting grub on sda3, so I ended up having to restore /boot from backup. I'm going to try installing /boot onto a usb drive to see if that works but even if it does I'm not sure how to apply that to my current situation.
 
Old 03-19-2011, 10:34 PM   #4
Larry Webb
LQ Veteran
 
Registered: Jul 2006
Location: Crystal Beach, Texas
Distribution: Suse for mail +
Posts: 5,100
Blog Entries: 7

Rep: Reputation: 229Reputation: 229Reputation: 229
If you have an sdhc or a sdhc extreme card and this is an older internal reader it will not read the card. I have a 5yr old dell that will not read the newer cards. I did like you are doing and bought an external reader. I bought a new internal for my desktop, but you have to be careful because a lot of them are still the older ones.
 
Old 03-20-2011, 12:35 PM   #5
shadowbox12
Member
 
Registered: Mar 2010
Posts: 50

Original Poster
Rep: Reputation: 3
@Larry Webb That is something to watch out for, but I checked the specs before I laid down money for the sdhc to make sure it would be supported and have no problems reading or writing to sdhc in windows or linux.

@aus9 I reinstalled ubuntu on the sd card using the usb dongle, during the install mounting /boot on a spare USB drive I had laying around. I added the sdhc modules to initramfs-tools/modules and used update-initramfs to update the kernel with sdhc support. At that point I was able to take the sd card out of the dongle and put it in the internal slot, and boot from the USB into root filesystem on the sd card in the internal sd slot. This is making me hopeful I may be able to figure a way to make this work. Now I just need to figure out how to make it boot from the hard drive instead of the USB without hosing my existing installs.

I think the original problem with that was trying to install grub2 onto sda3 which already has grub, which hosed both enough I could boot into neither. But the distro I want to live on the sd card is based on Ubuntu 7 so it uses the old grub by default so the mixing grub thing won't be a problem. However, won't installing grub onto a partition that already contains grub still end up overwriting files I need to boot into my existing hard drive based Ubuntu install? During the install on the sd card, I told it to mount sda3 as /boot but without formatting it to preserve the existing files but it overwrote anyway. Is there a way to have it mount sda3 as /boot in parallel without hosing the existing boot files? I would like to have a unified boot loader menu with all my OS options on it and pick to boot from the hard drive or sd card.

Last edited by shadowbox12; 03-20-2011 at 01:12 PM.
 
Old 03-28-2011, 05:06 AM   #6
aus9
Guru
 
Registered: Oct 2003
Posts: 5,056

Rep: Reputation: Disabled
hi

I am not sure what you mean by parallel

do you mean you boot up and have 2 boot folders? eek
 
Old 03-28-2011, 06:30 AM   #7
Larry Webb
LQ Veteran
 
Registered: Jul 2006
Location: Crystal Beach, Texas
Distribution: Suse for mail +
Posts: 5,100
Blog Entries: 7

Rep: Reputation: 229Reputation: 229Reputation: 229
Quote:
Originally Posted by aus9 View Post
hi

I am not sure what you mean by parallel

do you mean you boot up and have 2 boot folders? eek
He would have to have the bootloader on a number 1 bootable partition I would think or run on VM
 
Old 03-29-2011, 08:38 PM   #8
shadowbox12
Member
 
Registered: Mar 2010
Posts: 50

Original Poster
Rep: Reputation: 3
@aus9 I wasn't referring to having 2 /boot partitions, but having 2 sets of boot files, ie vmlinuz, initrd, stage1, stage2, etc on the same /boot partition. Maybe that's impossible, I don't know, I'm still fairly new to this. I'm just trying to wrap my head around how to chainload from grub on one drive to grub on another drive.

It seems to work if I have a /boot for the sd card on my usb stick and another /boot for my hard drive on the hard drive. Then I can boot from one or the other. The problem is getting all my boot options on a single menu.lst with some pointing to the local hard drive and some pointing to the sd card.

@Larry Webb I'm not sure I follow you. You mean sda1 vs sda3? Why does this make a difference? I have grub installed on the MBR of sda and /boot on sda3. How does the partition number apply to whether I can chainload to the sd card?
 
Old 03-29-2011, 09:17 PM   #9
Larry Webb
LQ Veteran
 
Registered: Jul 2006
Location: Crystal Beach, Texas
Distribution: Suse for mail +
Posts: 5,100
Blog Entries: 7

Rep: Reputation: 229Reputation: 229Reputation: 229
What the problem is that which mbr will be read first, h/d or flash/usb. You can install all of grub files in one partition then chainload that partition and it will not care which grub boots it if that is what you are referring to. If using grub2 you will probably have to use the -force option. I am like aus9 and not sure I understand what you want to do.

Is this a 'live media' or a distro install on your sd card? If you have ubuntu 10.10 on h/d how do you use grub legacy to boot it - chainload?

Last edited by Larry Webb; 03-29-2011 at 09:18 PM.
 
Old 04-08-2011, 09:12 AM   #10
aus9
Guru
 
Registered: Oct 2003
Posts: 5,056

Rep: Reputation: Disabled
ok well lets look at some points

Can you have multiple kernels and initrds under the same folder /boot.......YES

2) The question on why you need to have a /boot folder on each DEVICE relates to which device is detected as the bootable device

eg bios jumps to device 1 (according to its order) finds the balance of its booting files and maybe.....chainloads to a different device
------the different device would normally need its own /boot folder

eg2...bios jumps looking for device1 and does not find it so jumps to device2.
device 2 can have a chainload entry to boot device 1

3) But the question is still limited by the bios detected the actual device
 
Old 04-12-2011, 07:29 PM   #11
shadowbox12
Member
 
Registered: Mar 2010
Posts: 50

Original Poster
Rep: Reputation: 3
Quote:
Originally Posted by aus9 View Post
ok well lets look at some points

Can you have multiple kernels and initrds under the same folder /boot.......YES
Right but it takes more than vmlinuz and initrd to boot, if I understand this correctly. Grub also requires a stage1, a stage2, and sometimes a stage1.5. Since these files use default names and paths that means I can't have more than one copy in the same /boot. If I could have one file in /boot/grub/stage1 and another in /boot/grub_alt/stage1 that might work, but I don't know how to do that or whether it is possible.
 
Old 11-05-2011, 12:56 PM   #12
shadowbox12
Member
 
Registered: Mar 2010
Posts: 50

Original Poster
Rep: Reputation: 3
FINALLY got an answer to this after going back and trying again. Updating this thread with the solution in case someone else finds this useful or I need to do it again and forgot how.

First thing is I updated to grub2. I just got tired of beating my head against the wall of grub. grub2 located the install on the sd card and added an entry to my grub.cfg, however this would not boot. It also made an entry for the copies of the SD installed kernel I made to my hard drive /boot partition. The idea being I could load the kernel and ramfs from hard disk and then point root to the sd card. Kernel loaded fine, problem was it couldn't find the sd card either by mount point /dev/mmcblk01 or UUID.

Then I realized I must be missing the correct sdhc modules and dug around for a while until I found the correct modules. Turns out the sdhc module names have changed between ubuntu versions. Now I had the correct names booting is no longer a problem. Modules are: sdhci, sdhci-pci, sdhci-platform, mmc_block, and cb710-mmc. modprobe -l *sdhc* *mmc* should help you find the correct modules on your distro.

For reference here is my modified grub.cfg. I created a custom script to make sure my menu entries don't disappear next time I update the kernel.

### BEGIN /etc/grub.d/55_backtrack ###
menuentry 'Backtrack 5 R1 Ubuntu 2.6.39.4' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod part_msdos
insmod ext2
set root='(hd1,msdos3)'
search --no-floppy --fs-uuid --set a644e005-2450-4ae1-92d9-50cc69dc6d2a
linux /vmlinuz-2.6.39.4 root=/dev/disk/by-uuid/81001b25-f2d5-40fa-902e-d479a0ca79c9 ro quiet splash
initrd /initrd.img-2.6.39.4
}

Yay persistence!
 
Old 11-06-2011, 06:58 PM   #13
aus9
Guru
 
Registered: Oct 2003
Posts: 5,056

Rep: Reputation: Disabled
hi

well done but have you considered the following?

those modules you refer to....ideally if all booting files are on your card it might be smarter to have those modules added to your initrd. I think yours is not a olde style initrd but an intramfs?

Ubuntu may like
http://manpages.ubuntu.com/manpages/...itramfs.8.html

others may prefer
http://linux.die.net/man/8/mkinitrd

and assuming you have the same structure as mine (debian) you can just add the modules using root powers to
/etc/intramfs-tools/modules
 
  


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
grub chainloading question Waterboy Linux - General 7 02-11-2011 07:55 PM
chainloading to grub 2handband Slackware 38 12-24-2010 07:25 AM
Weird one - chainloading Grub rhomp2002 Linux - Newbie 5 07-16-2008 01:52 AM
grub and lilo chainloading rienqunuser Linux - Newbie 5 02-13-2008 05:59 PM
GRUB & XP w/out Chainloading: Possible? Computer Guru Linux - Software 5 06-14-2006 12:23 PM


All times are GMT -5. The time now is 09:55 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration