Trying (And failing) to make a bootable USB

If none of the more specific forums is the right place to ask

Trying (And failing) to make a bootable USB

Postby sayansg » 2018-09-13 17:19

Hello Everyone,
I'm a linux newbie. Only been using Debian for a couple of months now. Installed the Stretch 9.5 and somehow lsb_release says I'm now running SID Stable-Updates.
I am trying to make a muiltboot USB with Debian, Xubuntu and Linux Mint XFCE. But can't seem to get it to work. Everything looks fine but USB won't boot.
P.S. My PC is old. Pentium 4 with 1.5 GB ram.
Makebootfat is the only package which seemingly can do the job in Synaptic, but it is mighty complicated.

Using dd or cp commands don't work.

Here is the output from fdisk

Disk /dev/sda: 149.1 GiB, 160041885696 bytes, 312581808 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
Disklabel type: dos
Disk identifier: 0xefafefaf

Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 58304511 58302464 27.8G 83 Linux
/dev/sda2 58306558 312560639 254254082 121.2G f W95 Ext'd (LBA)
/dev/sda5 61432623 188410319 126977697 60.6G 7 HPFS/NTFS/exFAT
/dev/sda6 188410383 312560639 124150257 59.2G 83 Linux
/dev/sda7 58306560 61431807 3125248 1.5G 82 Linux swap / Solaris

Partition table entries are not in disk order.


Disk /dev/sdb: 7.2 GiB, 7759462400 bytes, 15155200 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
Disklabel type: dos
Disk identifier: 0x2d6a1c0c

Device Boot Start End Sectors Size Id Type
/dev/sdb1 * 0 3651583 3651584 1.8G 17 Hidden HPFS/NTFS


I am obviously doing something wrong. Maybe something basic. Can someone help please?
The last line of the output shows Linux Mint on the USB, but the size on disk is 1.9 GB.

Thanks in advance.
sayansg
 
Posts: 16
Joined: 2018-09-13 17:05

Re: Trying (And failing) to make a bootable USB

Postby CwF » 2018-09-13 18:07

Maybe we could see here how many ways. I've wondered.

To make a bootable usb with iso choices I cheat and don't use linux. Should be something here?

Until having a sata dock I used a samsung usb to sata adapter and have dd'd and qemu imaged vm prepared images to it. These boot as usb or direct sata.
Written through the sata dock is the same, also bootable through usb. So dd should work for complete disk images.

I think you can also dd the correct type of iso image to usb, for like a live dvd? Haven't tried this since I mentioned I cheat.

There's mintstick?

Looks to me:
Image the entire device and not the partition. If that is post imaged, then the 7.2 GIB DOS entry is where the boot sector and partition tables live. It shows you have said disk, with a 1.8 GB hidden partition that is an iso?
So don't dd to /dev/sdb1 but rather/dev/sdb. The result should be one primary partition of desired image with ~5.4 GB unpartitioned space.
CwF
 
Posts: 101
Joined: 2018-06-20 15:16

Re: Trying (And failing) to make a bootable USB

Postby sayansg » 2018-09-13 19:29

Start from the top. What should I do?

I have a 8 GB pendrive. Format it using gnome disk or fdisk?
If fdisk what exactly are the commands sequentially.

Should I make a partition or not, after formatting?

Also during 'dd' the file size input vs output are different (1.9GB 1.7GB) Maybe dd is doing it wrong?
sayansg
 
Posts: 16
Joined: 2018-09-13 17:05

Re: Trying (And failing) to make a bootable USB

Postby GarryRicketson » 2018-09-13 20:15

More likely , you wrote your 'dd' command wrong.
Please use code boxes, and show exactly how you wrote the 'dd' command.
User avatar
GarryRicketson
 
Posts: 5051
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: Trying (And failing) to make a bootable USB

Postby CwF » 2018-09-13 21:24

From the top, the question is what is your image source?

To be clear: You do NOT format the pendrive or do anything to it since with the dd command it will be wiped.

So back to the first issue. If the image of choice is an ISO of a DVD, read my earlier comments. An iso listed as a bootable image FOR USB should work fine, or a properly prepared disk image also. There may be unsaid questions here.

Once that is covered, an appropriate image call YOURIMAGE.ISO, or *.IMG or *.qcow2 or *.whatever...

Code: Select all
dd if=/path/to/YOURIMAGE.ISO of=/dev/sdb conv=sync,noerror status=progress


