LUA ERROR: Can not open /boot/lua/loader.lua

running into the same problem here.

Thinkpad X1 Carbon 5th gen, currently with Arch Linux on it.

Tried -CURRENT, 12-STABLE, -RELEASE memsticks and disc1s, none worked and all gave me the same error.
Well, the solution is the same. Just find a machine with 11.2 and take /boot/loader from there (replace 12's one with it) - and there you go. That's actually incredible, the bug is known for at least half a year now. So, I think the easiest way to fix a failed machine is this:
- download 11.2 USB image and flash it to a USB-drive.
- boot from this USB drive
- mount the bootable media of the failed machine to /mnt
- rm /mnt/boot/loader && cp /boot/loader /mnt/boot/
- reboot, don't forget to remove USB drive.
Using MBR partitions worked.

I tried BSD partitions and got the LUA error. Then, tried it with a separate /boot/ partition, and it booted up with a different error. FYI, the old recommendation of 100MB for boot is not enough.
Thank's to DetsaoT, that works good!
  1. Copy /boot/loader to /boot/loader.112
  2. Run freebsd-update -r 12.0-RELEASE upgrade
  3. Run freebsd-update install
  4. Copy /boot/loader.112 to /boot/loader
  5. Reboot
  6. Continue post-installation steps as usual.
Now on to my biggest ZFS system to see how much more trouble I can get into.
And what the hell is this "loader.lua"?!

FreeBSD has since many years a good working loader: why now a "loader.lua"? Because lua is cool?!

And why is FreeBSD still offering unusable untested images? To promote the industry producing removable media?

Can please someone tell me, what is the official way to install FreeBSD 12.0 without upgrading from FreeBSD 11?

BTW, I tried to install using PXE: not even ls reads a directory. Configurated as normal diskless.

Does it hole the files with tftp or nfs?
And what the hell is this "loader.lua"?!
FreeBSD has since many years a good working loader: why now a "loader.lua"? Because lua is cool?!
And why is FreeBSD still offering unusable untested images? To promote the industry producing removable media?
Can please someone tell me, what is the official way to install FreeBSD 12.0 without upgrading from FreeBSD 11?
I've been using 12-STABLE images since "12" was released and had issue with the boot loader once. During RC or BETA release. past-RELEASE the images seem to work just fine. Have you tried installing on different hardware/using different disk layout (MBR vs GPT)? Back at the time, I ended up solving the boot loader problem by firing up 11.2 DVD after installing "12" and installing boot loader from older install media. Mind you, I've been mostly using "legacy boot"/MBR due to old Dell Inspiron 17 laptop not supporting UEFI..

Changes in boot loader/init were sponsored, either by DARPA or Dell EMC (can't remember which, you probably can find it from RELEASE changelogs easily enough)
Sponsored unnecessary, spoiling changes? Then FreeBSD will end with an inflated, cool loader like grub.

And the destructive work was done only due to money from sponsors?

As said, I install with pxe and I cannot do anything with this loader. Rubbish.
For most it probably works just fine or it would have been reverted.
You did not answer if you have tried with 12-STABLE? It might have in fixes not yet in RELEASE images.
I will wait till 12.1. Then I will see if it works and if not, then (a) either install in a non standard way or (b) search for other
I managed to install 12.0. I have a system that boots, now I have to inspect it.

I saw in the boot directory, together with the infame lua files, normal file names for the loader. I copied
pxeboot from 11.2 to 12.0, and with it I was able to boot the installer, perhaps because it loaded a
non lua loader. Now it was not any more possible to install only mounting the vnd of the read only iso image:
I had to copy the 80 GB of the mounted iso image again in the nfs server, now rw, only for putting there a new

80 GB install media should be enough to install a minimal system without internet connection. But no, the internet
connection was necessary, and also a headache. At the beginning of the milenium was much easier to install
FreeBSD with internet than today. But the priority seems to be not to improve the installer, but after having spoiled it,
now to spoil the boot loader.

As said, copying pxeboot allowed to boot the kernel, but since the CD has an unnecessary /etc/fstab
that mounts the mounted CD, I ended in single user mode. I had anyway now rw files: I corrected the fstab
in the NFS server and booted again.

Well, it booted and mounted the root, but did not ask to configure an interface, perhaps because one was
configured and connected with a crossover cable to the tftp and nfs server. At the time to download the files there
were of course no internet.

I went to the shell, and saw that ifconfig did not show my wlan devices. I tested other usb wlan devices, without
success. Since at home I share internet with a neighbour, I can only connect to the internet through wlan. Well, I have a
router box that can be configured in wlan client mode: it connects with wlan to the internet and offers it to me as
ethernet. Enough? No! The ethernet interface of the computer is connected to the nfs server. Well, solved because
I had also an usb ethernet adapter that was recognized by the kernel of the installer. And after the installer downloaded
the files, it offered me to configure the wlan adapter that did not recognize before.

Do you want to know the difference between OpenBSD and FreeBSD? Just see the quality of the installer of OpenBSD.
I encountered the same error with FreeBSD-12.1-RELEASE-amd64-disc1.iso.xz

I extracted this .xz to a local SSD and burnt it from that .iso onto the A DVD-RW (TDK if that matters).

Upon attempting to boot the DVD in another machine, this error appeared:
Startup error in /boot/lua/loader.lua:
LUA ERROR: cannot open /boot/lua/loader.lua: no such file or directory.

I went back to the original .xz and (for the first time) checked the CHECKSUM file. It matched. I then checked the .iso that was extracted from it and it didn't match.

So, a cautionary tale, to check the CHECKSUM just in case your disk has a problem. Mine doesn't show any issues (silent bit-rot perhaps?) which is perplexing.

Regardless I extracted the .iso again from the same .xz to the same SSD and this time the CHECKSUM matched.

Burnt that to the DVD-RW and am installing now.

I was doing this on Windows 7 x64 using 7-zip v17.01 onto a Samsung 850EVO.
Tried a fresh install today with the current ISO. I encountered this same error when trying to boot the installation media. I switched to Debian a few years ago and I was tempted to go back to FreeBSD. Sadly it seems BSD hasn't changed. Sort of like an Italian sports car. If or when it works it's amazingly great. Basic quality is an issue though when even the installer doesn't work. I encountered similar issues with software ported over from Linux - too much effort needed just to keep it running and stable. I'll be sticking with Debian.
Hi, everybody. This is the first time I've ever approached the BSD world. I've been trying to install, but I'm finding the problem with lua too.
Excuse my English from deepl, I read the tread but I did not understand if there is a solution.
Thank you very much.
The bug report at PR 234031 would suggest that the issue *may* be resolved in FreeBSD-CURRENT. The solution upgraders use it so copy the bootloader from 11.x to 12.x.

You don't mention which version you are trying to install. Knowing that would be helpful.
I have this problem too.

Like mark_j, I downloaded FreeBSD-12.1-RELEASE-amd64-disc1.iso.xz. The SHA was correct before before and after unarchiving. I burnt it to a physical DVD. I booted from that DVD and got the same error as others.

This is the first time I've tried to install FreeBSD on bare metal, and I'm not encouraged.

I'll try with FreeBSD-13.0-CURRENT-amd64-20191226-r356085-disc1.iso.xz and report back here.
So I tried FreeBSD-13.0-CURRENT-amd64-20191226-r356085-disc1.iso.xz and additionally physically removed all other disks from the system and the same bug occurs. The exact output and some commands I tried is below:

Consoles: internal video/keyboard
BIOS CD is cd0
BIOS 639kB/2090660kB available memory
Looking up /BOOT/LOADER... Found
FreeBSD/x86 bootstrap loader, Revision 1.1
(Thu Dec 26 03:52:34 UTC 2019
Startup error in /boot/lua/loader.lua:
LUA ERROR: cannot open /boot/lua/loader.lua: no such file or directory.

can't load 'kernel'

Type '?' for a list of commands, 'help' for more detailed help.
OK lsdev
cd devices:
cd0: BIOS drive C (12402432 x 512):
OK ls /
open '/' failed: no such file or directory
OK ls /boot
open '/boot' failed: no such file or directory
I have a fussy 20 year old server that I am trying to install FreeBSD 12 on, and have also run into this bug, in fact 10.4 is the last version I can install
from CD. In my case I believe the BIOS is lying about which device is being booted from and confusing the boot loader, unfortunately this machine has
no PXE boot, no USB boot, so I'll have to prepare the drives on another machine.

edit: curdev and loaddev are being set to cd0 and when I try to ls the activity light on the cd-rom flashes. 32bit lua is just broken...

I seem to be having the same failure loading /boot/lua/loader.lua Sean137 described above as well as others. I am trying to install a fresh copy of FreeBSD 12.1 from a DVD, created from the FreeBSD-12.1-RELEASE-amd64-dvd1.iso image. I am trying to load it on a duplicate system to my current FreeBSD 11.3 system, which are both based on BioStar MCP6P M2+ motherboards with Phoenix Award BIOS release 06/16/2009. The hard drive on the new system is blank, and I get the same error irrespective if I use a SATA or IDE based DVD drive.
Interestingly, the same DVD install disk works fine on a Dell OptiPlex 745 and on a Toshiba Satellite C55, so I don't think it has anything to do with a bad image 'burnt' on the disk.
I hope it is not simply the case that the BioStar systems are too old to upgrade, as I've always appreciated FreeBSD support for older yet still working hardware.
If anyone has some suggestions on what I can check / change in the BIOS, or jumpers on the motherboard, it would be greatly appreciated. Thanks!
The problem is that the download images are dated 2019-Nov-01 and all contain that bug.
Very, very time-consuming.
Very disappointed this bug was allowed to get into the releases in the first place; and to find it still there sends a very poor signal.
Such things tempt one to look around; pity FreeBSD has a lot to offer in some respects.

As another data point (and because I haven't seen this specific case mentioned), I ran into this problem today while trying to build from source for the first time. I followed the steps in the handbook and upgraded from 12.1-RELEASE to base/stable/12. I hit this after running "make installworld && shutdown -r now".

I was able to boot into the live image on the 12.1 installer and follow detsaoT's instructions by running:

mount -o rw /dev/ada1s1a /mnt
cp /boot/loader /mnt/boot/loader
shutdown -r now

The system booted and I was able to complete the build/install at "mergemaster -Ui". I've been using it most of the afternoon, and everything seems to be working.
I find incredible that till now, 12.2, we are suffering from this problem that was created for putting there the infame cool lua!!

Is there no pxeboot without lua garbage?!
Is there no pxeboot without lua <politely censored>?!
I would like an option to use the good old bootloader, about the same way one can choose between MBR and GPT.
If there even were an option to enable the original bootloader optical style (without logo), which had no unnecessary, distracting gimmicks and made multibooting easy as a snap, I would rejoice.

Personally, to me it is not exactly enjoyable if I imagine the question "can I run FreeBSD on this particular hardware, or will it get stuck at boot?" can become a frustrating hit-or-miss game. Such things can make people afraid of advocating (at least me).
Other things I read make me worry also, like that the 12.2 kernel modules allegedly are broken so one needs to build them, and such.
Such can lead to an impression that things are being rushed.

(Especially as to my knowledge there has not been given a technical reason why the proven reliable Forth bootloader had to be replaced by Lua, except of Forth being old and Lua being more modern.
So my purely personal speculation is that the Lua's bootloader's purpose might be to soften the planned transition to ZoL, thus in the sake of progress. BTW, I am not criticizing. I just try to understand what is going on, what will be the trends.)