<div dir="ltr"><div>Hello,</div><div><br></div><div>I'm trying to create signed images with Systemd mkosi and need some general help understanding how to implement it.</div><div>If
this is not the correct forum for questions regarding mkosi then I
appolgize and humbly ask for directions to the correct forum :-)</div><div><br></div><div>My steps:</div><div><br></div><div>Host:<br></div><div>Ubuntu 20.04<br></div><div>mkosi 13</div><div><br></div><div>Target:</div><div>Ubuntu 22.04<br></div><div><br></div><div>1. Build image without SecureBoot.</div><div>2. Create custom PK,KEK and db.</div><div>3. convert keys and certs to EFI format (auth & esl)</div><div>4. Update UEFI Firmware</div><div>5. Sign my image with db.key and db.crt</div><div>6. active Secure boot</div><div><br></div><div>This image boots fine with Secure Boot.</div><div>Next I created another image without any SecureBoot options.</div><div>Signed bootloader with only db.key and db.crt and activated Secure Boot.</div><div><br></div><div>The image boots with Secure Boot.</div><div><br></div><div>Next I want to create a signed image:</div><div>Add to mkosi.default<br></div><div>SecureBoot=yes<br>SecureBootKey=/work/mkosi_fork/mkosi/test_keys/db.key<br>SecureBootCertificate=/work/mkosi_fork/mkosi/test_keys/db.crt</div><div><br></div><div>Output from build showing correct binaries are getting signed:<br></div><div><a href="https://pastebin.com/96YTeJSr" target="_blank">https://pastebin.com/96YTeJSr</a></div><div><br></div><div>When I boot the image with Secure Boot enabled I get this error:</div><div><br></div><div><pre><b>Error loading \xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\5.15.0-53-generic\linux: Access denied
</b></pre><b>
</b><pre><b>Failed to execute Ubuntu 22.04 LTS (/xxxxxxxxxxxxxxxx/5.15.0.53-generic/linux access denied<br></b><br><br></pre><pre><span style="font-family:arial,sans-serif">Which I don't understand.<br></span></pre><pre><span style="font-family:arial,sans-serif">I re-created a new image with the wrong key and got the expected "Wrong Key"<br></span></pre><pre><span style="font-family:arial,sans-serif">But my initial error suggests that the image is signed correctly (which I can verify that it is) but that there is something else it is trying to do.<br><br></span></pre><pre><span style="font-family:arial,sans-serif">I noticed that when I manually signed the binaries the key was added to /boot/efi/db but not when built with mkosi.<br><br></span></pre><pre><span style="font-family:arial,sans-serif">The sbsign section in __init__.py is the same as when I did it manually.<br><br><br></span></pre><pre><span style="font-family:arial,sans-serif">If anyone has any idea on how to proceed i would be very thankful.<br><br></span></pre><pre><span style="font-family:arial,sans-serif">Best Regards,<br></span></pre><pre><span style="font-family:arial,sans-serif">Willie</span></pre></div></div>