Page 1 of 1

Issue with grub-mkrescue: 'mcopy' invocation failed

Posted: Mon Jul 19, 2021 2:59 pm
by nukelet
Hello! I've been following the Bare Bones tutorial and managed to get a functioning "Hello world!" kernel, but I'm having problems with generating an .iso image with grub-mkrescue (this was run on an Arch Linux machine):

Code: Select all

$ grub-mkrescue . -o myos.iso
mcopy: No directory slots
grub-mkrescue: error: `mcopy` invocation failed
Upon using the -v flag, after a very long section (~9K lines) of debug messages, there are the following lines (I'm also attaching the complete log file in case it's of any use):

Code: Select all

grub-mkrescue: info: kernel_img=0x56134d0283c0, kernel_size=0x15000.
grub-mkrescue: info: the core size is 0x19b44.
grub-mkrescue: info: writing 0x1c000 bytes.
grub-mkrescue: info: copying `/tmp/grub.Z3DpYz/efi/boot/bootia32.efi' -> `/tmp/grub.Z3DpYz/efi/boot/boot.efi'.
grub-mkrescue: info: executing mformat -C -f 2880 -L 16 -i /tmp/grub.A7DwgC/efi.img ::.
grub-mkrescue: info: executing mcopy -s -i /tmp/grub.A7DwgC/efi.img /tmp/grub.Z3DpYz/efi ::/.
mcopy: No directory slots
grub-mkrescue: error: `mcopy` invocation failed
Another weird things is that I get this error no matter what directory grub-mkrescue receives as input (even directories without a grub.cfg file).

Now, I've tried searching every corner of the internet for info on this error, but all I could find are mailing lists from the 2000's where people report this issue while writing to floppy disks. I also tried looking through the source code of the mtools package but it wasn't particularly enlightening. Am I missing something stupid?

Any help would be greatly appreciated!

Re: Issue with grub-mkrescue: 'mcopy' invocation failed

Posted: Mon Jul 19, 2021 8:36 pm
by nullplan
My guess is that it doesn't like creating the ISO in the same directory it is using as root directory. Try putting the kernel stuff into a separate directory and creating the ISO outside of the ISO directory.