using label in grub2

318 views
Skip to first unread message

NK

unread,
Apr 26, 2022, 6:49:20 AM4/26/22
to kiwi

Hello,

I have issue with grub2 label setting , I want to  configure grub lable(not UUID) , I made following changes in config.xml but image generated with device name(not using lable)

-----config.xml---------------
<type image="vmx" filesystem="ext4" format="qcow2" kernelcmdline='root=LABEL=ROOT console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.driver.blacklist=nouveau nouveau.modeset=0' bootloader="grub2" devicepersistency='by-label'>
----------------------
But when I check the vm created from the image it doesnot show by lable.. (it use device name) 
------------
 #cat /proc/cmdline
BOOT_IMAGE=(hd0,msdos1)/boot/vmlinuz-4.18.0-348.20.1.el8_5.x86_64 root=/dev/vda1 ro
------------------
Tried with  kiwi version 9.23.23, 9.23.29 and 9.23.30

OS - Oracle Linux 8 


Thanks in Advance,
\
NK

Robert Schweikert

unread,
Apr 26, 2022, 7:04:32 AM4/26/22
to kiwi-...@googlegroups.com


On 4/26/22 06:49, NK wrote:
>
> Hello,
>
> I have issue with grub2 label setting , I want to configure grub lable(not
> UUID) , I made following changes in config.xml but image generated with
> device name(not using lable)
>
> -----config.xml---------------
> <type image="vmx" filesystem="ext4" format="qcow2"
> kernelcmdline='root=LABEL=ROOT console=ttyS0,115200n8 console=tty0
> net.ifnames=0 rd.driver.blacklist=nouveau nouveau.modeset=0'
> bootloader="grub2" devicepersistency='by-label'>


drop "root=LABEL=ROOT", kiwi generates this when
'devicepersistency="by-label"' is set

> ----------------------
> But when I check the vm created from the image it doesnot show by lable..
> (it use device name)
> ------------
> #cat /proc/cmdline
> BOOT_IMAGE=(hd0,msdos1)/boot/vmlinuz-4.18.0-348.20.1.el8_5.x86_64
> root=/dev/vda1 ro
> ------------------
> Tried with kiwi version 9.23.23, 9.23.29 and 9.23.30
>
> OS - Oracle Linux 8
>
>
> Thanks in Advance,
> \
> NK
>

--
Robert Schweikert MAY THE SOURCE BE WITH YOU
Distinguished Engineer LINUX
Technical Team Lead Public Cloud
rjsc...@suse.com
IRC: robjo
OpenPGP_signature

Nikunj

unread,
Apr 26, 2022, 7:38:32 AM4/26/22
to kiwi-...@googlegroups.com
Hi,

Thanks for quick response,

Still no luck 
I dropped ROOT Label as below

<type image="vmx" filesystem="ext4" format="qcow2" kernelcmdline='console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.driver.blacklist=nouveau nouveau.modeset=0' bootloader="grub2" devicepersistency='by-label'>

after making changes new image has same device name 


image.png

--
You received this message because you are subscribed to a topic in the Google Groups "kiwi" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kiwi-images/gFoSZlEJksQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kiwi-images...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kiwi-images/4308a7ee-53e9-68eb-1ae1-474a6ed63e8f%40suse.com.


--
With Regards,

Nikunj Khakhar


Marcus Schäfer

unread,
Apr 26, 2022, 2:24:17 PM4/26/22
to kiwi-...@googlegroups.com
Hi,

> Still no luck
> I dropped ROOT Label as below
> <type image="vmx" filesystem="ext4" format="qcow2"
> kernelcmdline='console=ttyS0,115200n8 console=tty0 net.ifnames=0
> rd.driver.blacklist=nouveau nouveau.modeset=0' bootloader="grub2"
> devicepersistency='by-label'>
> after making changes new image has same device name
> image.png

According to your picture the kernel cmdline has

root=/dev/vda1

kiwi does not create a root= reference of a specific device name
unless it is told to do it via kernelcmdline. I wonder where this
should come from.

Are you sure there is nothing in your image description which
explicitly sets a root device ?

If you can share your complete image description (not only the XML file)
we can take a look as well.

Thanks

Regards,
Marcus
--
Public Key available via: https://keybase.io/marcus_schaefer/key.asc
keybase search marcus_schaefer
-------------------------------------------------------
Marcus Schäfer Brunnenweg 18
Tel: +49 7562 905437 D-88260 Argenbühl
Germany
-------------------------------------------------------
signature.asc

NK

unread,
Apr 26, 2022, 2:31:24 PM4/26/22
to kiwi
Hi,

No there is nothing in image description file for root device

config xml snapshot is as below, let me know if you need any other part from config.xml file

------------------------------------------------------------------------

<?xml version="1.0" encoding="utf-8"?>

  <image schemaversion="6.9" name="OL_8" displayname="Oracle_8">
      <description type="system">
        <specification>OracleLinux_8</specification>
  </description>
        <preferences>
          <version>1.0.0</version>
          <packagemanager>dnf</packagemanager>
          <bootsplash-theme>charge</bootsplash-theme>
          <locale>en_US</locale>
          <keytable>us</keytable>
          <timezone>UTC</timezone>
          <rpm-check-signatures>false</rpm-check-signatures>
       <type image="vmx" filesystem="ext4" format="qcow2" kernelcmdline="console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.driver.blacklist=nouveau nouveau.modeset=0" devicepersistency="by-label">
        <bootloader name="grub2" timeout="1"/>
           <size unit="G">6</size>
          </type>
  </preferences>

