Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move from bootctl to mokutil when checking for Secure Boot status #3486

Merged
merged 4 commits into from
Sep 15, 2024

Conversation

DavidZagury
Copy link
Contributor

What I did

Moved to use mokutil instead of bootctl as bootctl is no longer available in Bookworm.
This affected reboot scripts, and upgrade scenario.

How I did it

Change calls to bootctl status with mokutil --sb-state

How to verify it

After fixing the scripts to check reboot:

root@sn5600:/home/admin# soft-reboot

SECURE_UPGRADE_ENABLED=1
[[ CHECK_SECURE_UPGRADE_ENABLED -ne 0 ]]
load_kernel_secure
invoke_kexec -s
packet_write_wait: port 22: Broken pipe
admin@sn5600:~$ show reboot-cause
User issued 'soft-reboot' command [User: admin, Time: Tue Jul 23 11:06:43 PM UTC 2024]

Previous command output (if the output of a command-line utility has changed)

New command output (if the output of a command-line utility has changed)

@@ -93,7 +93,7 @@ function clear_lingering_reboot_config()
if [[ -f ${WARM_DIR}/${REDIS_FILE} ]]; then
mv -f ${WARM_DIR}/${REDIS_FILE} ${WARM_DIR}/${REDIS_FILE}.${TIMESTAMP} || /bin/true
fi
/sbin/kexec -u || /bin/true
/sbin/kexec -u -a || /bin/true

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this change required?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have the same question. If this is valid and general bug fix, we need to evaluate the backport needs. Could you separate it into a standalone PR?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kexec -u on systems with SB enabled is failing. Already fixed for WR here: #3439.

Since we are updating soft-reboot to work on Secure boot systems. i've also added this change

@qiluo-msft
Copy link
Contributor

Could you link this PR to HLD PR?

function load_kernel() {
# Load kernel into the memory
/sbin/kexec -l "$KERNEL_IMAGE" --initrd="$INITRD" --append="$BOOT_OPTIONS"
invoke_kexec -a
Copy link
Contributor

@qiluo-msft qiluo-msft Aug 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-a

why changing? If this is valid and general bug fix, we need to evaluate the backport needs. Could you separate it into a standalone PR? #Closed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to above comment.

Copy link
Contributor

@ycoheNvidia ycoheNvidia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine to me

@liat-grozovik
Copy link
Collaborator

@qiluo-msft can you please review comment feedback?

@qiluo-msft qiluo-msft merged commit c663755 into sonic-net:master Sep 15, 2024
7 checks passed
mssonicbld pushed a commit to mssonicbld/sonic-utilities that referenced this pull request Sep 17, 2024
…nic-net#3486)

#### What I did
Moved to use mokutil instead of bootctl as bootctl is no longer available in Bookworm.
This affected reboot scripts, and upgrade scenario.

#### How I did it
Change calls to _bootctl status_ with _mokutil --sb-state_

#### How to verify it
After fixing the scripts to check reboot:

root@sn5600:/home/admin# soft-reboot

SECURE_UPGRADE_ENABLED=1
[[ CHECK_SECURE_UPGRADE_ENABLED -ne 0 ]]
load_kernel_secure
invoke_kexec -s
packet_write_wait: port 22: Broken pipe
admin@sn5600:~$ show reboot-cause
User issued 'soft-reboot' command [User: admin, Time: Tue Jul 23 11:06:43 PM UTC 2024]
@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202405: #3545

mssonicbld pushed a commit that referenced this pull request Sep 17, 2024
)

#### What I did
Moved to use mokutil instead of bootctl as bootctl is no longer available in Bookworm.
This affected reboot scripts, and upgrade scenario.

#### How I did it
Change calls to _bootctl status_ with _mokutil --sb-state_

#### How to verify it
After fixing the scripts to check reboot:

root@sn5600:/home/admin# soft-reboot

SECURE_UPGRADE_ENABLED=1
[[ CHECK_SECURE_UPGRADE_ENABLED -ne 0 ]]
load_kernel_secure
invoke_kexec -s
packet_write_wait: port 22: Broken pipe
admin@sn5600:~$ show reboot-cause
User issued 'soft-reboot' command [User: admin, Time: Tue Jul 23 11:06:43 PM UTC 2024]
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants