最近开始学习操作系统相关知识,学习材料为MIT 6.S081,这里给出实验环境的配置方法。

学习资料:

参考资料:

环境

这里环境使用wsl2 + ubuntu20.04。

安装指令

使用官网的指令即可,注意这里如果不是ubuntu20.04可能会出现问题:

sudo apt-get install git build-essential gdb-multiarch qemu-system-misc gcc-riscv64-linux-gnu binutils-riscv64-linux-gnu 
sudo apt-get remove qemu-system-misc
sudo apt-get install qemu-system-misc=1:4.2-3ubuntu6

报错

报错1

E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/g/glibc/libc6-dbg_2.31-0ubuntu9.3_amd64.deb  404  Not Found [IP: 119.96.66.248 80]

如果出现上述报错,那么使用如下命令打开resolv.conf:

sudo vi /etc/resolv.conf

追加如下DNS:

nameserver 223.5.5.5  
nameserver 223.6.6.6

更新:

sudo apt-get update

然后再次安装即可。

报错2

The following packages have unmet dependencies:
 build-essential : Depends: libc6-dev but it is not going to be installed or
                            libc-dev
                   Depends: g++ (>= 4:9.2) but it is not going to be installed

出现上述报错后执行如下命令:

sudo apt-get install libc6-dev

出现如下报错:

The following packages have unmet dependencies:
 libc6-dev : Depends: libc6 (= 2.31-0ubuntu9.2) but 2.31-0ubuntu9.3 is to be installed
E: Unable to correct problems, you have held broken packages.

此报错的含义是libc6的安装版本不对,为了验证这点,使用如下命令查看libc6版本:

dpkg -l | grep libc6
ii  libc6:amd64                    2.31-0ubuntu9.3                    amd64        GNU C Library: Shared libraries

为了解决上述问题,需要安装指定版本的libc6,命令如下:

sudo apt-get install  libc6=2.31-0ubuntu9.2