----------------------------------------------------------------

Robert Schweikert

unread,
Apr 26, 2022, 3:26:26 PM4/26/22
to kiwi-...@googlegroups.com
Hi,
What's the grub version in OL 8, it could be that the settings that kiwi
generates, i.e.

GRUB_ENABLE_LINUX_LABEL=true
GRUB_DISABLE_LINUX_UUID=true

in /etc/default/grub get ignored. Could also be that there are scripts
in OL 8 that force the setting of the device as root. These scripts
would most likely be in

/etc/dracut.conf.d/

What are the settings in /etc/default/grub?

Later,
Robert
>> Tel: +49 7562 905437 <+49%207562%20905437> D-88260 Argenbühl
>> Germany
>> -------------------------------------------------------
OpenPGP_signature

Marcus Schäfer

unread,
Apr 26, 2022, 3:34:52 PM4/26/22
to kiwi-...@googlegroups.com
Hi,

> No there is nothing in image description file for root device

I did a quick build of an image using by-label persistency and you
should see something like the following in your build log:

INFO: 19:27:27 | Writing grub2 defaults file
INFO: 19:27:27 | --> GRUB_CMDLINE_LINUX:"root=LABEL=ROOT"
INFO: 19:27:27 | --> GRUB_DISABLE_LINUX_UUID:true
INFO: 19:27:27 | --> GRUB_ENABLE_LINUX_LABEL:true
INFO: 19:27:27 | Writing sysconfig bootloader file
INFO: 19:27:27 | --> DEFAULT_APPEND:"selinux=targeted root=LABEL=ROOT "
INFO: 19:27:27 | --> FAILSAFE_APPEND:"selinux=targeted root=LABEL=ROOT ide=nodma apm=off noresume edd=off nomodeset 3 "

If you don't see that please update kiwi from here:

http://download.opensuse.org/repositories/Virtualization:/Appliances:/Builder/

In my test label boot worked

Hope this helps
signature.asc

NK

unread,
Apr 27, 2022, 9:13:34 AM4/27/22
to kiwi

Hi,

Thanks for Solution!! 


When I tried with Kiwi 9.24.31 it worked well  but when I checked the /proc/cmdline , it has included root=LABEL=ROOT but it did not remove device name (/dev/vda1).

# cat /proc/cmdline
BOOT_IMAGE=(hd0,msdos1)/boot/vmlinuz-4.18.0-348.20.1.el8_5.x86_64 root=/dev/vda1 ro root=LABEL=ROOT console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.driver.blacklist=nouveau nouveau.modeset=0
#

But when I used version Kiwi 9.24.32 it worked well and device name disappeared .

 sudo cat /proc/cmdline
BOOT_IMAGE=(hd0,msdos1)/boot/vmlinuz-4.18.0-348.20.1.el8_5.x86_64 console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.driver.blacklist=nouveau nouveau.modeset=0 root=LABEL=ROOT

config.xml ..
   <type image="vmx" filesystem="ext4" format="qcow2" kernelcmdline="console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.driver.blacklist=nouveau nouveau.modeset=0" bootloader="grub2" devicepersistency="by-label">

logs -- 
14:54:50  [ INFO    ]: 12:54:40 | Writing grub2 defaults file
14:54:50  [ INFO    ]: 12:54:40 | --> GRUB_CMDLINE_LINUX:"root=LABEL=ROOT"
14:54:50  [ INFO    ]: 12:54:40 | --> GRUB_CMDLINE_LINUX_DEFAULT:"console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.driver.blacklist=nouveau nouveau.modeset=0"
14:54:50  [ INFO    ]: 12:54:40 | --> GRUB_DISABLE_LINUX_UUID:true
14:54:50  [ INFO    ]: 12:54:40 | --> GRUB_DISTRIBUTOR:"OTC_Oracle_8"
14:54:50  [ INFO    ]: 12:54:40 | --> GRUB_ENABLE_BLSCFG:true
14:54:50  [ INFO    ]: 12:54:40 | --> GRUB_ENABLE_LINUX_LABEL:true
14:54:50  [ INFO    ]: 12:54:40 | --> GRUB_GFXMODE:auto
14:54:50  [ INFO    ]: 12:54:40 | --> GRUB_TERMINAL:"gfxterm"
14:54:50  [ INFO    ]: 12:54:40 | --> GRUB_TIMEOUT:10
14:54:50  [ INFO    ]: 12:54:40 | --> SUSE_REMOVE_LINUX_ROOT_PARAM:true
14:54:50  [ INFO    ]: 12:54:40 | Writing sysconfig bootloader file
14:54:50  [ INFO    ]: 12:54:40 | --> DEFAULT_APPEND:"console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.driver.blacklist=nouveau nouveau.modeset=0 root=LABEL=ROOT "
14:54:50  [ INFO    ]: 12:54:40 | --> FAILSAFE_APPEND:"console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.driver.blacklist=nouveau nouveau.modeset=0 root=LABEL=ROOT  ide=nodma apm=off noresume edd=off nomodeset 3 "
14:54:50  [ INFO    ]: 12:54:40 | --> LOADER_LOCATION:mbr
14:54:50  [ INFO    ]: 12:54:40 | --> LOADER_TYPE:grub2
14:54:50  [ INFO    ]: 12:54:40 | Creating config.bootoptions
14:54:50  [ DEBUG   ]: 12:54:40 | EXEC: [blkid /dev/mapper/loop0p1 -s LABEL -o value]
Reply all
Reply to author
Forward
0 new messages