# ERROR: cannot open /boot/lua/loader.lua



## Dayan (Aug 25, 2021)

Hello,

Trying to install FreeBSD 13.0 from the mini memstick image. I created the USB correctly using dd comand.

In UEFI mode while booting the USB stick I get this:


```
Consoles: EFI console
Reading loader env vars from /efi/freebsd/loader.env
FreeBSD/amd64 EFI loader, Revision 1.1

Command line arguments:
Image base: 0xcb62e000
EFI version: 2.00
EFI Firmware: American Megatrends (rev 4.632)
Console: efi (0)
Load Path: \EFI\BOOT\BOOTX64.EFI
Load Device: PciRoot(0)/Pci(0,1d)/HardwareVendor(aa7ba38a-dabf-40c3-8d18-b55b39609ef7)[26:8001000000005553422020202020ffffffffffffffffffffffffffffffffffffffffffffffff//HD(1,MBR,000ec956,800,1dcf800)/HD(1,MBR,90909090,1,10418)
Ignoring Boot0006: Only one DP found
Failed to find bootable partition
ERROR: cannot open /boot/lua/loader.lua: no such file or directory.
```

First, I wiped both hard drives on the target system with DBAN. The system previously had a grub loader with one OS on each hard drive. Ubuntu 20.04.2 LTS and Windows 10 Pro. I suspect that when I wiped both hard drives with DBAN that the grub loader is still there since DBAN can't see hidden partitions. I haven't investigated this further, but I think it shouldn't matter unless I'm mistaken in how BSD works.

Edit: Did more reading, I would have to convert both hard drives to GPT from MBR. I don't want to do that so I'll stick with legacy BIOS options if that's possible. When I boot the USB in legacy BIOS mode I get this:


```
Try (hd0,0): non-MS: skip
Try (hd0,1): invalid or null
Try (hd0,2): invalid or null
Try (hd0,3): invalid or null
Try (hd1,0): invalid or null
Try (hd1,1): invalid or null
Try (hd1,2): invalid or null
Try (hd1,3): invalid or null
Try (hd2,0): invalid or null
Try (hd2,1): invalid or null
Try (hd2,2): invalid or null
Try (hd2,3): invalid or null
BIOS: Drive=0x0, H=0, S=0

Try (fd0): invalid or null
Cannot find grldr
```

If I try to boot from the USB in legacy BIOS mode I get a grldr error. What can I do to solve the above grldr error? Edit: I tried booting the USB in both UEFI and legacy BIOS mode with both hard drives unplugged to see what would happen and I get the same errors. The loader.lua error in UEFI mode and the grldr error in legacy BIOS mode.

- Regards.


----------



## SirDice (Aug 25, 2021)

Dayan said:


> I suspect that when I wiped both hard drives with DBAN that the grub loader is still there since DBAN can't see hidden partitions.


DBAN wipes the whole drive, so no partitions will remain (as the sectors that hold the partition tables are also wiped). 

I do suspect you might have a bunch of EFI variables set from the previous OSes, those aren't stored on disk. With the stick plugged in can you select the boot menu and force it to boot from the USB stick? Usually it's F11 or F10 for the EFI/BIOS boot selection.



Dayan said:


> Did more reading, I would have to convert both hard drives to GPT from MBR. I don't want to do that so I'll stick with legacy BIOS options if that's possible.


Don't use MBR, just use GPT. If you select the ZFS install option you can have it write both a CSM boot and an EFI partition. If they're both available you can boot FreeBSD using CSM and EFI boot. In other words you can switch later on.


```
dice@molly:~ % gpart show
=>       40  312581728  ada0  GPT  (149G)
         40     409600     1  efi  (200M)
     409640       1024     2  freebsd-boot  (512K)
     410664        984        - free -  (492K)
     411648   33554432     3  freebsd-swap  (16G)
   33966080  278614016     4  freebsd-zfs  (133G)
  312580096       1672        - free -  (836K)
```
As you can see I have a freebsd-boot and an efi partition. That means this system can EFI boot and CSM boot. No configuration changes need to be made on the FreeBSD side itself.


----------



## Dayan (Aug 26, 2021)

SirDice said:


> DBAN wipes the whole drive, so no partitions will remain (as the sectors that hold the partition tables are also wiped).
> 
> I do suspect you might have a bunch of EFI variables set from the previous OSes, those aren't stored on disk. With the stick plugged in can you select the boot menu and force it to boot from the USB stick? Usually it's F11 or F10 for the EFI/BIOS boot selection.
> 
> ...



I do really appreciate your reply. I figured it out and it was a stupid mistake. In the dd command I put 
	
	



```
sdb1
```
 instead of 
	
	



```
sdb
```
 when I was writing the image to the USB stick. Please feel free to delete this thread.


----------

