LoginSignup
0
1

More than 3 years have passed since last update.

[Mac][USB][Docker] MacOSでWindows 7 iso からWiondows PC向けUSB起動メディア作成

Last updated at Posted at 2020-07-14

Windows 7 Ultimate がBIOSから起動しなくなったので (おそらくWindows update が原因
詳しくは別記事。)
手持ちのMacbook で、Docker 上のUbuntu でUSB起動メディアを作成した。

(Mac 上でWindows PC用の起動メディア は例はあまり見つからなかったので (Mac のBoot Camp用はあったが)
書留ておく。)

起こったこと  

Windows 7Windows update の後の再起動で BIOSから突然起動しなくなった。(trap? Bitlocker の暗号化更新が 古いbootloaderに対応していない

A recent hardware or software change might have installed a file that is signed incorrectly or damaged, or that might be malicious software from an unknown source.

If you have a Windows installation disk, insert the disk and restart your computer. Click "Repair your computer", and then choose a recovery tool.

Otherwise, to start Windows so you can investigate further, press the Enter key to display the boot menu, press F8 for Advanced Boot Options, and select Last Known Good. If you understand why the digital signature cannot be verified and want to start Windows without this file, temporarily disable driver signature enforcement.

File: \Windows\System32\winload.exe

Status: 0xc0000428

Info: Windows cannot verify the digital signature for this file.

https://www.borncity.com/blog/2019/08/21/windows-7-neuinstallation-und-der-boot-fehler-0xc0000428/
->
結果的に、Windows機向け起動メディアをMacで作成して 修復した。

Windows の代替機があれば、起動メディア作成も難しくないかもだが、
Macbook しかなかったため、容易に方法がみつからなかった。

はじめは検索に出てきたEasy Recovery Essentials というソフトを利用する方法で修復を試みた、が
Bootはしたが結果修復は失敗 したようで、逆にエラー画面すらでなくなった。
そのため、起動メディアを作成 を試すことにした。

細かい流れは別記事に。

試したこと

Mac上で iso などを USB に焼けそうなものだと
UNetBootin, dd, Balena etcher, 直接ファイルコピペ, diskutil など方法があるが、
ファイルformatシステム (FAT32 など) が違うのか
bootable としてて 今回のWindows7 isoはBIOS認識しなかった。

起動メディア作成方法

そして結局うまくいったのは、 WoeUSB
Ubuntu上で動作する WoeUSB が Windows 向けのWindows 起動メディア作成に適しているよう。open source。
https://github.com/slacka/WoeUSB

(Virtualbox/Docker などに Windows iso入れてもよかったが、容量が必要そうだったので
手軽なUbuntu にした。)

Docker + Ubuntu を利用した起動メディア作成の流れ

  • VirtualBox manager でdocker-machine で利用する virtualbox の USB busへのアクセス権利を与える
  • 同時に、ファイル共有などで、ローカル(Mac) にダウンロードしたiso などをコンテナと共有する
  • docker-machine ssh で boot2docker に入り、そこから docker run -v /Volume/shared:/Volume/shared --priviledged --device=/dev/sdb1 ubuntu などとして さらにファイル共有 + USBドライブにアクセス権を渡す
  • 作成したdocker image 上で、WoeUSB をインストールし コマンド実行する

Ubuntu の用意

Docker 上に用意。

今回は、コンテナに
* Virtualbox manager で、USB busにアクセスできるように設定
* docker run--priviledged--device オプションでUSBドライブのアクセス権を渡す。
* 同時に -v で 共有する Volumeを指定する。

# /dev/以下の device node 特定
$ lsblk
...
sda    8:0    0  40G  0 disk
sda1   8:1    0  40G  0 part / #(例

WoeUSB インストールと実行

そのままだと、上手くインストールできなかったが、
記事があったので参考。

# 以下のようにCUI実行 (これはパーティションなし ですべて初期化の場合
$ woeusb --device win7_amd64.iso /dev/sdb 

注意点

  • BIOS 起動時にUSB 起動メディアを先にロードするなどBIOS 設定も注意 (BIOS のFast booting などオプションを無効にする
  • BIOS で修復対象のドライブが無効だと 自動修復の際に読み込まれずに、USBメディア自体を書き換える
  • 私の場合 認識するファイルフォーマットは FAT32 (32GB 以上のメモリなら ExFAT)

参考

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1