Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I created a bootable usb from which I was going to install Arch. I did this the following way:

sudo dd if=/path_to_arch_.iso of=/dev/sdX

But when I tried to boot from this usb flash, I failed. There was no error, it just couldn't boot from it. I downloaded iso file from the official arch linux website recently so it should be up to date. Previously I was able to install mint, elementary and ubuntu from usb flash successfully.

It preventing me booting the following way:

After selecting "boot from usb" I was shown a black screen for 1 second and brought back to the menu where I must choose a temporary boot device. When I did it again the story repeated.

What might be the cause?

share|improve this question
    
Sometimes Uefi or similar configurations fails to boot dd'ed flash. Try instead using tools that have support for uefi and bios, like liveusb-creator(it exists on fedora, archlinux aur repo, windows (fedorahosted.org/liveusb-creator)). –  IBr Apr 22 at 4:26
    
@IBr, I need such a tool for linux (the one I can launch on linux). –  Alex Apr 22 at 4:27
    
@IBr, sudo aptitude install liveusb-creator doesn't work, it can't find it. –  Alex Apr 22 at 4:31
2  
Can you please clarify a bit more. In what way were you prevented from booting the drive? Was it not an option in your boot menu? Was it there, but selecting it just led to a black screen? Etc. –  HalosGhost Apr 22 at 4:31
2  
Don't use liveusb creator. If you're trying to boot on UEFI all you need to do is format the disk correctly! Use gdisk and your man pages! –  mikeserv Apr 22 at 5:20

2 Answers 2

up vote 1 down vote accepted

So I'm writing this as I do it myself. I just downloaded the latest arch iso and mounted it:

du archlinux-2014.04.01-dual.iso
535M    archlinux-2014.04.01-dual.iso

mkdir -p /mnt/iso
mount ./arch*iso $_
mount: /dev/loop0 is write-protected, mounting read-only

ls $_/arch
boot  x86_64  checksum.i686.md5    pkglist.i686.txt
i686  aitab   checksum.x86_64.md5  pkglist.x86_64.txt

You don't need most of that up there. Or, it's better to say you probably only need half of it. There are two images here - one each for 32 and 64-bit machines:

ls $_/x86_64
root-image.fs.sfs

du $_
230M    /mnt/iso/arch/x86_64

I'm willing to bet you've got a 64-bit machine if you're going with Arch and so the sfs image file in the above directory makes the bulk of what you'll need. Still, if it is a 32-bit machine just follow along but from here on out substitute the 686 files for the x86-64 I'll be targeting.

mkdir -p /mnt/img
mount /mnt/iso/EFI/archiso/efiboot.img $_
cd $_ ; ls
EFI  loader

cd EFI ; ls
archiso  boot  shellx64_v1.efi  shellx64_v2.efi

ls ./*/*
./archiso/archiso.img  ./archiso/vmlinuz.efi  
./boot/HashTool.efi  ./boot/bootx64.efi  ./boot/loader.efi

So the hybrid .iso image works by subverting the iso image standard and creating something like a fake partition or something. I don't really know too much about that but if you have a UEFI system the kernel and initramfs image you'll need are in the efiboot.img file. In fact, once you pull what you need out of here, you need little else than that other file I've already pointed out. So, now I'll get into gdisk and we'll prepare our target efi system partition. It's kind of a cake walk.

OK, I guess I don't have a thumb drive handy so I'm just going to do it like this:

fallocate --l $((650*1024*1024)) /tmp/bootimage
losetup -f --show -P $_
/dev/loop2

You don't want to use fallocate or losetup I'm just showing you that I am in the interest of full-disclosure. But, otherwise, what I am doing is what you need to do. For instance, because you likely wrote over some very early blocks on that disk, we need to clear them:

dd ibs=4M count=1 if=/dev/zero of=/dev/loop2

Now we get into gdisk. Substitute whatever /dev/... device file your usb disk is on for my /dev/loop2:

gdisk /dev/loop2
GPT fdisk (gdisk) version 0.8.10
Partition table scan:
  MBR: not present
  BSD: not present
  APM: not present
  GPT: not present
Creating new GPT entries.Command (? for help): ?

When you open gdisk you'll see something like the above go ahead and hit the ? for the menu:

b       back up GPT data to a file
c       change a partition's name
d       delete a partition
i       show detailed information on a partition
l       list known partition types
n       add a new partition
o       create a new empty GUID partition table (GPT)
p       print the partition table
q       quit without saving changes
r       recovery and transformation options (experts only)
s       sort partitions
t       change a partition's type code
v       verify disk
w       write table to disk and exit
x       extra functionality (experts only)
?       print this menu
Command (? for help): o

We need a new empty partition table. That's o.

You'll need to agree here:

This option deletes all partitions and creates a new protective MBR.
Proceed? (Y/N): y

Next we need a partition. At the below prompts where you don't see the key entered it's because I just hit ENTER to agree to the default:

Command (? for help): n
Partition number (1-128, default 1):
First sector (34-1331166, default = 2048) or {+-}size{KMGTP}:
Last sector (2048-1331166, default = 1331166) or {+-}size{KMGTP}: 500M
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): ef00

If you hit L at the last prompt above you'll get a list of all the available partition types but what you need is type ef00 for efi system partition. And you're almost done.

Have a look at your new partition with p then follow it up with w if you like the it looks to write out your pending changes:

Command (? for help): p
Disk /dev/loop2: 1331200 sectors, 650.0 MiB
Logical sector size: 512 bytes
Disk identifier (GUID): E5D5A761-6AFA-48C6-9BA5-CED0DA2F62CA
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 1331166
Partitions will be aligned on 2048-sector boundaries
Total free space is 309180 sectors (151.0 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048         1024000   499.0 MiB   EF00  EFI System

Command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/loop2.
The operation has completed successfully.

I assume you have a bootloader but you might as well put one on your USB disk too, and this is really easy. In fact, I'll show you how to set it up with rEFInd which was actually a revival of an older project and written and maintained by the same guy who wrote gdisk.

Get the refind.bin.*.zip you'll find here and we'll unpack it to our disk then copy the arch image over and we're done.

Actually, we'll definitely need a filesystem first. Glad I'm actually doing this as I write it - missing that would have been a dealbreaker for sure.

mkfs.vfat -n ESP /dev/loop2
mkfs.fat 3.0.26 (2014-03-07)
Loop device does not match a floppy size, using default hd params

Again, ignore the stuff about loop and use your own device. -n names the partition. I like to use ESP.

Ok, so now for rEFInd:

mkdir /tmp/refind
unzip ~/Downloads/refind-bin-0.7.9.zip -d $_  
...
$_/ref*/install.sh --usedefault /dev/loop2
Not running as root; attempting to elevate privileges via sudo....
Installing rEFInd on Linux....
UnmountEsp = 1
Copied rEFInd binary files
Copying sample configuration file as refind.conf; edit this file to configure
rEFInd.
Installation has completed successfully.
Unmounting install dir

