セキュアブートが有効なUbuntu/PartedMagicを使用したgrubメニューの編集

セキュアブートが有効なUbuntu/PartedMagicを使用したgrubメニューの編集

Windows 10がプリインストールされており、セキュアブートが可能で、EFIモードが有効なノートブックDELL Latitude 5491があります。購入後、WindowsでデュアルブートとしてUbuntu 20.04をインストールし、まだセキュアブート/ EFIが有効になっていました。パーティション2、3、5はWindowsシステム用、パーティション1と4はUbuntuシステム用です。パーティション 6 は、バックアップの目的で Clonezilla Live CD の ISO を保存します。今まではそんなに良くなった。次の手順では、Parted Magic Live CDを解凍したISOをパーティション7に保存してgrubメニューを編集しましたが、grubメニューからParted Magicを実行するとエラーが発生し、BzImage署名は無効です... EFI(一時起動メニューまたはEFI設定)では、システムは正常に起動します。何が間違っている可能性がありますか?それは次のとおりです

パーティションレイアウト:

Device         Start        End   Sectors   Size Type
/dev/sda1       2048    1394687   1392640   680M EFI System
/dev/sda2    1394688    1656831    262144   128M Microsoft reserved
/dev/sda3    1656832  507570175 505913344 241,2G Microsoft basic data
/dev/sda4  507570176  983883775 476313600 227,1G Linux filesystem
/dev/sda5  983883776  985911295   2027520   990M Windows recovery environment
/dev/sda6  985911296  987500543   1589248   776M Linux filesystem
/dev/sda7  987500544 1000214527  12713984   6,1G Microsoft basic data

40_customファイルを編集します。

#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.

menuentry "clonezilla" {
    set isofile="/clonezilla-live-20210127-groovy-amd64.iso"
    loopback loop (hd0,gpt6)$isofile
    linuxefi (loop)/live/vmlinuz boot=live components config findiso=$isofile ip=frommedia toram=filesystem.squashfs union=overlay username=user
    initrdefi (loop)/live/initrd.img
}
menuentry "partedmagic" {
 insmod chain
 set root=(hd0,gpt7)
 configfile /boot/grub/grub.cfg
}

grub.cfgファイル:

set default="0"
set timeout="20"
set hidden_timeout_quiet=false
set gfxmode=auto
insmod efi_gop
insmod efi_uga
insmod gfxterm
terminal_output gfxterm
set color_normal=white/black
set color_highlight=black/white
loadfont /boot/grub/unicode.pf2
background_image /boot/grub/pmagic.png

set default_settings="edd=on vga=normal mem=32G"
set live_settings="boot=live eject=no"
set linux="/pmagic/bzImage"
set initrd_img="/pmagic/initrd.img /pmagic/fu.img /pmagic/m.img"
set default=2
set message="Loading kernel and initramfs. Please wait..."

