How do I make my USB stick bootable?

On 2014-04-30 03:46, Fraser Bell wrote:
>
> nrickert;2640286 Wrote:
>> The way a CD or DVD boots is different from the way that a USB boots.
>> So copying a CD or DVD image to a USB does not guarantee that you will
>> get something bootable. Most linux distros use a hybrid structure that
>> can be booted either as a CD or a USB. But the ‘memtest86±5.01.iso’
>> that I just downloaded does not seem to have that hybrid structure.
>>
>> Maybe try the “ultimate boot CD” (google for location). In my
>> experience, that does have a suitable hybrid structure.
>
> Correct. That ISO is not bootable from a USB stick.

Ah, that makes sense.

Yes, the openSUSE “ISO” is special, it is already “hybrid”. Other images
found around may be not.

> However, I thought the goal of this thread was to create a USB install
> stick for openSUSE?

He is testing, practicing, the procedure with a small image, the mentest
thing, because he does not currently have a usb stick big enough for the
openSUSE image. I understand it is on the mail (land mail, not email :wink: )


Cheers / Saludos,

Carlos E. R.

(from 13.1 x86_64 “Bottle” (Minas Tirith))

On 2014-04-29 22:56, deano ferrari wrote:
>
> Stephen_Philbin;2640195 Wrote:
>> The ‘site’ (http://www.memtest.org/#downiso) says that it’s a bootable
>> ISO image, and I copied it to my USB stick with
>>>
> Code:
> --------------------
> > > ]su - -c ‘cp /home/stephen/Downloads/memtest86±5.01.iso /dev/sdh’
> --------------------
>>>
>> I dunno why the pc I tried usin it in says to insert bootable media.
>> Hopefully the OpenSUSE installer will work more smoothly on the stick
>> I ordered from Amazon.
> Carlos already mentioned that you need to use ‘dd’ (a low-level copy CLI
> utility) for this. You’re not simply copying a file - you’re copying the
> entire image byte for byte.

He, no, I told him to use plain ‘cp’ :slight_smile:

Others told him to use ‘dd’, which is the most common recommendation,
but which I find more difficult for novices.

Both tools can do a low level raw byte copy to the device, because the
destination ‘/dev/sdh’ is a device.

And both tools can do a standard file copy to the filesystem, changing
the second part of the parameter.

Not obvious, eh? :slight_smile:

He did the usb creation procedure correctly. He is just not using an
hybrid image, but one that is not directly bootable from a usb stick.


Cheers / Saludos,

Carlos E. R.

(from 13.1 x86_64 “Bottle” (Minas Tirith))

4-Gig is a bit small. I use 4G sticks for the live media, but not for the full DVD installer. I use 8G for those.

> Is there something unusual about the ISO that means it’ll only work from
> a DVD?

Sorry, my internet connection at the moment is limited, i can not check.
But please any body else, download it, run “file image.iso” on it, and
post it here. And “fdisk -l file image.iso” too, please. I’'d bet the
results will be same that you get from your USB stick.

