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



## uii (Dec 10, 2018)

I tried to install Freebsd 12.0 RC3 and got the same error as mentioned here: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=233098
Also on a amd64 box.

"Startup error in /boot/lua/loader.lua:
LUA ERROR: Cannot open /boot/lua/loader.lua:
no such file or directory"
"can't load kernel"

Is there a solution to fix this? Never had a problem to install version 11.
I wonder if I will be able to install the upcoming release: 12.0?

Thanks for any advice.


----------



## ShelLuser (Dec 10, 2018)

What installation medium did you use?


----------



## uii (Dec 10, 2018)

FreeBSD-12.0-RC3-amd64-memstick.img
USB Stick


----------



## SirDice (Dec 11, 2018)

Use the -RELEASE. The announcement should be in a few days[*], but the image is already available. The announcement will happen when all mirrors have caught up.

[*]  Some time today actually.


----------



## uii (Dec 11, 2018)

I did already.
same Problem.


----------



## GrandAdmiralThrawn (Dec 12, 2018)

I just upgraded from 11.2-RELEASE to 12.0-RELEASE, and now my system is broken in the exact same way. A simple `ls /boot/` on the loader's terminal gives the message "open ´boot´ failed: no such file or directory". Is /boot/ empty, or somehow inaccessible? `ls /` still shows the directory to be present, but like most others its contents can't be listed.

Any idea on how this can be fixed?

*Edit:* Out of curiosity I tried to install from FreeBSD-12.0-RELEASE-amd64-dvd1.iso, as this is not a critical machine. Same thing happens even with a completely clean install.


----------



## xtaz (Dec 12, 2018)

I upgraded three 11.2 systems to 12.0 last night and had no issues. These are running ZFS, but only on a single disk without any mirroring or ZRAID. This means that the standard installer puts /boot on the same dataset as /. If you have a mirror/ZRAID I believe the installer creates a new dataset specifically for /boot? I'm wondering if that may have something to do with the issue you guys are seeing.


----------



## GrandAdmiralThrawn (Dec 12, 2018)

Hm, I'm using UFS, and everything is on one disklabel. It's an older BIOS-based machine in my case.

*Edit:* There is one more thing. When booting from the installation medium, or attempting to boot 12.0 from the system disk, when it lists the disks, it says something like "Error: Reading 1 to 0 on 1" or so, including a hex address (unure if the address points at RAM or disk). Not sure what the exact wording of the message was, but it looks like an I/O error. I just created a FreeBSD 11.2-RELEASE installation medium, and it doesn't show that message at all.

Will install 11.2 now to see whether it's a hardware issue or not.

*Edit 2:* Alright, 11.2 works. 12.0 doesn't, neither as an upgrade, nor as a fresh installation (to UFS on a BSD disklabel).


----------



## tedbell (Dec 13, 2018)

I got this error as well on my old BIOS Dell with UFS/BSD labels.


----------



## Polyatomic (Dec 13, 2018)

Right honorable operators, salute. I have a mind to try FreeBSD-12.0-RELEASE using MBR partitioning scheme and traditional BSD disklabel. Onwards I hope to reproduce the above labouring under difficulties. Coming after intence internalization, I shall plan for deliverance of evil (in all honesty this could take a month of Sundays).


----------



## scottro (Dec 13, 2018)

Yup ran into this on a clean install, one other disk in the machine that shouldn't have been touched. 
There's a bug report someone made but no answer to it yet.


----------



## scottro (Dec 13, 2018)

Ok, in my case, I fixed it by choosing MBR for Boot. I'd had GPT, and I don't feel like playing with it at this point, MBR will work fine for me on this machine.


----------



## GrandAdmiralThrawn (Dec 14, 2018)

I guess next time I'm making a full backup of my FreeBSD notebook before attempting an upgrade to 12.x. 

Because, upon reinstallation of 11.2 I chose to install to BSD disklabels again.


----------



## Deleted member 30996 (Dec 15, 2018)

Using the FreeBSD-12.0-RELEASE-amd64-memstick.img medium with UFS and BSD Partitioning I got the same error about not being able to load the kernel. I went with UFS and MBR and populating my ports tree now.

My em0 card was recognized without any problems.


----------



## fernandel (Dec 15, 2018)

So many problems with 12.0. Looks like  is  better to wait for 12.1? I am ready to install from scratch and I have redy  FreeBSD-12.0-RELEASE-amd64-memstick.img but after all that reading I think it is safer to put on 11.2 which worked for me long time.