menuentry "Parted Magic UEFI Boot Menu"{
    set
}
menuentry ' '{
    set
}
menuentry "1. Default settings (Runs from RAM 4GB+)"{
    echo $message
    search --set -f $linux
    linux $linux $default_settings
    initrd $initrd_img
}
menuentry "1a. Default settings with 4K Monitor"{
    echo $message
    search --set -f $linux
    linux $linux $default_settings m4k=yes
    initrd $initrd_img
}
menuentry "1b. Default settings + language menu"{
    echo $message
    search --set -f $linux
    linux $linux $default_settings lang=yes
    initrd $initrd_img
}
menuentry ' '{
     true
}
menuentry "2. Live with default settings (2GB+ RAM)"{
    echo $message
    search --set -f $linux
    linux $linux $default_settings $live_settings
    initrd $initrd_img
}
menuentry "2a. Live with default settings + language menu"{
    echo $message
    search --set -f $linux
    linux $linux $default_settings $live_settings lang=yes
    initrd $initrd_img
}
menuentry ' '{
     true
}
menuentry "3. Black/Blank Screen workaround"{
    echo $message
    search --set -f $linux
    linux $linux $default_settings nomodeset
    initrd $initrd_img
}
menuentry "4. No official NVIDIA driver - Use Nouveau NVIDIA driver instead."{
        echo $message
        search --set -f $linux
        linux $linux $default_settings modprobe="nouveau"
        initrd $initrd_img
}
menuentry "5. *** Hyper-V ***"{
    echo $message
    search --set -f $linux
    linux $linux $default_settings fbdev=yes
    initrd $initrd_img
}
menuentry "6. Memtest86+" {
    chainloader /boot/memtest/BOOTX64.EFI
}
menuentry "7. EFI Shell" {
    insmod fat
    insmod chain
    terminal_output console
    chainloader /boot/edk2/Shell.efi
}
menuentry ' '{
     true
}
submenu "Extras Menu"{
    set default_settings="edd=on vga=normal mem=32G"
    set live_settings="boot=live eject=no"
    set linux="/pmagic/bzImage"
    set initrd_img="/pmagic/initrd.img /pmagic/fu.img /pmagic/m.img"
    set message="Loading kernel and initramfs. Please wait..."
    menuentry "1. Super Grub2 Disk EFI" {
        chainloader /boot/supergrub2disk/super_grub2_disk_standalone_x86_64_efi_2.04s1.EFI
    }   
    menuentry "2. Clonezilla"{
        echo $message
        search --set -f $linux
        linux $linux $default_settings clonezilla=yes
        initrd $initrd_img
    }
    menuentry "3. Nwipe"{
        echo $message
        search --set -f $linux
        linux $linux $default_settings nwipe=yes
        initrd $initrd_img
    }
    menuentry "4. Load iSCSI Kernel Modules"{
        echo $message
        search --set -f $linux
        linux $linux $default_settings iscsi=yes
        initrd $initrd_img
    }
    menuentry "5. Load config for xf86-video-qxl module"{
        echo $message
        search --set -f $linux
        linux $linux $default_settings qxl=yes
        initrd $initrd_img
    }
}
}
submenu "Failsafe Menu"{
    set default_settings="edd=on vga=normal mem=32G"
    set live_settings="boot=live eject=no"
    set linux="/pmagic/bzImage"
    set initrd_img="/pmagic/initrd.img /pmagic/fu.img /pmagic/m.img"
    set message="Loading kernel and initramfs. Please wait..."
    menuentry "1. No ACPI (Advanced Configuration and Power Interface)"{
        echo $message
        search --set -f $linux
        linux $linux $default_settings acpi=off
        initrd $initrd_img
    }
    menuentry "2. Do not eject CD"{
        echo $message
        search --set -f $linux
        linux $linux $default_settings eject=no
        initrd $initrd_img
    }
    menuentry "3. Emulator compatibility"{
        echo $message
        search --set -f $linux
        linux $linux $default_settings $live_settings noreplace-paravirt
        initrd $initrd_img
    }
    menuentry "4. Console (boots to the shell)"{
        echo $message
        search --set -f $linux
        linux $linux $default_settings consoleboot=yes
        initrd $initrd_img
    }
    menuentry "5. Initrd.img (boot to initrd.img shell)"{
        echo $message
        search --set -f $linux
        linux $linux $default_settings initrd_shell=yes
        initrd $initrd_img
    }
    menuentry "6. Radeon no modeset"{
        echo $message
        search --set -f $linux
        linux $linux $default_settings blacklist=radeon
        initrd $initrd_img
    }
    menuentry "7. No / force CPU Frequency Scaling"{
        echo $message
        search --set -f $linux
        linux $linux $default_settings cpufreq=no
        initrd $initrd_img
    }
    menuentry "8. Force vesa workaround"{
        echo $message
        search --set -f $linux
        linux $linux $default_settings xconfig=forcevesa
        initrd $initrd_img
    }
    menuentry "9. Force refresh rate"{
        echo $message
        search --set -f $linux
        linux $linux $default_settings xconfig=forcerefresh nomodeset
        initrd $initrd_img
    }
    menuentry "10. Disable accelerated 3D graphics (DRI)"{
        echo $message
        search --set -f $linux
        linux $linux $default_settings nodri=yes
        initrd $initrd_img
    }
    menuentry "11. Missing Mouse Pointer"{
        echo $message
        search --set -f $linux
        linux $linux $default_settings xmouse=yes
        initrd $initrd_img
    }
    menuentry "12. Macbook Pro 8,x Dual Graphics Workaround"{
        echo $message
        search --set -f $linux
        linux $linux $default_settings
        outb 0x728 1 # Switch select
        outb 0x710 2 # Switch display
        outb 0x740 2 # Switch DDC
        outb 0x750 0 # Power down discrete graphics
        initrd $initrd_img
    }
    menuentry "13. Libata noncq - Drive will not unlock"{
        echo $message
        search --set -f $linux
        linux $linux $default_settings libata.force=1.0:noncq
        initrd $initrd_img
    }
    menuentry "14. No IPV6 - Stop Network Manager from disconnecting."{
        echo $message
        search --set -f $linux
        linux $linux $default_settings blacklist=ipv6
        initrd $initrd_img
    }
}
menuentry ' '{
     true
}
submenu "List of Cheat Codes"{
menuentry "directory=        Directory containing the pmagic folder"{set}
menuentry "iso_filename=     [path to/]iso filename"{set}
menuentry "root=             SQFS boot device by partition id"{set}
menuentry "label=            SQFS boot device by label"{set}
menuentry "uuid=             SQFS boot device by [partial] uuid"{set}
menuentry "blacklist=        Do not load kernel modules, e.g. blacklist=kmod1:kmod2:kmod3"{set}
menuentry "ahci=no           Do not load the ahci kernel module"{set}
menuentry "modprobe=         Load kernel modules, e.g. modprobe=kmod4:kmod5:kmod6"{set}
menuentry "consoleboot=yes   Do not start X-windows"{set}
menuentry "eject=no          Do not eject CD"{set}
menuentry "gpm=no            Disable the console mouse server"{set}
menuentry "pmodules=no       Do not install pmagic/pmodules"{set}
menuentry "slapt=no          Do not install /home/partedmagic/slapt-get/ packages"{set}
menuentry "scripts=no        Do not execute pmagic/pmodules/scripts"{set}
menuentry "sound=no          Do not let ALSA set volume levels (mute)"{set}
menuentry "numlock=on        Set numlock to on at boot"{set}
menuentry "conky=no          Do not auto-start conky"{set}
menuentry "zfs=no            Do not start zfs services"{set}
menuentry "hostname=         Set hostname to XXXXXX[.YYYYYY.ZZZ]"{set}
menuentry "timeconfig=<timezone>|no  Set timezone | do not start timeconfig at boot"{set}
menuentry "clockfmt=<format> clockfmt=%R (24-hours), clockfmt=%l:%M%P (am/pm)"{set}
menuentry "mdadm=no          Do not assemble raid filesystems"{set}
menuentry "lvm=no            Do not start the device mapper"{set}
menuentry "sshd=no           Do not start SSH daemon"{set}
menuentry "bluetooth=no      Do not start the bluetooth daemon"{set}
menuentry "consolekit=no     Do not start the consolekit daemon"{set}
menuentry "dmeventd=no       Do not start the device mapper event daemon"{set}
menuentry "dbus=no           Do not start the Dbus daemon"{set}
menuentry "smart=no          Do not start the smartmontools daemon"{set}
menuentry "fstabdaemon=no    Do not start the Parted Magic /etc/fstab daemon"{set}
menuentry "nfs=no            Do not start the NFS daemon"{set}
menuentry "acpid=no          Do not start the acpi daemon"{set}
menuentry "cups=no           Do not start the CUPS server"{set}
menuentry "netw=no           Do not start the network at boot"{set}
menuentry "samba=yes         Start the samba daemons"{set}
menuentry "rdate=yes         Sync time with rdate at boot"{set}
menuentry "monday=1          Monday as first day of the week"{set}
menuentry "ntpd=yes          Start the ntpd daemon"{set}
menuentry "cpufreq=no/yes/<gov>  No (laptop), force (desktop) CPU freq scaling governor"{set}
menuentry "powermanager=no/yes   No (laptop), force (desktop) power manager"{set}
menuentry "iscsi=yes         Start iscsi initiator"{set}
menuentry "xconfig=XXXXXX|no Use /etc/X11/xorg.conf.XXXXXX | Undo"{set}
menuentry "nodri=yes         No DRI"{set}
menuentry "qxl=yes           X to start with QXL device"{set}
menuentry "xmouse=yes        Try this if your X does not show a mouse cursor"{set}
menuentry "clonezilla=yes    Boot into clonezilla"{set}
menuentry "nwipe=yes         Boot into nwipe"{set}
menuentry "cmd=              Boot into <command>, e.g. cmd="nwipe --method dod""{set}
menuentry "device_list=yes   Show devices/partitions being scanned for the SQFS"{set}
menuentry "removableonly=yes Only scan devices/partitions with "removable" attribute"{set}
menuentry "testing=yes       Wait at boot completion, use <Shift+Page Up|Down> to scroll"{set}
menuentry "                  Press <Enter> to continue"{set}
menuentry ""{set}
menuentry "Keyboard maps:"{set}
menuentry "azerty be-latin1 fr-latin1 fr-latin9 fr-pc fr wangbe wangbe2 ANSI-dvorak"{set}
menuentry "dvorak-l dvorak-r dvorak tr_f-latin5 trf bg-cp1251 bg-cp855 bg_bds-cp1251"{set}
menuentry "bg_bds-utf8 bg_pho-cp1251 bg_pho-utf8 br-abnt br-abnt2 br-latin1-abnt2"{set}
menuentry "br-latin1-us by cf cz-cp1250 cz-lat2-prog cz-lat2 cz defkeymap"{set}
menuentry "defkeymap_V1.0 dk-latin1 dk emacs emacs2 es-cp850 es et-nodeadkeys et"{set}
menuentry "fi-latin1 fi-latin9 fi gr-pc gr hu101 hypermap.m4 il-heb il-phonetic il"{set}
menuentry "is-latin1-us is-latin1 it-ibm it it2 jp106 la-latin1 lt.baltic lt.l4 lt"{set}
menuentry "mk-cp1251 mk-utf mk mk0 nl nl2 no-latin1.doc no-latin1 no pc110 pl pl2"{set}
menuentry "pt-latin1 pt-latin9 ro_win ru-cp1251 ru-ms ru-yawerty ru ru1 ru2 ru3 ru4"{set}
menuentry "ru_win se-fi-ir209 se-fi-lat6 se-ir209 se-lat6 sk-prog-qwerty sk-qwerty"{set}
menuentry "speakup-jfw speakup-jfw.readme speakupmap sr-cy sv-latin1 tr_q-latin5 tralt"{set}
menuentry "trq ua-utf-ws ua-utf ua-ws ua uk us-acentos us croat cz-us-qwertz"{set}
menuentry "de-latin1-nodeadkeys de-latin1 de de_CH-latin1 fr_CH-latin1 fr_CH hu"{set}
menuentry "sg-latin1-lk450 sg-latin1 sg sk-prog-qwertz sk-qwertz slovene"{set}
menuentry "Example:"{set}
menuentry "At the boot menu press <TAB> and then change 'keymap=us' to 'keymap=fr-latin1'"{set}
menuentry ""{set}
menuentry "VGA modes:"{set}
menuentry "Normal VGA console: vga=normal"{set}
menuentry "VESA framebuffer console @ 1024x768x64k: vga=791"{set}
menuentry "VESA framebuffer console @ 1024x768x32k: vga=790"{set}
menuentry "VESA framebuffer console @ 1024x768x256: vga=773"{set}
menuentry "VESA framebuffer console @ 800x600x64k:  vga=788"{set}
menuentry "VESA framebuffer console @ 800x600x32k:  vga=787"{set}
menuentry "VESA framebuffer console @ 800x600x256:  vga=771"{set}
menuentry "VESA framebuffer console @ 640x480x64k:  vga=785"{set}
menuentry "VESA framebuffer console @ 640x480x32k:  vga=784"{set}
menuentry "VESA framebuffer console @ 640x480x256:  vga=769"{set}
}