> It seems a bit excessive to require a whole DVD to store
> something that’s about 1.5 MB in size. I can’t find any way of uploading
> the image to the forum, but it can be downloaded from ‘here’
> (http://www.memtest.org/download/5.01/memtest86+-5.01.iso.gz). And,
> before anyone asks, yes, I did gunzip it before trying any of this. :wink:

Well, you can try the “netinstall” opensuse install CD, from the
openSUSE getit page. I don’t remember how small it is, about 200MB,
perhaps. You could try that one, if it fits into your USB stick. :-?


Cheers / Saludos,

Carlos E. R.

(from 13.1 x86_64 “Bottle” (Minas Tirith))

The memtest iso that OP linked to is not suitable for a USB memory stick (as nrickert mentioned), but the netinstall one is. (I tried both.)

No, perhaps not :slight_smile:

This Debian page suggests that it can be used

http://www.debian.org/releases/stable/i386/ch04s03.html.en

He did the usb creation procedure correctly. He is just not using an
hybrid image, but one that is not directly bootable from a usb stick.


Cheers / Saludos,

Carlos E. R.

(from 13.1 x86_64 “Bottle” (Minas Tirith))

Exactly. I now have the openSUSE-13.1-NET-x86_64.iso on a small memory stick. :slight_smile:

Okay, thanks for the information.:slight_smile:

I haven’t seen anything smaller than an 8G in a long time, and only a few of those. I get 16-G keys for a pittance, now, and smaller are rarely even sold around here, anymore.

But, of course, I should have realized 4G might be too tight, as a DVD is larger than that.

Okay, I think I get it, now. You want to test booting with a stick you created while waiting for the one you ordered to arrive. You want to use the memtest+ application just to test if you can boot and run from the stick.

So, I have worked this out for you. But, whatever you do, make certain you perform all actions on the correct device, so you don’t wreck anything in your system.

First, download the binary, not the ISO:
http://memtest.org/download/5.01/memtest86+-5.01.bin.gz

extract the binary from the gz archive.

Next, you need to completely clear the device of all the things you have done to it so far.

Launch Yast, and under the System group, launch Partitioner.

Choose your USB device under Hard Disks, the equivalent of sdx, not the partition(s) on it, which would be sdx1(+)

Click on the Expert button, then choose New Partition Table.

Make sure MSDOS is checked, click OK, and confirm.

Now, click on the Add button.

Choose Primary Partition and click Next.

Check Maximum Size, click Next.

Check Format partition, and under File System, choose FAT.

Check Do not mount partition, click Finish.

Click Next, then Finish.

Now, drop to a root console. Do:

parted

IMPORTANT. Make sure you work on the correct device. Replace “x” with the appropriate letter for your boot device. Do:

select /dev/sdx

Set the boot flag for the partition, which is partition 1. Do:

set 1 boot on

Do:

quit

Do:

fdisk -l

You should see your device with an asterisk (*) under the boot column for sdx1.

Now, check if /media exists on your system:

ls /media

It probably does. Make a subdirectory in it to mount your bootkey to:

mkdir /media/bootkey

Then, mount the USB key, do:

mount /dev/sdx1 /media/bootkey

Now, install Grub, do:

grub2-install --force --no-floppy --boot-directory=/media/bootkey /dev/sdx

Launch KWrite from the root console,

kwrite

then put the following lines in it:

set timeout=8
set default=0


menuentry "Memtest 86+" {
 linux16 /memtest86+.bin
}

Use Save as, and choose the mounted bootkey. Save in the directory grub2/ as grub.cfg
(/media/bootkey/grub2/grub.cfg)

cd to the directory where you extracted the memtest binary.

Copy the binary file to /media/bootkey

cp memtest86+-5.01.bin /media/bootkey/memtest86+.bin

Unmount the key, do:

umount /dev/sdx1

Exit the root console.

Now, shut down and test the key.

On 2014-04-30 05:46, Fraser Bell wrote:
>
> nrickert;2640307 Wrote:
>> 4-Gig is a bit small. I use 4G sticks for the live media, but not for
>> the full DVD installer. I use 8G for those.
>
> Okay, thanks for the information.:slight_smile:
>
> I haven’t seen anything smaller than an 8G in a long time, and only a
> few of those. I get 16-G keys for a pittance, now, and smaller are
> rarely even sold around here, anymore.

Same here.
I bought a bunch of 8 GiB sticks from a supermarket, to use for DVD
installs. I wanted smaller, for boot “CDs”, could not find them. Sounds
silly, but I cringe at those 7+ GB “wasted” per stick…


Cheers / Saludos,

Carlos E. R.

(from 13.1 x86_64 “Bottle” (Minas Tirith))

On 2014-04-30 08:36, Fraser Bell wrote:

> Okay, I think I get it, now. You want to test booting with a stick you
> created while waiting for the one you ordered to arrive. You want to
> use the memtest+ application just to test if you can boot and run from
> the stick.
>
> So, I have worked this out for you. -But, whatever you do, make
> certain you perform all actions on the correct device, so you don’t
> wreck anything in your system.
-

Interesting. I have saved this form /my/ reference :slight_smile:
But as an exercise for the OP, it is a way more complicated procedure
than installing the openSUSE image to an usb stick :wink:


Cheers / Saludos,

Carlos E. R.

(from 13.1 x86_64 “Bottle” (Minas Tirith))

Wow Fraser, thanks for taking the time to write such a clear and detailed guide. Unfortunately, the Expert Partitioner tool in YaST is unable to complete the formatting of the stick. When I click “Finish”, the tool says

If I click Yes then it repeats exactly the same error but this time the error code changes from 1013 to 1025. Clicking continue anyway again them just repeast the warning again, but reverts the error code to 1013. Each time Yes is clicked, the error code just alternates. Does this mean my stick really is busted? It’s a comically tiny little thing anyway, so it’s no great loss, but I’ll definitely be trying again when I get my hands on more spare sticks. This may well be more detail than is required to simply get a network installer booting from a USB device, but it is still very good, very useful information that I thank you for taking the time to post.

On 2014-04-30 17:26, Stephen Philbin wrote:

> If I click Yes then it repeats exactly the same error but this time the
> error code changes from 1013 to 1025. Clicking continue anyway again
> them just repeast the warning again, but reverts the error code to 1013.
> Each time Yes is clicked, the error code just alternates. Does this mean
> my stick really is busted?

Nope, I don’t think so. Search for a “recovery procedure” described in
the wiki pages for usb creation. I think I wrote it, with help from many
others. The partitioner simply thinks it is attempting to format a DVD,
and that is impossible because you can not write to a DVD.

Can’t give you an exact link at that moment, I have limited internet
connectivity.


Cheers / Saludos,

Carlos E. R.

(from 13.1 x86_64 “Bottle” (Minas Tirith))

Okay, lets try this.

From a root console, do:

fdisk -l

to list the device. You want to be sure you are working on the right device. Also, note how many partitions you have on it, if more than one.

To start working on it, do:

fdisk /dev/sdx

To delete a partition, do:

d

To select the first partition, do:

1

and press Enter

To select the next partition, do:

d

fdisk will automatically select the next partition, or should.

Continue until you are done.

Now try it in Yast to see if it will work.

If not, you might try:

dd if=/dev/zero of=/dev/sdx bs=512 count=1

and see if that will then work in Yast.

Oh, definitely way more complicated!>:)

