Help creating a bootable usb stick

Hi, As in thew title I am trying to create a bootable usb stick on mu Ubuntu Mate machine to install vortexbox on another machine using the instructions here:
https://wiki.vortexbox.org/linux_installation_instructions
I am carrying this out in a terminal using sudo -i.
All goes well untill I get to the final instructions to make it bootable.

mount /dev/sdb1 /mnt
cd /mnt/utils/linux/
./makeboot.sh /dev/sdb1
The last command to run makeboot.sh fails “permission denied”
Looking at the permissions with ls -l shows it indeed isn’t executeable but, as its a fat 32 drive chmod will not change it.
How can I make this file executeable?
Any help greatly appreciated.

Just for clarity, here is a copy of the commands used and their output…

clive@HP-ProBook-4740s:~$ sudo -i
[sudo] password for clive:
root@HP-ProBook-4740s:~# fdisk -l
Disk /dev/sda: 698.7 GiB, 750156374016 bytes, 1465149168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x0df34a5a

Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 1457002495 1457000448 694.8G 83 Linux
/dev/sda2 1457004542 1465147391 8142850 3.9G 5 Extended
/dev/sda5 1457004544 1465147391 8142848 3.9G 82 Linux swap / Solaris

Partition 2 does not start on physical sector boundary.

Disk /dev/sdb: 59.6 GiB, 64016220160 bytes, 125031680 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: 0x5acb7baf
root@HP-ProBook-4740s:~# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Command (m for help): d
No partition is defined yet!
Could not delete partition 140037349443457

Command (m for help): q

root@HP-ProBook-4740s:~# dd if=/dev/zero of=/dev/sdb bs=1M count=1010+0 records in
10+0 records out
10485760 bytes (10 MB, 10 MiB) copied, 1.11393 s, 9.4 MB/s
root@HP-ProBook-4740s:~# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognised partition table.
Created a new DOS disklabel with disk identifier 0x74004536.

Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p):

Using default response p.
Partition number (1-4, default 1):
First sector (2048-125031679, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-125031679, default 125031679):

Created a new partition 1 of type ‘Linux’ and of size 59.6 GiB.

Command (m for help): t
Selected partition 1
Partition type (type L to list all types): b
Changed type of partition ‘Linux’ to ‘W95 FAT32’.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Synching disks.

root@HP-ProBook-4740s:~# mkdosfs -F 32 -I /dev/sdb1mkfs.fat 3.0.28 (2015-05-16)
root@HP-ProBook-4740s:~# cp -Rp /home/clive/Downloads/vortexbox/BootUSB/. /media/clive/4189-9543
root@HP-ProBook-4740s:~#

This all runs fine without error.
The problem is with the commands that follow this as in my OP.

Good day.

Just to clarify some stuff (since I’m assuming you have little to no knowledge on scripts), a file that ends in .sh is technically both a text file and a script. It is a text file because if and only if you haven’t given it an executable permission (hence when you double click it you open your text editor of choice). It only becomes a script when you make it an executable file.

As you stated earlier, you can make the .sh file an executable file via the chmod command.

Anyways, from what I can tell, makeboot.sh is a script file that contains the commands that makes /dev/sdb1 a bootable media device. If you haven’t made makeboot.sh an executable yet, make it so using the chmod command.

As for permission denied, that can be easily solved by running it as sudo:
sudo ./makeboot.sh /dev/sdb1

(Explanation of the command above: superuser-do run-this-script parameter1)

Hi Ken, thanks for your reply.
You are right, I have a little knowledge of scripting apart from some in the old windows 3/MS DOS days :wink:. But very little on Linux.

As I understand it, it’s a fat32 filesystem so chmod won’t work as it only works on Linux filesystems?

As above, running chmod doesn’t change the permissions because it;s fat32?

I’m running it in a root terminal (sudo -i) so I think the permission denied is because it’s not executeable. Am I right? Happy to be proved wrong.

So my problem, if I am seeing things right is how to make a file executeable on a fat32 filesystem as chmod doesn’t work?

If I’m barking up th wrong tree here free to put me right. I’m still learning Linux.

Quick question: Are you not allowed to make a bootable device using an NTFS partition?

Anyways, in correlation about FAT32, please see the following links:

1 Like

Many thanks Ken, I’ll have a read

Quick question:

Really stupid one on my part, but can’t you just move the script to a folder in your hard drive, change the permissions, and then move it back to the bootable device? XD

I tried that but it didn’t work :cry:

You can just invoke the shell you want directly instead of trying to execute the file.

Meaning, open the file makeboot.sh, check out the first line.

If it’s something like #! /bin/bash then just run:

/bin/bash makeboot.sh /dev/sdb1

(edit: as root, of course)

1 Like

Brilliant ouromov, worked a treat :grinning:
Another step in my Linux learning curve.
Thanks a million.

1 Like