[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help Creating A Bootable USB Disk



From: "'Christian Peeples' via BerkeleyLUG" <berkeleylug@googlegroups.com>
Subject: Help Creating A Bootable USB Disk
Date: Sun, 2 Aug 2020 08:24:07 +0000 (UTC)

Friends More Competent Than I:

I am finally getting around to upgrading to 20.4, but I seem to be stuck on step one. I went to Ubuntu for instructions and read the instructions and watched the video. The first thing that one is to do is create a bootable USB stick. I got a couple of brand new 8 GB USB sticks from Frys. I opened Startup Disk Creator from the applications. It detected the USB stick I had inserted and asked if I wanted to erase it. I clicked on that. The program did its thing and opened the USB stick in "Files" as a blank disk. When I went back to "Make a Startup Disk," the selection of how much space to allocate to documents and settings was greyed out. More importantly, the box for "Make Startup Disk" was greyed out. I tried it several times with the same result. What am I doing wrong?

Ewey GUI bits and/or other overly "high level" tools may be making it
more complicated/messy/problematic, by hiding what they're actually
doing.

So, first bit, Ubuntu (or the like - *buntu), will typically also
have some Ewey GUI file management thingy installed by default,
and also by default, anytime it sees newly inserted/attached
media, it is sees stuff on there that it thinks it can mount, it will
generally do so.  So, first of all - that can get in the way.
If I recall correctly, the typically guilty program/utility on
*buntu is nautilus.  To get around that first problem, minimally
will probably want to go into nautilus's preferences/settings,
and check/uncheck/change whatever setting(s) are necessary, to
prevent it from automatically mounting anything.
And ... why might automatically mounting be problematic?
Say one inserts USB flash, nautilus sees some filesystem(s) on
there and mounts them (even a "factory fresh" "blank"(-ish)
such USB flash, typically comes with an empty (or not so
empty - sometimes they throw some gunk utility software in there)
FAT/VFAT filesystem on there.  Anyway with that (or old
ISO image, or whatever) mounted from the USB, many operations
attempted on the USB may fail with "device busy" or the like - as
it has filesystem(s) mounted from that device.  We want to
avoid that.  So, unplug the USB, disable - at least temporarily -
anything that's automatically mounting stuff from it when it's
inserted.
One can also check/confirm what's mounted, by looking at the output
of the command mount:
$ mount
... but that can be rather long list of stuff to look over.
However, before inserting USB, and after, that output from
mount should look the same - if it doesn't - most notably
additional line(s) of stuff - there's likely a problem, as
something probably mounted filesystem(s) from the USB device.

Next, you'll need the ISO file you want to write to the USB,
if you've already got that, you're that much closer.
Should also verify that image before bothering to write it to
USB.

Writing it to USB - with the USB device inserted, you'll need to
identify what device the USB came up as.
Typically it'll be some /dev/sd* device.
So, probably do:
$ ls -d /dev/sd[a-z] /dev/sd[a-z][a-z] 2>>/dev/null
With the USB inserted, typically you'll see 2 USB devices,
/dev/sda and /dev/sdb
And typically sda will be your boot/main drive and sdb the USB
device.  But you may have more, depending upon your hardware
configuration.
In any case, will want to check which device is the USB.
One hint is to do that ls command before inserting the USB,
and then again after.  Something new show up?  That's probably
your USB device.
In any case, also good to check further.  E.g.:
# blkid /dev/sd[a-z]*
That will generally look at the sd devices (and their partitions),
and try and identify what's on them.
So, you should be able to see which sd device (e.g. sda) and it's
partitions correspond to your installed operating system.
And which (e.g. sdb) corresponds to the USB flash.
Once you've identified and confirmed the flash device (e.g. /dev/sdb)
we're almost there.
Now you want to write - in "raw" format, to the USB, your ISO image
file.  Also, for efficiency of flash writing, we'll want to
specify a large write block size - we want no less than the flash's
erase block size, and some integer multiple of that is fine.
But we don't know that size, but we can get it's some power of 2.
So, we just do something more than big enough, and that will do us
just fine.
$ expr 4 \* 1024 \* 1024
4194304
$
That would be 4 MiB - that will quite more than suffice.
So, let's say our USB device is /dev/sdb (be sure to use whatever your
actual device is - wrong device and one can do great damage - such as
destroying one's installed operating system ... with great power comes
great responsibility).
So, now just dd to write the USB device:
# dd if=ubuntu-20.04-desktop-amd64.iso obs=4194304 of=/dev/sdb
That may take a moderate while to complete.  If the USB has
an LED activity indicator, it will generally light of flash to
indicate write activity.
Once that's completed, you can check it matches your .iso file, e.g.:
# cmp ubuntu-20.04-desktop-amd64.iso /dev/sdb
Expect that it will complain about EOF, e.g.:
cmp: EOF on buntu-20.04-desktop-amd64.iso
... but it shouldn't otherwise complain.  And the reason it's
"complaining" about EOF - it read both files, all the bytes read up
to the length of the shorter matched ... but then it hit the
end of the shorter - hence the EOF "complaint", as it will
almost always be the case that the size of the USB flash
device is larger than that of the ISO image (were it
smaller, it wouldn't fit - and that would be a different problem).

That's basically it.  Made it through to there, and you've got your
ISO written to your USB flash device.

--
You received this message because you are subscribed to the Google Groups "BerkeleyLUG" group.
To unsubscribe from this group and stop receiving emails from it, send an email to berkeleylug+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/berkeleylug/20200802032129.38336qvc5pemzhss%40webmail.rawbw.com.