How to create a iso file by grub-mkrescue and assign its label?

1.3k Views Asked by At

I'm trying to create a iso bootable file by grub-mkrescue. But I require to assign the iso's label. After read the man page, I guess here is a correct command line, but failed.

grub-mkrescue -o "my_arch.iso" -- -volid=MY_ARCH my_iso_dir

It will show error as:

xorriso 1.4.2 : RockRidge filesystem manipulator, libburnia project.

Drive current: -outdev 'stdio:my_arch.iso'
Media current: stdio file, overwriteable
Media status : is blank
Media summary: 0 sessions, 0 data blocks, 0 data, 19.1g free
Added to ISO image: directory '/'='/tmp/grub.ZoYEzy'
xorriso : UPDATE : 613 files added in 1 seconds
xorriso : FAILURE : -as mkisofs: Unrecognized option '-volid=MY_ARCH'
xorriso : UPDATE : 613 files added in 1 seconds
xorriso : aborting : -abort_on 'FAILURE' encountered 'FAILURE'

According the 'info grub-mkrescue' document:

  All arguments not explicitly listed as 'grub-mkrescue' options are
passed on directly to 'xorriso' in 'mkisofs' emulation mode.  Options
passed to 'xorriso' will normally be interpreted as 'mkisofs' options;
if the option '--' is used, then anything after that will be interpreted
as native 'xorriso' options.

   Non-option arguments specify additional source directories.  This is
commonly used to add extra files to the image:
1

There are 1 best solutions below

2
On

The -as mkisofs emulation of xorriso understands

-V MY_ARCH

or

-volid MY_ARCH

but not

-volid=MY_ARCH

Further be aware that you obviously use the intermediate C version of grub-mkrescue which does not comply to the documentation you quoted. This version demands '--' as delimiter between grub-mkrescue options and xorriso -as mkisofs options.

But if you have '--' among the arguments of old grub-mkrescue shell script or of current grub-mkrescue C program, then you will drop out of mkisofs emulation. This will earn you an error message

xorriso : FAILURE : Not a known command:  'my_iso_dir'