LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-18-2006, 11:11 PM   #1
JonBrant
Member
 
Registered: Jul 2004
Distribution: Suse 10.2
Posts: 43

Rep: Reputation: 15
Suse 10.1 on USB Drive with Windows


Alright. I had Windows installed on this computer, I plugged in a USB drive, I booted from the Suse 10.1 installation DVD. It recognized my USB drive and allowed me to install to it. It boots to it if I tell it to. If I disconnect the USB drive, Windows won't boot (Grub Error 21). I know how to fix the error 21, but I want it to boot to the USB drive on another (identical) computer. Our campus has all of the same computers, so they all have the exact same hardware and software. It just seems that it's putting the bootloader on the Windows partition rather than my USB drive

So... how do I get the bootloader (Grub or Lilo, whichever is most likely to work) on the USB drive? I read something about chroot and grub (hd tab something or other with a ) floating in there somewhere, but I don't know much beyond that. I'm pretty new to Linux and I'm learning using the USB drive... so could I get (idiot proof) step by step instructions on what to do?
 
Old 10-19-2006, 03:56 PM   #2
GTrax
Member
 
Registered: Oct 2005
Location: UK
Distribution: Mint
Posts: 258

Rep: Reputation: 37
I think you have made the bootloader point to the USB to find the grub configure file where all the rest of the PC partitions are described. Plug in the USB to get you going (or use a live CD) and run grub-install again, this time letting it point to a /boot directory in one of the partitions on the hard drive. You need never do this again unless you choose to lose the partition in the future. You only edit the "menu.lst" aka "grub.conf" there.

Some prefer to have a special small /boot partition for their main distro, which will serve to house the "/boot/grub/menu.lst" file which controls the booting of everything else, but in fact, it does not matter if you just use the /boot that exists on any distro that is already installed. The "menu.lst" file is also known as "grub.conf", and often a symlink is used to make either name useable.

Searching keywords "grub configure" will provide the examples for editing menu.lst. Knowing that grub uses device numbers that start with zero means you can always point to the kernels using absolute paths. Now if you choose to have a boot directory with a kernel lodged on a USB, (or even a whole distro!) then the right thing to do is to point at it from a "menu.lst" that is itself in a more permanent place. As you had it, startup without the USB present also removes the precious "menu.lst", where even the Windows boot commands would be as in this snippet.
Code:
title		Windows 95/98/NT/2000/XP
root		(hd0,0)
makeactive
chainloader	+1
See how I use absolute paths in my menu.lst
Code:
timeout 15
color cyan/blue white/blue
foreground ffffff
background 0639a1
gfxmenu /boot/grub/message
title MEPIS at sda6, kernel  2.6.15-26-k7 for AMD Athlon
root
kernel /boot/vmlinuz-2.6.15-26-k7 root=/dev/sda6 nomce quiet vga=791

title Zenwalk-2.8 at sda7 & /home at sda8 4G ea
kernel (hd0,6)/boot/vmlinuz-2.6.17.6 root=/dev/sda7 nomce quiet vga=791
# The (hd0,6)/boot/ path means "the /boot directory on hda7"

title		Ubuntu, kernel 2.6.15-23-386
root		(hd1,0)
kernel		/vmlinuz-2.6.15-23-386 root=/dev/hda6 ro quiet splash
initrd		/initrd.img-2.6.15-23-386

title Fedora Core 5 (2.6.15-1.2054_FC5)
kernel (hd0,0)/vmlinuz-2.6.15-1.2054_FC5 ro root=/dev/sda9 ro
initrd (hd0,0)/initrd-2.6.15-1.2054_FC5.img
.. from which you can see the added distros I had a play with, all with absolute paths.
I don't know what device name a USB has (probably sda or sdb), but maybe others can help here.
 
Old 10-19-2006, 04:01 PM   #3
GTrax
Member
 
Registered: Oct 2005
Location: UK
Distribution: Mint
Posts: 258

Rep: Reputation: 37
Err.. my apologies. The USB device might be known as sd0, sd1, etc.
 
