![在用户模式 Linux 中构建 Debian Wheezy 的问题](https://linux22.com/image/136937/%E5%9C%A8%E7%94%A8%E6%88%B7%E6%A8%A1%E5%BC%8F%20%E2%80%8B%E2%80%8BLinux%20%E4%B8%AD%E6%9E%84%E5%BB%BA%20Debian%20Wheezy%20%E7%9A%84%E9%97%AE%E9%A2%98.png)
我正在 UML 内构建 Debian 虚拟机,但它挂起。
这是我的构建 shell 脚本:
#!/bin/bash
# Let's make sure we're updated
printf "\nUpdating...\n"
apt update
apt upgrade
# Next let's collect some tools we may need
printf "\nInstalling tcpdump, nmap, wireshark, qemu, debootstrap.\n"
apt install tcpdump nmap wireshark qemu debootstrap
# We need a tarball of the linux kernel. We use the current mainline as of this writing.
printf "\nDownloading mainline linux kernel...\n"
curl -o kernelpackage https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/snapshot/linux-4.18-rc4.tar.gz
# And we'll extract it to the current directory.
printf "\nExtracting linux kernel...\n"
tar -zxvf kernelpackage
# Next let's start with configuring UML default.
# This line changes dependent on your kernel release.
cd linux-4.18-rc4
# Set up some configuration.
printf "\nConfiguring kernel...\n"
make defconfig ARCH=um
# This summons up the kernel. Don't be afraid, this will take some time.
printf "\nBuilding kernel...\n"
make ARCH=um linux
# We need to make modules BEFORE we strip. Ignore the book.
printf "\nBuilding kernel modules...\n"
make ARCH=um modules
# Let's get a debian distribution to run in the virtual machine.
printf "\nDownloading and constructing debian image for VM...\n"
sudo debootstrap --arch amd64 --variant minbase wheezy wheezy-uml http://mirror.switch.ch/ftp/mirror/debian
# And let's ensure that UML will have write permissions.
sudo chown -R $USER:$USER wheezy-uml
# Finally, we can start the UML VM. We will be giving it a gigabyte of ram.
printf "\nStarting virtual machine...\n"
# Boot debian in the virtual machine.
./linux rootfstype=hostfs rootflags=$(pwd)/wheezy-uml init=/sbin/init rw mem=1024M
现在,这是启动 Debian 时的结果:
所以我随机挂起: crng init Done
任何帮助和建议都会很棒——我是仿真领域的新手。谢谢你!