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 15 (SLES 15)
SUSE Linux Enterprise Server 12 Service Pack 3 (SLES 12 SP3)
SUSE Linux Enterprise Server 12 Service Pack 2 (SLES 12 SP2)
AutoYast


Situation

Created an AutoYaST control file as follows: In yast open the Autoinstallation Configuration, select system then bootloader, edit, and select the option to Protect Boot Loader with Password, and set the password, add all of the other settings, and save it. Use the saved AutoYaST control file to install a system. No password is set in /boot/grub2/grub.cfg.

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

1. Run yast bootloader > Bootloader Options > Protect Bootloader with Password > Finish and quit yast to generate the /etc/grub.d/42_password file on a working server.
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

The autoyast control file does not incorporate the bootloader password file automatically.

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

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback@suse.com

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

Join Our Community

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.


SUSE Customer Support Quick Reference Guide SUSE Technical Support Handbook Update Advisories
Support FAQ

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.

Go to Customer Center