ただし、EFI設定では、パーティション7の「ブートローダー」パスは次のようになります。

\EFI\boot\bootx64.efi

grub.cfgファイルを使用するのではなく、このパスを使用して40_customファイルを編集するとエラーが発生します。

回答ありがとうございます。血。

編集する:

オプション1: custom_40ファイルの後続の編集を使用しました。

menuentry "partedmagic" {
 insmod chain
 set root=(hd0,gpt7)
 configfile /boot/EFI/bootx64.efi
}

このファイルを編集しようとするときは、次の操作を行います。

menuentry "partedmagic" {
insmod chain
set root=(hd0,gpt7)
chainloader /boot/EFI/bootx64.efi
}

エラーメッセージが表示されます。

ブートローダがロードされたイメージを確認していません...システムが破損しています。停止します。

オプション2: Parted MagicのbzImage終了プロセスは正常に完了しましたが、実行しようとするとエラーが発生します。

...署名が無効です。まずカーネルをロードする必要があります。

ベストアンサー1

ClonezillaのカーネルはUbuntuから提供されているため、Canonical(Ubuntuディストリビューションを維持する会社)のSecure Boot秘密鍵を使用して署名されます。

ブートプロセスにshimx64.efiUbuntuからのブートが含まれている場合、Canonicalの証明書はファームウェアのセーフブートホワイトリストに(非永久的に)追加され、UbuntuとClonezillaをブートできます。

