How do I make my USB stick bootable?

Hi folks. I have a machine with no Optical drive, but it does have an internet connection. So i figured the obvious thing to do would be to use the netinstall image from a USB stick. I don’t have a suitable USB stick just yet. I’ve just ordered it from amazon, but I thought I’d have a look at making the USB stick bootable in the mean time. I plugged in a tiny little 128 MB stick and started to look for something in YaST that would let me format it to make it bootable, but I couldn’t find anything. Am I looking in the wrong place or looking for the wrong thing or something? I’m thinking I just need to format the stick, set a bootable flag on it, then just chuck the netinst image on it and away I go. Have I got that right?

The net install image download section has a link to what it says is instructions on how to boot from a USB stick, but when I checked it, it just seemed to discuss making live images instead of making a stick bootable so that it can install from the internet. Can someone clarify what I need to do please?

To be bootable you have to have a operating system installed. So It is unclear what you want to do.

Use the instruction in how to make a live USB. You can install from that. Basically you do a binary copy of an ISO to the device (not a partition but the device)

As I recall, there are also instructions for the install DVD and the net image. The same instructions should work for both.

I just use:


# dd_rescue /path/to/iso/file  /dev/sdX

where “/dev/sdX” (for suitable X) is the device for your USB. You may have to install “dd_rescue”. Or just use “dd” or use “imagewriter”.

Those methods should already make the USB bootable, because the “iso” file is structured to be bootable.

Beyond that, you do need BIOS support for booting from a USB. If your BIOS does not support it, you can try using PLOP boot manager (google for it). That works for me in the one computer I have that is too old to have BIOS support for booting a USB.

On 2014-04-29 02:06, Stephen Philbin wrote:
>
> Hi folks. I have a machine with no Optical drive, but it does have an
> internet connection. So i figured the obvious thing to do would be to
> use the netinstall image from a USB stick. I don’t have a suitable USB
> stick just yet. I’ve just ordered it from amazon, but I thought I’d have
> a look at making the USB stick bootable in the mean time. I plugged in a
> tiny little 128 MB stick and started to look for something in YaST that
> would let me format it to make it bootable, but I couldn’t find
> anything. Am I looking in the wrong place or looking for the wrong
> thing or something? I’m thinking I just need to format the stick, set a
> bootable flag on it, then just chuck the netinst image on it and away I
> go. Have I got that right?

No :slight_smile:

> The net install image download section has a link to what it says is
> instructions on how to boot from a USB stick, but when I checked it, it
> just seemed to discuss making live images instead of making a stick
> bootable so that it can install from the internet. Can someone clarify
> what I need to do please?

You simply misunderstand :slight_smile:

The instructions do not say how to make it bootable, because if you just
“do them”, the stick IS bootable!

On other Linux distros you have to do special things to make the stick
bootable. Not with openSUSE: the images are already prepared to just
copy to the stick and boot.

Well, copy with a special tool for raw copy, not to copy a file with
“explorer”.

In Linux, to create the stick, a simple:


cp /path/to/iso/file  /dev/sdX

works, provided that “/dev/sdX” is your USB stick. If it is your hard
disk, you nuke it, so be careful what letters you write.


Cheers / Saludos,

Carlos E. R.

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

Thanks for the help guys. That clears things up a lot. I’ll have a practice run with trying to put memtest on my tiny USB stick. By the way. Is there a command that lists things like HDDs and USB sticks that gives a bit of info about each one? I tried

ls /dev/

but that’s not really appropriate. It lists many more devices than I want to see and no doesn’t give any information like total/free space, its label or anything like that that I’d normally use to differentiate them. For example, when I plug in my little USB stick and view it from Dolphin, it is said to be

/var/run/media/stephen/3145-3352/

rather than something like

/dev/sd0

. I know there are other places I could look, but is there a single command, or set of commands, that I could use on the CLI where it doesn’t matter about the desktop environment (or even if there is one) to find this information?

Many thanks folks.

I use


ls -ltr /dev/sd?

Usually the one with the newest date (the last line of output) is the USB that I have just plugged in.

For free space you will have to mount the USB, and then use the “df” command to show usage.

The command (as root)


# fdisk -l

gives the partitioning and disk capacity information for all disks. The last few lines of “/var/messages/log” will usually report what you have just plugged in.