----------



## Moebius (Dec 15, 2018)

I have the same problem on FreeBSD in Hyper-V after 12.0-RELEASE upgrade.
What is the currdev and loaddev values from command 'show' in loader prompt ?
Is it normal to have different values that from lsdev returns ?
What is the right way to fix correct values for currdev and loaddev ?


----------



## Ogis (Dec 24, 2018)

I had the same problem with FreeeBSD 12-Release with  UFS BSD and MBR partitioning. But with GPT partitioning everything went smoothly. By the way, I used FreeBSD-12.0 RELEASE amd64 disc1.iso.


----------



## fotkin (Jan 11, 2019)

Upgraded 11 to 12.0, and run into the same problem. Any ideas how to fix?


----------



## GrandAdmiralThrawn (Jan 23, 2019)

Would be really nice to know... or is this fixed by now?! I guess not?


----------



## detsaoT (Jan 27, 2019)

I'm hitting the exact same problem here - running on Hyper-V with a BSD disklabel after using freebsd-update to upgrade from 11.2-RELEASE-p8 to 12.0-RELEASE-p2.

After upgrade but before reboot, if I copy /boot/kernel/kernel to /kernel, I can load it and boot into single user mode.  The filesystem looks totally fine beyond that, I can see the files in /boot and everything appears normal.

Is there a limitation on the /boot directory in terms of which cylinder it's loaded on beyond which the boot1 loader can't see things?

I'm going to keep experimenting and see if I can figure out how to fix this.


----------



## detsaoT (Jan 27, 2019)

When I interrupt BTX and try to boot from /boot/kernel/kernel, I get this:


----------



## detsaoT (Jan 27, 2019)

Ah, I get that in 11.2-RELEASE as well.  Do we not have a non-loader way to boot the kernel anymore?


----------



## detsaoT (Jan 27, 2019)

Tried copying the /boot directory before / after the update -

cp -Rp /boot /boot11
freebsd-update -r 12.0-RELEASE upgrade
freebsd-update install
cp -Rp /boot /boot12

Same error post boot.
Still can't ls /boot
Also can't ls /boot11 or /boot12
(/boot11 does not show up in the loader's file listing)

Do I just have a bad filesystem here?


----------



## detsaoT (Feb 19, 2019)

As others have pointed out:


Copy /boot/loader to /boot/loader.112
Run freebsd-update -r 12.0-RELEASE upgrade
Run freebsd-update install
Copy /boot/loader.112 to /boot/loader
Reboot
Continue post-installation steps as usual.

Now on to my biggest ZFS system to see how much more trouble I can get into.


----------



## GrandAdmiralThrawn (Mar 1, 2019)

I just tried exactly what you're suggesting, detsaoT, and it works fine!

Thank you!


----------



## iExcel (Mar 6, 2019)

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.


----------



## BachiloDmitry (Apr 16, 2019)

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.


----------



## rigoletto@ (Apr 16, 2019)

PR 234031


----------



## sidetone (May 8, 2019)

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.


----------



## VASJD (Jun 19, 2019)

Thank's to DetsaoT, that works good!
====================================

Copy /boot/loader to /boot/loader.112
Run freebsd-update -r 12.0-RELEASE upgrade
Run freebsd-update install
Copy /boot/loader.112 to /boot/loader
Reboot
Continue post-installation steps as usual.
===================
Now on to my biggest ZFS system to see how much more trouble I can get into.
[/QUOTE]


----------



## hruodr (Jun 20, 2019)

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?


----------



## aht0 (Jun 20, 2019)

hruodr said:


> 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?
> Thanks!


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)


----------



## hruodr (Jun 20, 2019)

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.


----------



## aht0 (Jun 20, 2019)

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.


----------



## hruodr (Jun 20, 2019)

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
solution.


----------



## hruodr (Jun 20, 2019)

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
pxeboot.

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.


----------



## mark_j (Dec 11, 2019)

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.


----------



## ElPantera (Jan 5, 2020)

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.


----------



## IlarioQ (Jan 6, 2020)

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.


----------



## trev (Jan 10, 2020)

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.


----------



## sean137 (Jan 22, 2020)

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.


----------



## sean137 (Jan 23, 2020)

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 root@releng1.nyi.freebsd.org)
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


----------



## adamrosas (Jan 24, 2020)

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...


----------



## jayrpowell (Feb 8, 2020)