CONFIRM dev/sdb is your destination, is actually the usb drive! Otherwise you will obliterate whatever sdb actually is.

Notice sdb is the entire disk, not a partition of, not dependent on its current structure, formatted, bootable or not = dd doesn't care.

Notice the extra switches are not required, but nice. It ensures a copy if there are errors from the input image, and show progress as it works, and slows it down a tad...

The way I actually do it would be just a different equivalent utility, so if so equipped:

Code: Select all
qemu-img convert -p -O raw /pool/VM/pasture/cows/bootable_single8.4GBpartitionwithGRUB.qcow2 /dev/sdb

No I don't call my imgaes that...but they are little baby cows.

Understand the boot ability of the image is dependent on the image NOT any utility you use on the pendrive. If the above does not work, the image your using is to blame and not the technique.
CwF
 
Posts: 101
Joined: 2018-06-20 15:16

Re: Trying (And failing) to make a bootable USB

Postby sayansg » 2018-09-13 21:36

Of course, as I said earlier, I must be messing something up. Something easy.

P.S. do I need to use isohybrid to change the iso image in any way?

isohybrid keeps saying no of cylinders is more than 1024, some BIOS will not boot from iso.

I took it to mean some old BIOS. And mine is ancient.
sayansg
 
Posts: 16
Joined: 2018-09-13 17:05

Re: Trying (And failing) to make a bootable USB

Postby CwF » 2018-09-13 21:48

sayansg wrote:P.S. do I need to use isohybrid to change the iso image in any way?

As stated I don't use iso's, my guess is no. I have seen iso's listed as different in their boot techniques. Most modern ones I've tried before work.
isohybrid keeps saying no of cylinders is more than 1024, some BIOS will not boot from iso.

First, I said no action whatsoever done to the pendrive...So if this is a utility to manipulate the iso in some way I'm unfamiliar. It could be relevant to whether it is an appropriate iso for this use? Someone more familiar should chime in.
I took it to mean some old BIOS. And mine is ancient

This could relate to above, and also I assume the computer is bootable from a usb drive to begin with? I have a few that are not!

From the top
#1 open new pendrive and insert into usb.
#2 CONFIRM location sdb
#3 dd command.
#4 coffee break
#5 test
CwF
 
Posts: 101
Joined: 2018-06-20 15:16

Re: Trying (And failing) to make a bootable USB

Postby sayansg » 2018-09-13 21:58

Yes I've tried what you just mentioned. Minus the coffee break. Does work. Boots straight into HD and this Debian buster/sid.

P.S. Computer is bootable via pendrive as I installed Debian using a 1 GB pendrive. ISO file was 700 MB.

isohybrid xubuntu-18.04.1-desktop-i386.iso
isohybrid: Warning: more than 1024 cylinders: 1372
isohybrid: Not all BIOSes will be able to boot this device

The size i.e. the no of cylinders, could be the source of the problem. I found this after a lot of searching, but am apprehnsive about testing the technique mentioned.
https://wiki.debian.org/BootUsb2

Changing the no of cylinders might work.
sayansg
 
Posts: 16
Joined: 2018-09-13 17:05

Re: Trying (And failing) to make a bootable USB

Postby sayansg » 2018-09-13 22:00

* Doesn't work, I meant.
Will try dd after cylinder change.
sayansg
 
Posts: 16
Joined: 2018-09-13 17:05

Re: Trying (And failing) to make a bootable USB

Postby GarryRicketson » 2018-09-13 22:10

Start from the top. What should I do?


There are a lot of step by steps, and various ways to do this.
How to make a multiboot usb stick using Debian 9

From one of the many results:
Hint:https://www.circuidipity.com/multi-boot-usb/
4. GRUB configuration

Create boot/grub/grub.cfg and write entries for the ISO files to be copied to the USB device. Note that each Linux distro is a bit different in the manner its booted by GRUB and may require a bit of research. This post on boot entries for a number of distributions on the Arch Linux Wiki might prove helpful.

Link: My own grub.cfg.sample.


by sayansg » 2018-09-13 11:19

Hello Everyone,
I'm a linux newbie.

I would suggest, learn how to make a single OS usb boot stick first, then
move up , into more complicated multi - boot.
== edited===
I think the OP posted while I was writing, or I just did not see it:
Does work. Boots straight into HD and this Debian buster/sid.

P.S. Computer is bootable via pendrive as I installed Debian using a 1 GB pendrive. ISO file was 700 MB.