Old 10-19-2006, 06:01 PM   #4
JonBrant
Member
 
Registered: Jul 2004
Distribution: Suse 10.2
Posts: 43

Original Poster
Rep: Reputation: 15
Alright, I opened my menu.lst file...

Code:
# Modified by YaST2. Last modification on Thu Oct 19 00:05:51 UTC 2006

color white/blue black/light-gray
default 0
timeout 8
gfxmenu (hd1,1)/boot/message

###Don't change this comment - YaST2 identifier: Original name: linux###
title SUSE Linux 10.1
    root (hd1,1)
    kernel /boot/vmlinuz root=/dev/sdb2 vga=0x31a    resume=/dev/sdb1  splash=silent showopts
    initrd /boot/initrd

###Don't change this comment - YaST2 identifier: Original name: xen###
title XEN
    root (hd1,1)
    kernel /boot/xen.gz 
    module /boot/vmlinuz-xen root=/dev/sdb2 vga=0x31a    resume=/dev/sdb1  splash=silent showopts
    module /boot/initrd-xen

###Don't change this comment - YaST2 identifier: Original name: windows###
title Windows
    chainloader (hd0,0)+1

###Don't change this comment - YaST2 identifier: Original name: floppy###
title Floppy
    chainloader (fd0)+1

###Don't change this comment - YaST2 identifier: Original name: failsafe###
title Failsafe -- SUSE Linux 10.1
    root (hd1,1)
    kernel /boot/vmlinuz root=/dev/sdb2 vga=normal showopts ide=nodma apm=off acpi=off noresume nosmp noapic maxcpus=0 edd=off 3
    initrd /boot/initrd

###Don't change this comment - YaST2 identifier: Original name: memtest86###
title Memory Test
    kernel (hd1,1)/boot/memtest.bin
That's what's inside. I don't know what to change to get it to work. I'm gonna try playing with the paths under the Suse entry, but I don't know what to change them to... I'll post if I get it to work
 
Old 10-20-2006, 05:53 PM   #5
JonBrant
Member
 
Registered: Jul 2004
Distribution: Suse 10.2
Posts: 43

Original Poster
Rep: Reputation: 15
After an hour and a half of trying to get it to work, I realized I should probably stop screwing it up

Anyone with a clue as to how this file works that can tell me what I need to change? GTrax got me on the right Track (hehe) but I don't seem to be able to figure out the rest
 
Old 10-20-2006, 07:43 PM   #6
GTrax
Member
 
Registered: Oct 2005
Location: UK
Distribution: Mint
Posts: 258

Rep: Reputation: 37
Hi Jon
First, about those warnings not to modify the comments.
This is a trick way of allowing a system to leave a signal to itself in the file without breaking the rules. It hides behind a comment # symbol by using more of them like ### where one # would do. Ubuntu also does a variation of this. I think it is useful when doing re-installs, upgrades, etc.

Next is - I note you have installed xen. I did have a series of steps in mind to allow you to restore your GRUB setup, but we have to figure out something first. XEN is a hardware virtualiser that allows cuncurrent operation of multiple operating systems. I notice that it is on sdb2. I think sdb2 is a partition on a USB, but not sure because sda,sdb, etc. are also used for serial ATA and SCSII devices. You can also see that this snippet thinks its on a second IDE drive partition 2 (hd1,1)=/dev/hdb2

Code:
title XEN
    root (hd1,1)
    kernel /boot/xen.gz 
    module /boot/vmlinuz-xen root=/dev/sdb2 vga=0x31a    resume=/dev/sdb1  splash=silent showopts
    module /boot/initrd-xen
So lets get it clear. You maybe want a system to successfully boot by itself when switched on, to either Windows or SUSE, with the choice of making whichever you like the default, and the ability to vary that choice before a settable timeout. Additionally, you have another distro on a USB, and you would like that one to boot instead if you happen to have it stuck in the port at startup time?

Or have I misunderstood?
 
Old 10-20-2006, 08:21 PM   #7
JonBrant
Member
 