Hello!

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!
Jay


----------



## sean137 (Feb 14, 2020)

From my testing, this is now fixed, see https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=234031


----------



## Zagzigger (Mar 31, 2020)

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.


----------



## jl2 (Apr 2, 2020)

Hi!

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.


----------



## hruodr (Jan 29, 2021)

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?!


----------



## Snurg (Jan 29, 2021)

hruodr said:


> Is there no pxeboot without lua <politely censored>?!


+1
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.)


----------



## hruodr (Jan 29, 2021)

Suposedly the problem is not the loader. What could it be? See:



			Diskless with 12.x not anymore possible


----------



## Snurg (Jan 29, 2021)

Looking at the numerous bug reports I get the impression that the new bootstrap code possibly in some cases might order CAM devices incorrectly, maybe due to some confusion/bug in hardware recognition, and in this case booting fails.

It might also be an issue with particular optical drives, as I some time ago had to try multiple DVD drives from my storage until booting the ISO succeeded. (I suspected some problem with the drives, as they were used but refurbished. But, further examination of the drives 'rejected' by FreeBSD DVD only showed perfect functional state, not downgraded in any way.)

There are several reports in the PR linked in your link that look like as if unplugging the optical drive and installing via USB stick could be a work-around to make FreeBSD work.

In this case, instead of an internal optical drive, one probably would need an external one that can be unplugged while booting.
Another alternative might be installing a switch on the front plate, so you can power on the internal optical drive after boot-up.
Sadly, both options are not viable for me.


----------



## hruodr (Jan 29, 2021)

It is a meager thin client, no driver at all to unplug, neither CD nor HDD. And I am booting from net.


----------



## Snurg (Jan 29, 2021)

Does the trick to replace the lua bootloader with the old (11.2) one no longer work?
I ask, because, reading back more in this thread and <self-censored>, I am really considering to add the option "Remove Lua bootloader" in my postinstaller.


----------



## Jose (Jan 30, 2021)

hruodr said:


> Suposedly the problem is not the loader. What could it be? See:
> 
> 
> 
> Diskless with 12.x not anymore possible


I see it works for at least some of the peoples


			Diskless with 12.x not anymore possible


----------



## hruodr (Jan 30, 2021)

Snurg said:


> Does the trick to replace the lua bootloader with the old (11.2) one no longer work?



No, this time did not work.



Jose said:


> I see it works for at least some of the peoples



I have other machine in which it works, amd64, not i386. No idea on what it depends.


----------



## Les Ferguson (Oct 18, 2021)

I have downloaded FreeBSD-13.0-RELEASE-amd64-disc1.iso today, 18-Oct-21, burnt it to a disk and booted from it (on an old AMD-64 system which has been running Linux for many years).
I get this same old error:  LUA ERROR: Cannot open /boot/lua/loader.lua: no such file or directory
Did anybody find a solution for this? Or is FreeBSD just not supported on older hardware now?


----------



## grahamperrin@ (Oct 18, 2021)

Les Ferguson said:


> … an old AMD-64 system …



Can you describe the hardware? 

If you like, use Linux to perform a probe and share the results. 









						Linux Hardware Database
					

A database of all the hardware that works under linux



					linux-hardware.org


----------



## Les Ferguson (Oct 20, 2021)

grahamperrin said:


> Can you describe the hardware?



It's an old AMD Athlon PC.  I gave up on spinny disk things and wrote the ISO to a USB stick.  This has worked and I am now configuring my shiny new FreeBSD install.


----------



## grahamperrin@ (Oct 20, 2021)

Les Ferguson thanks. 

2018: 



uii said:


> … same Problem.



uii if you no longer have the problem would you like to add the _Solved_ prefix?


----------



## arturb (Apr 2, 2022)

Getting this with the 13.1 RC1 both on an 13.0 install after a `freebsd-update upgrade` as well as on a clean install.


----------



## grahamperrin@ (Apr 2, 2022)

uii said:


> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=233098



FreeBSD bug _233098 - can not find lua loader_

open



rigoletto@ said:


> PR 234031



FreeBSD bug _234031 - loader can't traverse filesystem, LUA ERROR: cannot open /boot/lua/loader.lua_

closed FIXED
arturb would you like to add a comment to bug 233098?


----------



## arturb (Apr 2, 2022)

grahamperrin said:


> arturb would you like to add a comment to bug 233098?



Hi. I added a small note at [Bug 233098 - comment 5]


----------

