Jump to content











Photo
- - - - -

Kernel line: quotes, escape characters and internal variables


  • Please log in to reply
2 replies to this topic

#1 Lex24

Lex24
  • Members
  • 4 posts
  •  
    Canada

Posted 31 July 2021 - 08:48 AM

Is there any reason for extensive use of quotes and escape characters with kernel boot parameters in Grub4Dos, just like there is in Grub2?

 

I have created menu.lst entry to boot Clonezilla Live from the hard drive based on Grub2 code provided on Clonezilla's web page. The code contains lots of quotes and escape characters as Clonezilla's developers had apparently encountered problems in Grub2 if quote marks were not preceded by a backslash. I assume that all this \".....\" on the kernel line is not really needed in Grub4Dos because it has limited number of internal variables compared to Grub2 and it is easy to see that all kernel parameters are different than those variables (in which case there is no reason to enclose them in quote marks). Please let me know if I am missing something.

 

Also, is there any command available in Grub4Dos which would get the full list of internal variables printed? The set command won't do it (it will only show user defined variables). To my knowledge the internal variables have not changed for years and are as follows (but I might be wrong):

 

@date  @path  @random  @retval  @root  @time

 

?  ?_BOOT  ?_UUID  ?_WENV

 

 

Here is the code for booting Clonezilla Live from the hard drive, with quotes and backslashes cleaned-up. Both the original and cleaned-up version works ok.

 

Code cleanup summary:
set BOP1=... ocs_live_run=\"ocs-live-general\" ocs_live_extra_param=\"\" ocs_live_batch=\"no\" ...
set BOP1=... ocs_live_run=ocs-live-general ocs_live_extra_param= ocs_live_batch=no ...

set BOP3=ocs_repository=\"dev:///dev/sda8\"
set BOP3=ocs_repository=dev:///dev/sda8

Complete code before clean-up:

title Clonezilla\nVer: 2.7.2-39-amd64. To enter interactive mode run: ocs-sr -x
set BOP1=boot=live union=overlay username=user config components noswap edd=on nomodeset enforcing=0 noeject locales=en_US.UTF-8 keyboard-layouts=NONE ocs_live_run=\"ocs-live-general\" ocs_live_extra_param=\"\" ocs_live_batch=\"no\" vga=788 ip= net.ifnames=0 nosplash i915.blacklist=yes radeonhd.blacklist=yes nouveau.blacklist=yes vmwgfx.enable_fbdev=1 toram=live-hd,syslinux,EFI,boot,.disk,utils
set BOP2=live-media-path=/live-hd bootfrom=/dev/sda7
set BOP3=ocs_repository=\"dev:///dev/sda8\"
root (hd0,6)
kernel /live-hd/vmlinuz %BOP1% %BOP2% %BOP3%
initrd /live-hd/initrd.img

Complete code after clean-up:

title Clonezilla\nVer: 2.7.2-39-amd64. To enter interactive mode run: ocs-sr -x
set BOP1=boot=live union=overlay username=user config components noswap edd=on nomodeset enforcing=0 noeject locales=en_US.UTF-8 keyboard-layouts=NONE ocs_live_run=ocs-live-general ocs_live_extra_param= ocs_live_batch=no vga=788 ip= net.ifnames=0 nosplash i915.blacklist=yes radeonhd.blacklist=yes nouveau.blacklist=yes vmwgfx.enable_fbdev=1 toram=live-hd,syslinux,EFI,boot,.disk,utils
set BOP2=live-media-path=/live-hd bootfrom=/dev/sda7
set BOP3=ocs_repository=dev:///dev/sda8
root (hd0,6)
kernel /live-hd/vmlinuz %BOP1% %BOP2% %BOP3%
initrd /live-hd/initrd.img

To verify after boot-up that all parameters were properly passed to the kernel by the boot loader see /proc/cmdline

 

Clonezilla's documentation:

 

https://clonezilla.org/livehd.php

 

----------

Grub4Dos v0.4.6a 2020-03-04

 


Edited by Lex24, 31 July 2021 - 09:18 AM.


#2 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 31 July 2021 - 09:01 AM

https://rmprepusb.co...4dos-internals/

https://rmprepusb.co...ing-clonezilla/

https://rmprepusb.co...-usb-hard-disk/

 I don't know a way of displaying all internal variables at once

 you don't need to escape " in grub4dos



#3 Lex24

Lex24
  • Members
  • 4 posts
  •  
    Canada

Posted 01 August 2021 - 02:43 AM

Thanks. What is the limit of the number of characters for kernel boot parameters (as shown in Linux in /proc/cmdline) in Grub4Dos v0.4.6a 2020-03-04 or newer?
 
This is normally not an issue with a regular Linux distribution based on Arch or Ubuntu, but a specialized distro like Clonezilla (and based on Debian) is another story. As far as I know Grub1 had 256 character limit and with Grub2 it is up to 4096 characters (depending on all kinds of things). In the examples shown in the first post kernel parameters have over 300 characters.

Edited by Lex24, 01 August 2021 - 02:44 AM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users