For basic information about what we are talking about: http://en.opensuse.org/SDB%3ABasics_of_partitions,_filesystems,_mount_points

To see what mass storage devices are connected to your system and what partitions they have:

su - -c 'fdisk -l'

To see what devices are mounted where in the directory tree:

mount

To see how large your file systems are and how much of them is in use/free:

df -h

On 2014-04-29 12:26, Stephen Philbin wrote:
>
> Thanks for the help guys. That clears things up a lot. I’ll have a
> practice run with trying to put memtest on my tiny USB stick. By the
> way. Is there a command that lists things like HDDs and USB sticks that
> gives a bit of info about each one? I tried
> Code:
> --------------------
> ls /dev/
> --------------------
> but that’s not really appropriate. It lists many more devices than I
> want to see and no doesn’t give any information like total/free space,
> its label or anything like that that I’d normally use to differentiate
> them.

There is “lsblk”, for instance. My pet concoction is:


> lsblk --output NAME,KNAME,SIZE,TYPE,MOUNTPOINT,LABEL,UUID,PARTLABEL,PARTUUID

With “–help” you get the list of available columns.

> For example, when I plug in my little USB stick and view it from
> Dolphin, it is said to be
> Code:
> --------------------
> /var/run/media/stephen/3145-3352/
> --------------------
> rather than something like
> Code:
> --------------------
> /dev/sd0
> --------------------

Well, ‘/dev/sd0’ is the device and ‘/var/run/media/stephen/3145-3352/’
is the mount point, where the device is mounted. To write files you
access the later. To do things like formatting, or cloning an image,
like for creating the installation stick, you access the device instead.

Have a look at the command “hwinfo” too.


Cheers / Saludos,

Carlos E. R.

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

Thanks again folks. I tried copying memtest to my little stick to try it out, but it didn’t work. I set the boot device priority to removable device first and everything else disabled just to be certain, but the PC I tried it on just said to insert bootable media. The site says that it’s a bootable ISO image, and I copied it to my USB stick with

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.

I doubt that cp is the correct tool to do this. I would say that

dd if =the-file.iso of=/dev/sdX should do it.

Any comments about that?

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.