But, Stephen is certainly going to know a lot by the time we get done with him, right?rotfl!

And about that procedure:

If you make more than one partition, you could actually make the stick multi-boot. Just add the correct lines for what else you plan to boot in that grub.cfg, which is why I included the timeout and default entries.

I thought the output from fdisk (from before I tried deleting the partitions) looked interesting and strange. I’ve never attempted to partition the drive, yet it seems to have 4. The boot columns are filled with ?s too.

I tried using Windows 7 to format it last night before going to bed. Maybe it did something weird?

Here’s the output from when I tried to delete the partitions. I was a bit confused by the last bit of output from the commands that said there was an error because I thought that a command followed by a number in brackets like partprobe(8) or kpartx(8) were references to manpages rather than commands themselves. Yet from my reading of the text it seemed to imply that I should try to run them as commands. I ran fdisk on the stick to see if the partitions had actually been removed and they weren’t listed in the output. Here’s the whole thing

Given the confusion over the commands listed, I 've decided to play it safe and do a reboot. Especially since I have no Idea i an error actually occurred or if I’m just reading it incorrectly. I’ll follow up with another post soon.

Your output shows that it is ready to go, with the MBR now set as DOS and no partitions present.

Disk label type: dos

So, you are ready for Yast, or should be.

BTW: When you post output like that, use the code tags. When writing your post, click on the “#” sign near the top right of the forum message editor, you will get a pair of bracketed CODE and slash-CODE commands. Paste in between those, and it holds the output in its original format as you see it on the screen.

After the reboot the YaST partitioner gave the same error in the same pattern as before, so I tried your other suggestion to use dd. Here’s the output from it.

When trying again after using dd a different error comes up:

I don’t see any reason for it to be busy. I don’t even have any Dolphin windows open that could read from it or anything.

Well I certainly appreciate the patience and effort that the contributors to this thread have made and there’ll no doubt be a large number of people that find this thread through Google or Yahoo that appreciate your time just as much.

Should I continue to making the fist partition bootable? I notice that despite YaST sating the device was busy that fdisk -l says

It looks reasonable enough to me, but that’s not really saying much is it.

It looks okay, I think.

Give it a try.

I’ve used parted to make the new partition bootable and checked it with fdisk which shows it worked, but mount doesn’t seem to like the stick. Here’s the output

I’ve never heard of so. before, so instead I used dmesg wich said

I don’t have a clue what almost all of that is saying.

Okay, let’s tackle it with fdisk.

fdisk /dev/sdh
o
w

Don’t do anything else, yet, there is more to come. Let me know what happens.

Do you have GParted?

If not, use Yast to install it from the openSUSE repositories. We might try that program to see if it has any success on this stick.

But, you might have a bad superblock, as one of the errors suggests. If it actually is bad, not just set up wrong, then the stick is no good.