一部のハードウェアベンダーはファームウェアホワイトリストにCanonicalのセキュアブート証明書を含めることができるため、これらのベンダーのシステムはUbuntuまたはClonezillaを起動するときにshimを省略することがあります。

明らかに、Parted Magic Live CDには、shimx64.efi別の安全ブート証明書を含む独自のバージョンが含まれています。このバージョンのシムが起動プロセスに含まれている場合は、セキュアブートが有効になっている間にParted Magicを起動できます。

私が知る限り、あなたの選択は次のとおりです。

オプション1

configfileGRUB命令を使用して、UbuntuのGRUBを介してParted Magicの設定を読み込むのではなく、Parted Magicメディアでshimを試すことができます。chainload

menuentry "partedmagic" {
    insmod chain
    set root=(hd0,gpt7)
    chainloader /EFI/boot/bootx64.efi
}

似たようなことを試してみたようですが、もし試してみましたか?正確にこのように?

オプション2

MOK(マシン所有者キー)でUbuntuのshimを設定してサードパーティのカーネルモジュールまたはカスタムカーネルを有効にする場合は、MOK秘密キーでParted Magicのカーネルに再署名してUbuntuのGRUBから起動できるようにします。

MOKがデフォルトの場所にあると仮定すると、次のことができます。

openssl x509 -in /var/lib/shim-signed/mok/MOK.der -inform DER -out /var/lib/shim-signed/mok/MOK.pem
mv <mountpoint of sda7>/pmagic/bzImage <mountpoint of sda7>/pmagic/bzImage.orig