==================

A good resource, (in my opinion)

https://www.gilesorr.com/blog/multiboot-usb.html

---snip---But - what if you want to be able to install Debian Stable, Fedora, and Debian Testing, and also boot Knoppix, Tiny Core Linux, and the GParted Live CD? You need to keep wiping your USB stick, or you need six USB sticks (and who can keep track of which is which anyway?). GRUB2 (actually I think it was GRUB 1.98, but that's getting pretty technical) introduced a mechanism to boot install media from an ISO image. This can be used to boot an ISO from the same hard drive as your operating system, or to create a USB stick that can boot multiple ISOs - and have the leftover space available as regular USB storage.

Unfortunately, there are a whole slew of catches:

installing GRUB2 to USB is somewhat non-obvious (Daniel's grubs.sh command helps immensely with this)
GRUB2 can chainload an OS on another partition (such as Windows or one of the BSDs), but can't chainload an ISO syslinux menu: this means you can boot a kernel on the ISO, but you can't see the same menu as if you'd dd-ed that ISO onto a USB stick (more frustrating: grub4dos appears to be able to do this)
the invocation for every ISO is different, and some involve significant hoop-jumping
some ISOs have defied my attempts to boot them from multiboot USB for three days: in a practical sense, I now consider them "impossible" to boot (probably not true, but "tricky" seems inadequate) ---snip---


Start at the beginning though, see if you can even make a single OS boot stick, after that work your way into more complex multi-boot.

"Fdisk", see
Code: Select all
man fdisk

By itself is not enough, you need to use 'mkfs' as well,
Code: Select all
man mkfs

https://linux.die.net/man/8/mkfs

And now it is time:
# 4 coffee break
Last edited by GarryRicketson on 2018-09-14 00:25, edited 1 time in total.
User avatar
GarryRicketson
 
Posts: 5051
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: Trying (And failing) to make a bootable USB

Postby CwF » 2018-09-13 22:30

CwF wrote:To make a bootable usb with iso choices I cheat and don't use linux. Should be something here?

Ok, now that I know this is the case, WE need someone else help. Since the ability for linux to do this in a straight forward fashion seems absent I use the same utility I've used for 15 years originally on a computer like yours, now a vm. I used the very utility in that very vm to make a triple boot image for booting computers from my smartphone...No linux involved, except the image was i386_non-free, amd64, amd64_non-free, all debian.

I'll mention the non linux utility if needed....

From Gary now as I type
I would suggest, learn how to make a single OS usb boot stick first, then
move up , into more complicated multi - boot.


You need the magic grub config to assemble your 3 choices. I expect GarryRicketson is on track with what your asking. So you would need to do much more than simply dd'ing an image. I was on that track, a single image. Sorry.

Is the purpose to install from this or to use it live? To use it live I would go another route.
CwF
 
Posts: 101
Joined: 2018-06-20 15:16

Re: Trying (And failing) to make a bootable USB

Postby GarryRicketson » 2018-09-14 01:28

by CwF »I'll mention the non linux utility if needed....

That might be useful to the OP , and then :
WE need someone else help.

Especially if it is some one that has actually done this before, I must admit I have not ever really tried this with multi ISO's or images , all though I have
made some USB drives, that have multi OS's, and are multi boot.
If the OP modifies the search string that I showed earlier, to :
How to make a multiboot usb stick

The results include many non linux solutions, and tools that are available.
This is the first hit: https://fossbytes.com/how-to-put-multiple-iso-files-in-one-bootable-usb-disk-create-multiboot-usb-disk/

There also are some results that are Linux software, but for Ubuntu, nothing specific for Debian.
Some of the so called "tools" , that work for other distros, might not work for Debian, going back to the other link I posted:
https://www.gilesorr.com/blog/multiboot-usb.html
The Debian Fix

I don't fully understand what causes the problem with the Debian-based installer ISOs, but if you use one of them you're likely to find that they boot fine ... but when you get to the point in the installation where Debian tries to find its own CD image, it will fail. This seems very odd because it just booted from it, but there it is. I'm told this is because the Debian initrd doesn't include iso-scan. The way to fix this is to download an initrd image from the matching hd-media/ folder for the distro. This is detailed both at Daniel's site and at the site he got it from. It's ugly, but it worked not only for the Debian Jessie 32-bit installer, but also for the Debian-derived 'Bunsen Labs' disc (and I used the Debian initrd, not their own). However, it did NOT work for the Debian Stretch 32-bit installer.


Also, I am not sure , but a 8gb usb stick, does not leave much room , What is the size of each image you want to put on it ? , That would be the first step, total the size needed for all 3, and then your Grub files,...
It is going to take a lot of "trial by error", I would suggest getting several usb sticks, that you can use to experiment with, if all you have is 1 usb stick, are you sure you really want to risk destroying it for this, ? USB sticks are rather unreliable to start with, and it is possible to brick the usb stick.
User avatar
GarryRicketson
 
Posts: 5051
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: Trying (And failing) to make a bootable USB

Postby debiman » 2018-09-14 04:20

sayansg wrote:Installed the Stretch 9.5 and somehow lsb_release says I'm now running SID Stable-Updates.

this looks very, very fishy and i believe it should be fixed first.
has this been addressed already?
maybe i didn't see it.

if not, please show us
Code: Select all
cat /etc/apt/sources.list{,.d/*}
User avatar
debiman
 
Posts: 2818
Joined: 2013-03-12 07:18

Re: Trying (And failing) to make a bootable USB

Postby sayansg » 2018-09-14 10:23

Well I am a bit lost all this technical stuff. One thing is correct though, I need to be able to make one single ISO bootable usb first then try multiboot.

I don't know how I ended up with SID. Here's sources.list

cat /etc/apt/sources.list{,.d/*}
#

# deb cdrom:[Debian GNU/Linux 9.5.0 _Stretch_ - Official i386 xfce-CD Binary-1 20180714-11:11]/ stretch main

# deb cdrom:[Debian GNU/Linux 9.5.0 _Stretch_ - Official i386 xfce-CD Binary-1 20180714-11:11]/ stretch main

# deb http://security.debian.org/debian-security stretch/updates main
# deb-src http://security.debian.org/debian-security stretch/updates main

# stretch-updates, previously known as 'volatile'
# A network mirror was not selected during install. The following entries
# are provided as examples, but you should amend them as appropriate
# for your mirror of choice.
#
# deb http://deb.debian.org/debian/ stretch-updates main
# deb-src http://deb.debian.org/debian/ stretch-updates main
# deb http://deb.debian.org/debian/ unstable main contrib non-free
# deb-src http://deb.debian.org/debian/ unstable main contrib non-free

# deb http://deb.debian.org/debian stretch main
# deb-src http://deb.debian.org/debian stretch main

# deb http://security.debian.org/debian-security/ stretch/updates main
# deb-src http://security.debian.org/debian-security/ stretch/updates main

# deb http://deb.debian.org/debian stretch-updates main
# deb-src http://deb.debian.org/debian stretch-updates main

deb http://deb.debian.org/debian stretch main contrib non-free
deb-src http://deb.debian.org/debian stretch main contrib non-free

deb http://security.debian.org/debian-security/ stretch/updates main contrib non-free
deb-src http://security.debian.org/debian-security/ stretch/updates main contrib non-free

deb http://deb.debian.org/debian stretch-updates main contrib non-free
deb-src http://deb.debian.org/debian stretch-updates main contrib non-freecat: '/etc/apt/sources.list.d/*': No such file or directory
sayansg
 
Posts: 16
Joined: 2018-09-13 17:05

Re: Trying (And failing) to make a bootable USB

Postby HankB » 2018-09-14 13:43

First off... I don't know how you ended up with sid either. If you don't know how or why you got there I suggest that you go back to the beginning and reinstall. I don't think there is any way to "go back."

Second, I really like the idea of a multiboot USB stick. I'm an unrepentant distro hopper and that would save me time and money. Every time I tried it I have given up in frustration. I eventually decided that buying a bunch of small USB drives was less trouble. It's also easy enough to 'dd' the latest distro onto that old USB stick(*). When I label mine I try to leave space on the label so I can scratch out the old label and write a new one for the next distro. ;)

(*) It's also really easy to 'dd' the new ISO over the system's boot drive. Been there, done that. :shock: :roll: It is good to have backups. Even better to have a full disk image (or at least main partition) backup. At worst you can always reinstall. :D One strategy I have adopted to reduce this possibility is to make the USB device file world writable and then run the 'dd' command as a normal user. I would have to get the device wrong in both commands for this to clobber my system.

HTH,
hank
HankB
 
Posts: 33
Joined: 2012-03-07 15:15

Next

Return to General Questions

Who is online

Users browsing this forum: No registered users and 5 guests

fashionable