If you have access to a current openSUSE version or a Windows machine, you can download SUSE Studio Image Writer (http://software.opensuse.org/package/imagewriter for openSUSE; https://en.opensuse.org/SDB:Create_a_Live_USB_stick_using_Windows for Windows) and whatever iso you intend to use and let Image Writer do the trick.

You can use it to put any hybrid iso on a USB stick, for example, Partition Magic.

Well I tried using dd to put the ISO on the stick and it still isn’t working. Doesn’t dd write bytes without regard for filesystems or anything like that? Wouldn’t that mean that there might still be bytes left on the stick from previous files? Could they not be a poteantial problem? Either my USB stick must be damaged or I’m still doing something wrong. I can’t think what though. It’s not like there’s many steps in the process to go wrong on. I’ll Ttry John’s suggestion of trying Suse Studio Image Writer. That should hopefully eliminate a lot of the scope for error (i.e. me).

Plug in that USB. Then use the command:


# fdisk -l /dev/sdX

where you replace the “X” by the appropriate letter for that USB. That will tell us whether it is bootable.

Yes, but those additional bytes should not matter unless they are remnants of a GPT partition table, which can confuse some software.

If your computer is UEFI based, and is configured to do only UEFI booting, then many iso files intended for MBR booting won’t work. If you also have secure-boot enabled, that will be even more restrictive. We are in the dark about those possible problems, because we don’t have the information about your computer.

I’m sure that before I used cp and dd to put the image on the stick that fdisk said it was botable. But here’s it’s output now.

# fdisk -l /dev/sdh

Disk /dev/sdh: 131 MB, 131072000 bytes, 256000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

I could have sworn there was a bootable colunm with an * in it this morning. Could it just be a problem with the ISO image, though? I installed that Suse Studio Image writer that John suggested, but when I tried dropping the image in the window like it says to, the cursor just turned to a “No Entry” kind of symbol. So I tried clicking the window to select the file from a filesystem browser and when I clicked OK it said.

Is there something unusual about the ISO that means it’ll only work from a DVD? 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. And, before anyone asks, yes, I did gunzip it before trying any of this. :wink:

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.

+1 to nrickert’s comments. This particular iso won’t work on a USB stick.

On 2014-04-29 19:06, hcvv wrote:
>
> I doubt that cp is the correct tool to do this.

It is indeed. I can guarantee it. :slight_smile:

We discussed about this at the opensuse mail list, and no one could find
a reason why it would not work.

There are simply many tools in Linux to do it. ‘dd’ is the typical one,
the most powerful and versatile one for the task. But other tools can do
this particular task, and may be easier to use. cp, cat…


Cheers / Saludos,

Carlos E. R.

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

Correct. That ISO is not bootable from a USB stick.

If you want to boot memtest from a USB stick, you would be able to create the stick in Windows, as they compiled a USB installer for that purpose:
http://www.memtest.org/download/5.01/memtest86+-5.01.usb.installer.zip

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

To do that, use the dd methods already outlined, or ImageWriter.

You only need a 4-Gig stick (larger is okay) to run the full DVD openSUSE installer, and I personally think that would be a safer way for you to install.

(And, if I recall correctly, I think the cp that Carlos mentioned also works, as long as it is a hybrid ISO. Which the memtest ISO is not.)

On 2014-04-30 01:46, Stephen Philbin wrote:
>
> I’m sure that before I used cp and dd to put the image on the stick that
> fdisk said it was botable. But here’s it’s output now.
> Code:
> --------------------
> # fdisk -l /dev/sdh
>
> Disk /dev/sdh: 131 MB, 131072000 bytes, 256000 sectors
> Units = sectors of 1 * 512 = 512 bytes
> Sector size (logical/physical): 512 bytes / 512 bytes
> I/O size (minimum/optimal): 512 bytes / 512 bytes
> --------------------
>
>
> I could have sworn there was a bootable colunm with an * in it this
> morning. Could it just be a problem with the ISO image, though?

No, your USB stick is just fine. It displays what I would expect it to
have (it is not an openSUSE stick). Look, this is what an openSUSE 13.1
would look like:


> cer@minas-tirith:~/Download/isos> /sbin/fdisk -l openSUSE-12.3-DVD-x86_64.iso
>
> Disk openSUSE-12.3-DVD-x86_64.iso: 4691 MB, 4691329024 bytes, 9162752 sectors
> Units = sectors of 1 * 512 = 512 bytes
> Sector size (logical/physical): 512 bytes / 512 bytes
> I/O size (minimum/optimal): 512 bytes / 512 bytes
> Disk label type: dos
> Disk identifier: 0x1bf0d4df
>
>                        Device Boot      Start         End      Blocks   Id  System
> openSUSE-12.3-DVD-x86_64.iso1            4248       12439        4096   ef  EFI (FAT-12/16/32)
> openSUSE-12.3-DVD-x86_64.iso2   *       12440     9162751     4575156   17  Hidden HPFS/NTFS
> cer@minas-tirith:~/Download/isos>
> cer@minas-tirith:~/Download/isos> file -s openSUSE-12.3-DVD-x86_64.iso
> openSUSE-12.3-DVD-x86_64.iso: DOS/MBR boot sector; partition 1 : ID=0xef, start-CHS (0x2,4,25), end-CHS (0x6,4,24), startsector 4248, 8192 sectors; partition 2 : ID=0x17, active, start-CHS (0x6,4,25), end-CHS (0x3ff,63,32), startsector 12440, 9150312 sectors
> cer@minas-tirith:~/Download/isos>

The ‘dd’ command you used, or the ‘cp’ one I told you are intended to
destroy the previous partition table and replace it.

If you try the “file -s” command on it, like I did above, it probably
say that it thinks it is an ISO CD or DVD.

> I
> installed that Suse Studio Image writer that John suggested, but when I
> tried dropping the image in the window like it says to, the cursor just
> turned to a “No Entry” kind of symbol. So I tried clicking the window to
> select the file from a filesystem browser and when I clicked OK it said.
> Suse Studio Image Writer Wrote:
>> Sorry, I can’t write this ISO. You need to use another program to
>> write it to a DVD.

I can think of two reasons. One is that the program thinks that your USB
stick is now a CD, because it looks like one. So, it can not write to
it! You can not write to a CD, only read from it.

To recover from this situation, there are instructions on our wiki page
about the USB creation. Maybe I even wrote them.

And, sometimes that image writer program fails. If you are using
Windows, there is another one, from a forensic site, but I don’t have
the link handy. But the link is on the discussion link of the
instructions for usb creation from Windows.

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