もしそうなら

sbsign --key /var/lib/shim-signed/mok/MOK.priv --cert /var/lib/shim-signed/mok/MOK.pem \
    --output <mountpoint of sda7>/pmagic/bzImage \
    <mountpoint of sda7>/pmagic/bzImage.orig

または

osslsigncode -certs /var/lib/shim-signed/mok/MOK.pem -key /var/lib/shim-signed/mok/MOK.priv \-in 
    -h sha256 <mountpoint of sda7>/pmagic/bzImage.orig \
    -out <mountpoint of sda7>/pmagic/bzImage

使用できる PE/COFF バイナリ署名ツールによって異なります。

オプション3

システムファームウェアでセキュアブートキーホワイトリスト(db)を操作できる場合は、Canonic and Parted Magicのセキュアブート証明書をファームウェアホワイトリストに直接追加できます。

既存の署名付きバイナリからセキュアブート証明書を抽出するには、次の手順を実行します*.efi

osslsigncode extract-signature -pem somefile.efi certificate.pkcs7
openssl pkcs7 -inform pem -print_certs -text -in certificate.pkcs7 >certificate.pem

ファームウェアホワイトリストに証明書を追加するには、keytool.efi必要な機能が含まれているか、BIOSセットアップメニューを使用できます。記憶が正しい場合は、keytool.efiPEM形式の証明書が許可されますが、ファームウェアは証明書をDER形式に変換するか、署名または署名されていない形式(通常はそれぞれ*.esl)のEFI署名リストファイルに変換する必要があります*.auth

オプション0

...またはシステムファームウェアでセキュアブートを無効にできる場合は、そうすることもできます。

セキュアブートマスターキー(PK)をクリアすると、セキュアブートがセットアップモードになり、すべてのオペレーティングシステムが起動する可能性があるため、デフォルトではセキュアブートを無効にするのと同じです。

おすすめ記事