外部USBとSSD間の起動時のDebian10起動の問題

外部USBとSSD間の起動時のDebian10起動の問題

内蔵ハードドライブにDebian 10をインストールしましたが、UEFIセキュアブートで正しく実行されます。

外部USBに2番目のDebianをインストールすると、そのUSBからのみ起動します。

SSDから起動するためにラップトップからUSBを取り外すと、エラーが発生します。

bashのような最小限のライン編集。

セキュアブートを無効にしても役に立ちません。

Disk /dev/sda: 238,5 GiB, 256060514304 bytes, 500118192 sectors
Disk model
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 

Device       Start       End   Sectors   Size Type
/dev/sda1     2048   1050623   1048576   512M EFI System
/dev/sda2  1050624   1550335    499712   244M Linux filesystem
/dev/sda3  1550336 500117503 498567168 237,8G Linux filesystem


Disk /dev/sdb: 57,3 GiB, 61505273856 bytes, 120127488 sectors
Disk model: Ultra USB 3.0   
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 

Device       Start       End   Sectors  Size Type
/dev/sdb1     2048   1050623   1048576  512M EFI System
/dev/sdb2  1050624   1550335    499712  244M Linux filesystem
/dev/sdb3  1550336 120125439 118575104 56,6G Linux filesystem


Disk /dev/mapper/sdc3_crypt: 56,5 GiB, 60693676032 bytes, 118542336 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/usb--vg-root: 48,7 GiB, 52240056320 bytes, 102031360 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/usb--vg-swap_1: 7,9 GiB, 8451522560 bytes, 16506880 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

lvs出力

LV     VG        Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
root   intern-vg -wi-a----- 229,80g                                                    
swap_1 intern-vg -wi-a-----  <7,87g                                                    
root   usb-vg    -wi-ao----  48,65g                                                    
swap_1 usb-vg    -wi-ao----   7,87g 

ベストアンサー1

この記事を書いている時点で、Debian 10はまだtesting初期段階なので、少し粗い部分がある可能性があることに注意してください。

私の考えでは、Debianインストーラが2番目のインストールがリムーバブルドライブにあることを知らず、USBデバイスから起動するように構成されたバージョンで、EFIシステムパーティション(ESP)に最初にインストールされたGRUBコピーを上書きしたようです。

この問題を解決するには、次の 2 つの操作を順序に関係なく実行する必要があります。

1.)USBベースのインストールが自己起動可能であることを確認する必要があります。つまり、USBドライブにはブートローダのコピーを含むFAT32パーティションが必要です\EFI\boot\bootx64.efi。これは、UEFIの観点からリムーバブルUSBを起動可能にすることです。

2.)内蔵HDDにインストールされているブートローダを変更するには、USBベースのインストールから起動してから、内部HDDベースのインストールのパーティションをマウントし、そのインストールにchrootできます。

出力fdisk -lによると、LVMも使用している可能性があります。

出力によると、fdisk -lこれは必須コマンドの先頭でなければなりません。これらのタスクはすべてルートとして実行する必要があるため、まずsu -ルートパスワードを使用して入力するか、ルートにsudo -iなるには自分のパスワードを入力してください。

# mkdir /mnt/hddsystem

# cryptsetup luksOpen /dev/sda3 sda3_crypt
<the above command will ask you the encryption passphrase of the HDD installation.
If successful, then /dev/mapper/sda3_crypt should now exist>

# vgscan
<this detects the LVM volume group within the encrypted container of the HDD installation>

# lvs
<this displays all the detected LVM logical volumes and their names>

# vgchange -ay intern-vg
# mount /dev/mapper/intern--vg-root /mnt/hddsystem

<if successful, directories like /mnt/hddsystem/dev, /mnt/hddsystem/proc, /mnt/hddsystem/sys 
should be visible and empty at this point. Other directories should be visible under /mnt/hddsystem too.>

# mount /dev/sda2 /mnt/hddsystem/boot
# mount /dev/sda1 /mnt/hddsystem/boot/efi

この時点でUSBシステムの起動を変更することは、USBメディアを探しているGRUBのバージョンをUSBにコピーしてからHDDに上書きするのと同じくらい簡単です。

# mkdir /mnt/usb-esp
# mount /dev/sdb1 /mnt/usb-esp
# mkdir -p /mnt/usb-esp/EFI/boot
# cp -r /mnt/hddsystem/boot/efi/EFI/debian /mnt/usb-esp/EFI/
# cp /mnt/usb-esp/EFI/debian/grubx64.efi /mnt/usb-esp/EFI/boot/
# cp /mnt/hddsystem/boot/efi/EFI/debian/shimx64.efi /mnt/usb-esp/EFI/boot/bootx64.efi
# umount /mnt/usb-esp

ハードドライブの取り付け修理に戻る...

# mount -o bind /dev /mnt/hddsystem/dev
# mount -o bind /proc /mnt/hddsystem/proc
# mount -o bind /sys /mnt/hddsystem/sys
<these commands are preparations for the following chroot command, mounting all the necessary real and virtual filesystems so that the inactive HDD-based installation can be used like an active, running system.>

# chroot /mnt/hddsystem /bin/bash
<this command transitions us to the HDD-based environment; from this point onwards, for this shell session only, /mnt/hddsystem is /.>

# grub-install /dev/sda1
# update-grub 
<these two commands to fix the bootloader are what all the preparations above were for.>

おすすめ記事