Registered: Jul 2004
Distribution: Suse 10.2
Posts: 43

Original Poster
Rep: Reputation: 15
I think you've got the idea. As far as Xen goes, I have no idea what that is. It must have just come with the SuSe install *Shrug* (I did a full install. I can reinstall without it if that makes things simpler)

But yeah, I want the computer to boot to Windows, but when my USB drive is plugged in and I tell it to boot to USB, I want it to boot to my SuSe install which is on the USB drive. I don't want to change the computer at all. My reason is because our school bought hundreds of the same computer... same hardware, software, everything. I just want to plug my USB drive into any given one of them, tell it to boot from the USB drive and have it run Linux

As far as SDB2 goes, I'm pretty sure that's my USB drive (I recall seeing it as the target when I hover over the link in "My Computer" when I'm booted to it)

All in all, I don't mind a reinstall of SuSe, doesn't take much time and if it'll mean I have fewer problems that's cool too. I just need some sort of instructions (Idiot Proof ones) that I can follow to get it to boot how I want it to.

I really appreciate your help
 
Old 10-21-2006, 07:46 AM   #8
GTrax
Member
 
Registered: Oct 2005
Location: UK
Distribution: Mint
Posts: 258

Rep: Reputation: 37
OK Jon
This thread just might provide fuel for comedy for the rest as two newbies thrash through stuff that should be easy - but never is..

For what you need, a system you can carry about to other computers, all on a USB stick, is possible, and with modern USB sticks getting up into gigabytes, bigger distros can be fitted - but there are some rules and realities. Yes - you can do this, and there are ready-made Linux systems out there all ready figured for USB portable operation, to do exactly what you are after.

About xen:
For us, this is a bit advanced. Xen is a "virtual machine monitor", and cracking clever way to run any number of operating systems like Windows, Linux distros, etc. at nearly full speed. Its great for running multiple servers each with their own dedicated purpose. Its not like hardware emulators, and Microsoft are a bit p**sed about it.

http://en.wikipedia.org/wiki/Xen_(vi...chine_monitor)
This is geek stuff! You need to lose it for the time being.

The Problem with Flash:
A USB key uses flash electrically-eraseable memory. (EEPROM) It can be made to appear to a system as if it is a disk drive..but it is not! An addressed cell has a limited life of re-write cycles. This is not a problem if the usage is just to copy whole chunks on and off occasionally, but if its going to be trucking a whole operating system with millions of accesses to certain parts, then even if it is rated for 100,000 or even 1,000,000 re-writes, there is a problem. It will use itself up in a few hours!
http://en.wikipedia.org/wiki/Flash_memory

So how do they do it anyway?
By making a system that invents a temporary filesystem in the PC's RAM memory, and loading much or all of it into there (assuming the PC has enough memory). This is the same trick used by LiveCDs like Knoppix, and its UNIONFS filesystem. Several USB-loading Linux distros are based on Knoppix. As the USB boots, its scripts copy the scheme into the PC RAM, and then moves over to work from in there. Except for finally writing back into the USB new stuff for your /home directory, and various new stuff that you might have installed or downloaded, the USB never sees the gadzillions of accesses it would have if it were directly trying to act like a real disk drive.

USB Boot - or would you carry about a LiveCD with it?
There is a difference between "USB booting" and "A whole system on a USB". You could simply use a LiveCD with a big system (like the SUSE LiveCD), and have your own files and transportable data on the USB. Importantly, on the USB can be the set of configuration files that set up your screen preferences, KDE, a complete /home directory, whatever. These schemes have the characteristic that as more apps get loaded into the PC temporary filesystem, the whole lot starts to run blazingly fast! Knoppix makes a "knoppix.sh" file which keeps saved configurations, and scans for it. If it finds it, your personalised desktop appears.

So what can we do?
Have a look at small systems. DSL (Damn Small Linux) is widely used to do exactly this, it has a graphical desktop, browser, mailer, etc. DSL is relentlessly minimalist.
http://www.damnsmalllinux.org/

Feather Linux is a bigger system, and is all ready set up to live on and boot from a USB.
http://featherlinux.berlios.de/

Oh yeah - there is also Puppy Linux. Very well regarded by those who like small systems.
http://www.puppylinux.org/user/viewpage.php?page_id=1
In all these USB boots, it assumes the PC CMOS setup has been set to try the USB device for a bootable partition BEFORE it looks at the CDROM or any hard drive.
Usually hitting "Delete" at the right instant during bootup lets you into the CMOS setup. Not sure if such would be welcome at educational establishments :|


There are others, and I am tempted too. Getting back to your setup. I suggest using grub-install again, to re-do bootloader on the MBR (Master Boot Record) of the first bootable hard drive. Thats probably hda1 also known as (hd0,0) in GRUB-speak. This is so it can point to a place where we have a nice menu.lst to get a grip on what happens next - and to boot Windows. There MAY be no need to mess with it at all, just fix the boot sequence back to where it was.

BUT.. before we can get into any of that, your nice menu.lst was made by SUSE, and is presently living on a USB! To free the PC from needing the USB in there all the time, we need to know exactly what other space/drives is there for any other partitions besides Windows. Even a little one would do. Hmm.. you could even stick it on a floppy.

I know all this has probably raised more questions for you than it answered. I have to say that a whole SUSE on a USB without compromising the flash-memory life is a good trick if you can do it. I am sure lots of us would *love* it!

Last edited by GTrax; 10-21-2006 at 07:54 AM.
 
Old 10-21-2006, 09:01 PM   #9
JonBrant
Member
 
Registered: Jul 2004
Distribution: Suse 10.2
Posts: 43

Original Poster
Rep: Reputation: 15
Wow, thanks for the post. I think you misunderstand though. It's not a USB Thumb drive. It's a USB Enclosure for a hard drive. I know it wouldn't work so well to put it on a thumb drive. My only problem is getting it to actually boot, I just need help with Grub hehe. I just need it to be able to be standalone bootable on any one of the computers when I tell it to boot to USB
 
Old 10-22-2006, 11:23 AM   #10
GTrax
Member
 
Registered: Oct 2005
Location: UK
Distribution: Mint
Posts: 258

Rep: Reputation: 37
Ah.. OK, situation now gives you more options, but the basic principles remain.

Consider one of the "target" computers.
1. They have their own bootup life that you cannot interfere with except in one specific way - you have them look at the USB port for a bootable drive before they try the CDROM or any other drive.

2. Next, that drive plugged into the USB must look (to the target computer) as if it is king. Its boot sector first 512 bytes have some data (put there by you with GRUB at some stage), which points to a menu.lst living in its /boot/grub place. This data is known as the MBR (Master Boot Record).

3. This /boot/grub/menu.lst then, in turn, contains the information to point onwards to whatever system is going to boot. You get the opportunity to choose from a list, which has a timeout period you can decide. The timeout re-starts every keypress, and the first in the list is the default if you do nothing.

4. There is a *lot* of GRUB configure help out there. The key thing is to know with a absolute certainty bordering on the obsessive, which partitions exist on your bootup drive, and where relative to them will be those all-important starting files.

5. Know that in some systems, menu.lst is also known as menu.conf. This affects you if you are using SUSE because you will find what looks like both - until you notice that one name is actually a symlink pointing to the other, so that either name is good for the file.

In untangling your menu.lst file, the confusing thing for us is the references to (hd1,1) in the same line as "root=/dev/sdb2" You really need to find the .map file that lets you know what the USB drive is known as to GRUB. It may well be (hd1,1)! If this thing is going to run on a possibly strange machine, the whole deal needs to be contained on the USB drive. I would expect all references in the menu.lst to concern partitions on that drive.

If the hardware is known, and always the same you may be OK. Distros like Knoppix will self-adapt to the hardware found. Hope this helps.
 
Old 11-08-2006, 03:14 AM   #11
JonBrant
Member
 
Registered: Jul 2004
Distribution: Suse 10.2
Posts: 43

Original Poster
Rep: Reputation: 15
I got fired when I used one of these at work. They didn't seem to understand the concept of running from a USB drive. Idiots

So yeah, sorry for ignoring the replies...
 
Old 11-08-2006, 03:34 AM   #12
my.dying.bride
LQ Newbie
 
Registered: Nov 2006
Distribution: Vector Soho Edition 5.1(Best yet)
Posts: 25

Rep: Reputation: 15
Quote:
Originally Posted by JonBrant
I got fired when I used one of these at work. They didn't seem to understand the concept of running from a USB drive. Idiots

So yeah, sorry for ignoring the replies...

Laughs... I got fired when I made them concious about how easily a Windows admin password may be cracked WHEN allowing booting from USB/CD, but still they have not changed the booting choices... (I also told them about some chars to be used in passwords in general to escape the rainbow tables on the internet, so hopefully they atleast have followed that advice)

I don't use grub. I like grub for my disks but I have honestly never really understood how to configure the bootloader. Sure menu.lst is easy to configure but that dont help me... So I use LILO for booting from my USB. What you do is ...

Have lilo.conf point to your USB (You must have it plugged in when installing) .WTF.. Here is my lilo.conf:

boot="/dev/sda" (if your usb is sda...Careful sometimes harddisk are mounted as sda, especially in Slax so
be sure that the device,sda, atleast is a disk belonging to you and not a harddrive that has been recognized as /dev/sda)
label="Slax-2.6.16.20"
root=/dev/ram0 (ramdisk root)
image="/mnt/hdb5/boot/vmlinuz-2.6.16.20" (this is just where i keep my bzImage and my Initrd. Can be
kept on whatever disk you like, fex under /mnt/sda/boot/bzimage.."
initrd="/mnt/hdb5/boot/initrd-2.6.16.20" (ramdisk image)

The ramdisk may not be needed if you dont use it. But ( im not sure about this though) I think most bioses have trouble booting USB device in other filesystem than fat16-32

Then you install Lilo to your main system ,unless you already have it installed. Save your lilo.conf file to some place like /here/is/my/lilo

Then execute this command: lilo -C /here/is/my/lilo -m /here/is/my/lilo.map

Last edited by my.dying.bride; 11-08-2006 at 03:36 AM.
 
Old 11-09-2006, 05:26 AM   #13
JonBrant
Member
 
Registered: Jul 2004
Distribution: Suse 10.2
Posts: 43

Original Poster
Rep: Reputation: 15
Yeah, looked at the guy (boss of my boss) and told him "Wait, you're telling me that having Linux on a Windows computer opened it up to security threats?" he just kinda sat there for a sec and said "Yeah" I tried not to laugh at him
 
Old 11-09-2006, 10:51 AM   #14
my.dying.bride
LQ Newbie
 
Registered: Nov 2006
Distribution: Vector Soho Edition 5.1(Best yet)
Posts: 25

Rep: Reputation: 15
Well Jon. He is right. It does open. You can just copy the files in %systemfolder%\config over to your pen (the registry files), bring them back with you home, extract the admin password hash, fire up Cain or visit some online table database and start cracking the admin password. On the other hand. It only takes them as admins on single reg value to disable. Disabling the LM storing makes the cracking nearly impossible if they change the password every 2-3 month.
But I guess they thought it was easier to fire you then changing a reg value from "1" to "0" .
 
  


Reply



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
Write to USB Drive from Linux then Reading from MS Windows KirkCuth Linux - Newbie 5 05-21-2006 04:50 PM
How to get Ubuntu to read Windows/USB drive? Micro420 Ubuntu 5 08-21-2005 01:17 AM
New Ubuntu install hasn't mounted windows hd or usb drive trempel Ubuntu 7 05-26-2005 04:58 PM
USB jump drive and SUSE 9.0 mc8:36 Linux - Hardware 0 06-28-2004 10:35 AM
SUSE BOOT does not find SUSE/ usb drive PNUT Linux - Newbie 0 11-01-2003 12:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:03 AM.

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