安裝

  1. 目的:在 MSI PS42 安裝客製化 DYW Linux 系統。
  2. MSI PS42 BIOS 沒有 PXE 安裝選項。
  3. BIOS 開閉 Secure boot,使用隨身碟開機。
  4. 硬碟分割格式為 UEFI/GPT,使用 gdisk 進行分割,必須要有 EF00 的 EFI System 分割區,才能以 UEFI 開機。
    [root@dywmsi ~]# gdisk /dev/nvme0n1
    GPT fdisk (gdisk) version 0.8.10
    
    Partition table scan:
      MBR: protective
      BSD: not present
      APM: not present
      GPT: present
    
    Found valid GPT with protective MBR; using GPT.
    
    Command (? for help): p
    Disk /dev/nvme0n1: 1000215216 sectors, 476.9 GiB
    Logical sector size: 512 bytes
    Disk identifier (GUID): C4922C32-FCB9-4A8E-8DC4-0D5C6A655F7B
    Partition table holds up to 128 entries
    First usable sector is 34, last usable sector is 1000215182
    Partitions will be aligned on 2048-sector boundaries
    Total free space is 53334637 sectors (25.4 GiB)
    
    Number  Start (sector)    End (sector)  Size       Code  Name
       1            2048           43007   20.0 MiB    EF00  EFI System
       2           43008         1067007   500.0 MiB   EF02  BIOS boot partition
       3         1067008       944785407   450.0 GiB   8E00  Linux LVM
    
    Command (? for help): q
    
  5. 分割規劃如下:
    [root@dywmsi ~]# lsblk 
    NAME                  MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
    nvme0n1               259:0    0  477G  0 disk 
    ├─nvme0n1p3           259:3    0  450G  0 part 
    │ ├─vgmsi-swap (dm-1) 253:1    0    8G  0 lvm  [SWAP]
    │ ├─vgmsi-home (dm-2) 253:2    0  140G  0 lvm  /home
    │ ├─vgmsi-root (dm-0) 253:0    0  120G  0 lvm  /
    │ └─vgmsi-pub (dm-3)  253:3    0  100G  0 lvm  /var/ftp/pub
    ├─nvme0n1p1           259:1    0   20M  0 part /boot/efi
    └─nvme0n1p2           259:2    0  500M  0 part /boot
    
  6. UEFI 開機檔案系統根目錄必須有 EFI/BOOT 目錄,而且目錄下必須有 EFI 開機檔 BOOTX64.efi,及 BOOTX64.conf grub 開機選單檔。
    [root@dywmsi ~]# ll /boot/efi/EFI/BOOT/
    total 504
    -rwxr-xr-x. 1 root root   3522 Jun 10 11:10 BOOTX64.conf
    -rwxr-xr-x. 1 root root 253736 Jun 10 07:07 BOOTX64.efi
    
  7. 使用複製檔案系統 cp -ax 方式進行安裝,在複製完成後必須 chroot 到新系統,並在根目錄上產生空檔案 .autorelabel 。
    [root@deyu ~]# chroot /mnt/root
    [root@dywmsi ~]# touch /.autorelabel
    
  8. 使用複製檔案方式安裝,第一次開機必須進入單人維修模式,系統讀到根目錄的 .autorelabel 會進行檔案的 selinux context 重設定,才能正常開機 。