Image may be NSFW.
Clik here to view.
最近お気に入りのLinux,Rescuezilla LiveCDのISOファイルから,rootファイルシステムを抜き出し,WSL2にインストールした。
Rescuezillaは,USBメモリ等から起動して,パソコンのHDD/SSDのイメージバックアップ・リストア・クローンができるLinuxディストリビューション。
https://rescuezilla.com/
以下の要領であれば,様々なLinuxのLiveCDが,WSL2で起動できそうだ。
WSL2のKali-Linux,Ubuntu等を起動して,7zipでISOファイルから中のファイルを取り出す。
apt update
apt install p7zip
mkdir rescuezilla
cd rescuezilla
7z x ../rescuezilla-2.2-64bit.hirsute.iso
casperの中にfilesystem.squashfsというファイルがあり,これが圧縮されたrootファイルシステムなので,解凍する。
cd casper/
apt install squashfs-tools
unsquashfs -d rootfs filesystem.squashfs
rootfsをtarコマンドで1つにまとめる。
cd rootfs/
ls
bin dev etc home lib lib32 lib64 libx32 media mnt opt proc root run sbin srv tmp usr var
tar -zcvf ../resuezilla.tar.gz .
C:\rescuezillaディレクトリを作成し,tar.gzファイルをコピーする。
mkdir /mnt/c/rescuezilla
cd ..
cp resuezilla.tar.gz /mnt/c/rescuezilla/.
Windows11で管理者コマンドプロンプトを起動し,wslコマンドでtar.gzファイルをインポートする。
wslコマンドのインポートは,wsl –import Linuxの名前 格納先ディレクトリ tar.gzファイル で行う。
mkdir c:\resucuezilla\packages
wsl --import rescuezilla c:\rescuezilla\packages c:\rescuezilla\resuezilla.tar.gz
wsl -l -v
NAME STATE VERSION
* Ubuntu Stopped 2
kali-linux Running 2
rescuezilla Stopped 2
Debian Stopped 2
rescuezillaを起動する。
wsl -d rescuezilla
最初は,rootユーザーしかないので,ユーザーを作成し,sudoグループにする。
useradd toor
passwd toor
usermod -G sudo toor
デフォルトユーザーをtoorにする。
(wsl.confファイルを新規作成)
vi /etc/wsl.conf
[user]
default=toor
一旦シャットダウンして再起動する。一般ユーザープロンプトになる。
wsl –d rescuezilla
root で入り直す場合は,-u root とする。
wsl -d rescuezilla -u root
上の画像のrescuezilla は以下のコマンドで起動する。
sudo /usr/sbin/rescuezilla
カーネルは,WSL2の場合共通となる。
uname -a
Linux e130 5.10.74.3-microsoft-standard-WSL2+ #3 SMP Thu Nov 18 10:18:05 JST 2021 x86_64 x86_64 x86_64 GNU/Linux