<Linux, Admin> Bootable USB

ブータブル Bootable USBのメモ。

Ubuntuを手動でインストールして、Bootable USBを作る方法。

まずは、Ubuntuのisoをダウンロード。

ubuntu.com

で、ダウンロードしたisoを選択して、右クリックから、マウントする。
f:id:nekoyukimmm:20200314180018p:plain

マウント結果。
f:id:nekoyukimmm:20200316203945p:plain

で、FAT32にフォーマットされたUSBにisoの中身を全部コピー。

その後、管理者権限で、cmd.exeを立ち上げて、bootsect /nt60 <drive名>:と打つとかあるが、、
UEFIだといらん。。。
うちのThinkPadくんたちは、UEFIだった。
MRB形式とは、GPT形式とか難しいことがあるが、、
USB上に、EFI/BOOT/BOOTx64.EFIがあると、これをブートローダって認識するらしい。
で、同じディレクトリにあるgrubx64.eftを呼び出して、 で、boot/grub/grub.cfgを呼び出して、 ブートしていくらしい。

boot/grub/grub.cfgの中身。

if loadfont /boot/grub/font.pf2 ; then
    set gfxmode=auto
    insmod efi_gop
    insmod efi_uga
    insmod gfxterm
    terminal_output gfxterm
fi

set menu_color_normal=white/black
set menu_color_highlight=black/light-gray

set timeout=5
menuentry "Try Ubuntu without installing" {
    set gfxpayload=keep
    linux   /casper/vmlinuz  file=/cdrom/preseed/ubuntu.seed boot=casper quiet splash ---
    initrd  /casper/initrd
}
menuentry "Install Ubuntu" {
    set gfxpayload=keep
    linux   /casper/vmlinuz  file=/cdrom/preseed/ubuntu.seed boot=casper only-ubiquity quiet splash ---
    initrd  /casper/initrd
}
menuentry "OEM install (for manufacturers)" {
    set gfxpayload=keep
    linux   /casper/vmlinuz  file=/cdrom/preseed/ubuntu.seed boot=casper only-ubiquity quiet splash oem-config/enable=true ---
    initrd  /casper/initrd
}
menuentry "Check disc for defects" {
    set gfxpayload=keep
    linux   /casper/vmlinuz  boot=casper integrity-check quiet splash ---
    initrd  /casper/initrd
}
  • quietちゅうのは、コンソール上に出るメッセージを抑えるっぽい。
  • splashちゅうのは、絵がでるらしい。
  • singleって書くと、GUIでなくて、CUIで立ち上がる。ランレベル1に設定するらしい。
  • textって書くと、(quite/splashを削る)CUIで立ち上がる。

その他メモ。

ブートローダ起動時に設定されたカーネルオプションは/proc/cmdlineに記載。
syslinux + UEFIでやろうと思ったが、なんとも動かなかった。。。 げぶあっぷ。

UEFIでブートしているか?
Windowsの場合。
下記のように、BOOTSERVICE ACCESSと出れば、それ。

PS C:> Get-SecureBootUEFI -Name SetupMode

Name                                    Bytes                                   Attributes
----                                    -----                                   ----------
SetupMode                               {0}                                     BOOTSERVICE ACCESS...

Linuxの場合は、/sys/firmware/efiを見る。

> ls -al /sys/firmware/efi
total 0
drwxr-xr-x  4 root root    0 Dec  2 23:54 .
drwxr-xr-x  5 root root    0 Dec  2 23:54 ..
drwxr-xr-x  2 root root    0 Dec  2 23:54 efivars
-r--------  1 root root 4096 Dec  2 23:54 systab
drwxr-xr-x 27 root root    0 Dec  2 23:55 vars

参考。

syslinuxを使ってUEFIで起動するUSBメモリmzex.wordpress.com

fuutotto.hatenadiary.jp

keichi.net

blog.bati11.info

wiki.archlinux.jp

pman0214.github.io

qiita.com

www.mikitechnica.com

wiki.archlinux.jp

be.nucl.ap.titech.ac.jp

www.aomei.jp

qa.elecom.co.jp

gihyo.jp

unix.stackexchange.com

kokufu.blogspot.com