Autoyast Fails to Set GRUB2 Bootloader Password
This document (7023468) is provided subject to the disclaimer at the end of this document.
Environment
SUSE Linux Enterprise Server 12 Service Pack 3 (SLES 12 SP3)
SUSE Linux Enterprise Server 12 Service Pack 2 (SLES 12 SP2)
AutoYast
Situation
Use the autoyast generated profile generates the error: Details: key not found: "partitions"
After the server is installed, you can manually run yast bootloader > Bootloader Options > Protect Bootloader with Password and correctly set the password. However AutoYaST does not set the password.
Resolution
2. Add the /etc/grub.d/42_password file to your autoyast control file under the <files> tag.
3. Include an init script to rebuild the /boot/grub2/grub.cfg file with the /etc/grub.d/42_password and rd.shell=0 settings.
4. By default a password is needed only if you want to edit the grub menu configuration at boot because set unrestricted_menu="y". If you want to force a password prompt on each menu entry every time you boot the server, change from set unrestricted_menu="y" to set unrestricted_menu="n" in /etc/grub.d/42_password.
The follow is an example of the steps above applied to an autoyast control file.
<files config:type="list">
<file>
<file_owner>root</file_owner>
<file_path>/etc/grub.d/42_password</file_path>
<file_permissions>755</file_permissions>
<file_contents><![CDATA[ #! /bin/sh
exec tail -n +3 $0
# File created by YaST and next YaST run probably overwrite it
set superusers="root"
password_pbkdf2 root
grub.pbkdf2.sha512.10000.<some_hash_entry_generated_by_yast>
export superusers
set unrestricted_menu="y"
export unrestricted_menu
]]></file_contents>
</file>
</files>
<scripts>
<init-scripts config:type="list">
<script>
<filename>postinstall_procedures.sh</filename>
<interpreter>shell</interpreter>
<source><![CDATA[#!/bin/bash
sed -i -e 's/showopts/rd.shell=0 showopts/g' /etc/default/grub
grub2-mkconfig -o /boot/grub2/grub.cfg
]]>
</source>
</script>
</init-scripts>
</scripts>
Cause
Disclaimer
This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.
- Document ID:7023468
- Creation Date: 23-Oct-2018
- Modified Date:03-Mar-2020
-
- SUSE Linux Enterprise Server
For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com