mkdir -p /mnt/bootdisk
mount /dev/loop2 $_

mkdir /mnt/bootdisk/EFI/arch_linux
cp /mnt/img/EFI/archiso/* -t $_
cp -R /mnt/iso/arch/*64* $_
cp -R /mnt/iso/arch/aitab $_
ls -lR $_
/mnt/bootdisk/EFI/arch_linux:
total 23328
drwxr-xr-x 2 root root     4096 Apr 22 02:09 x86_64
-rwxr-xr-x 1 root root      228 Apr 22 02:09 aitab
-rwxr-xr-x 1 root root 19882780 Apr 22 02:08 archiso.img
-rwxr-xr-x 1 root root       99 Apr 22 02:09 checksum.x86_64.md5
-rwxr-xr-x 1 root root     5142 Apr 22 02:09 pkglist.x86_64.txt
-rwxr-xr-x 1 root root  3979248 Apr 22 02:08 vmlinuz.efi

/mnt/bootdisk/EFI/arch_linux/x86_64:
total 234812
-rwxr-xr-x 1 root root 240447488 Apr 22 02:09 root-image.fs.sfs

That just about does it. You will need to setup rEFInd a little bit...

echo '"ArchISO" "archisolabel=ESP archisobasedir=/EFI/arch_linux \
    copytoram rootwait initrd=EFI\arch_linux\archiso.img"'\
    >$_/refind_linux.conf

That should give you a bootable system. Please look through the main refind.conf in ../BOOT - it's very well commented and pretty much documents itself. You'll also want to head over to rodsbooks.com and read the docs there.

One last note though. If you were to put the same stuff on your system's hard disk on the EFI system partition you'd always have access to the bootable arch live disc.

share|improve this answer
    
thanks. note I already have unallocated space, I made it by gparted earlier. –  Alex Apr 22 at 8:49
    
@Alex - well, no guarantees then. I really don't like gparted personally. gdisk is easy - and it works all of the time, opposed to gparted... –  mikeserv Apr 22 at 9:04
1  
The OP just wants to create an install disk: none of this is necessary... –  jasonwryan Apr 22 at 9:44
    
@jasonwryan That is an install disk. And, more to the point, a separate disk is not at all necessary anyway. Though I do in fact pointedly copy only what's necessary - not including rEFInd, that is. –  mikeserv Apr 22 at 9:53
    
@mikeserv The archiso just has to be dd'ed; tell me why any of this is either necessary or desirable. –  jasonwryan Apr 22 at 10:02

The proper way to do so is (as described on the Arch Linux Wiki)

# dd bs=4M if=/path_to_arch_.iso of=/dev/sdX && sync

using GNU dd.

share|improve this answer
    
I've written some of it. At least mine was not reliable. I deleted my comment anyway. In any case you definitely don't need both image files. And why use a non-compat filesystem like hybrid iso when you don't have to. I'd rather have a real partition table. –  mikeserv Apr 22 at 9:48
    
what's GNU dd? Didn't I use it? What's the difference with mine code? –  Alex Apr 22 at 13:57
    
You're using GNU dd. The difference is bs=4M and sync command. linux.die.net/man/2/sync –  enedil Apr 22 at 14:18
    
that didin't work for me either. maybe I should use a CD instead of usb flash? –  Alex Apr 24 at 2:39
    
You can try, trough the command has worked for me. –  enedil Apr 24 at 7:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.