【个人记录】Ubuntu做网络路由+强化学习项目debug

本篇并不介绍做整个项目的过程,仅仅是个人在科研过程中的debug记录和心得。希望某个部分是你正需要的解决方案。

第一部分:在服务器上安装mininet

mininet是一个在安装过程中比较容易出问题的包。一定要好好看看官方INSTALL文档。Download/Get Started With Mininet

最简单的方式是下载Mininet镜像虚拟机,但是一开始我使用的实验室的服务器,所以选择clone再安装。实验室的服务器使用LXD容器形式,Ubuntu版本22.04。

服务器由于某些原因无法上外网,所以使用本地IPv6拉代理上外网(该方法在其他服务器或虚拟机上能不能实现不知道)。具体步骤是:①打开clash for wins的allow LAN并记下端口号;②在本地通过ipconfig查看ipv6地址;③服务器命令行中输入:export http_proxy=http://[你的ipv6地址]:本地代理端口号 export https_proxy=https://[你的ipv6地址]:本地代理端口号;④在服务器命令行中输入“ wget http://www.baidu.com”测试,如果能够获取index.html,即为成功。

通过以上步骤成功git clone https://github.com/mininet/mininet.git至服务器。接着运行mininet/utils/install.sh -a。

运行mininet的安装脚本时出现了错误:

-DVERSION=\"`PYTHONPATH=. python -B bin/mn --version 2>&1`\" mnexec.c -o mnexec
<command-line>: warning: missing terminating " character
mnexec.c: In function ?main?:
<command-line>: error: missing terminating " character
mnexec.c:208:28: note: in expansion of macro ?VERSION?
  208 |             printf("%s\n", VERSION);
      |                            ^~~~~~~
mnexec.c:208:35: error: expected expression before ?)? token
  208 |             printf("%s\n", VERSION);
      |                                   ^
make: *** [Makefile:50: mnexec] Error 1

通过建立软链接的方式解决问题,参考【排坑向】Mininet完全安装指南

sudo ln -s /usr/bin/python3 /usr/bin/python

接着出现以下错误:

Setting up openvswitch-switch (2.17.8-0ubuntu0.22.04.1) ...
Could not execute systemctl:  at /usr/bin/deb-systemd-invoke line 142.
A dependency job for openvswitch-switch.service failed. See 'journalctl -xe' for details.
invoke-rc.d: initscript openvswitch-switch, action "start" failed.
? openvswitch-switch.service - Open vSwitch
     Loaded: loaded (/lib/systemd/system/openvswitch-switch.service; enabled; vendor preset: enabled)
    Drop-In: /run/systemd/system/service.d
             ??zzz-lxc-service.conf
     Active: inactive (dead)

systemd[1]: Dependency failed for Open vSwitch.                                                 
openvswitch-switch.service: Job openvswitch-switch.service/start failed with result 'dependency'.

输入journalctl -xe命令得到:

pam_unix(sudo:session): session opened for user root(uid=0) by (uid=1001)
pam_unix(sudo:session): session closed for user root
username : TTY=pts/2 ; PWD=/home/username/Documents/mininet ; USER=root ; ENV=PYTHON=python ; COMMAND=/usr/bin/make >
pam_limits(sudo:session): Could not set limit for 'core' to soft=0, hard=-1: Operation not permitted; uid=1001,euid=0

大意就是出现了与pam_limits和资源限制相关的错误。需要编辑/etc/security/limits.conf文件来设置资源限制。但是因为我无权修改,所以服务器这条路彻底走不通了,于是才使用了虚拟机。

第二部分:在虚拟机上安装mininet

在虚拟机上安装mininet异常顺利。
虚拟机配置:
VMware 16 pro
Ubuntu20.04
创建虚拟环境pytorch,python版本3.7

听到说不要用太新的Ubuntu版本,可能会有问题。

出现了一下问题:

-DVERSION=\"`PYTHONPATH=. python -B bin/mn --version 2>&1`\" mnexec.c -o mnexec
<command-line>: warning: missing terminating " character
/usr/bin/ld: cannot find 1:: No such file or directory
/usr/bin/ld: cannot find python:: No such file or directory
/usr/bin/ld: cannot find not: No such file or directory
/usr/bin/ld: cannot find found": No such file or directory
collect2: error: ld returned 1 exit status
make: *** [Makefile:50: mnexec] Error 1

可通过建立软链接解决。其余问题就是因为连外网不稳定,导致依赖无法clone下来。解决这个问题我是等着能连上了就赶紧安装mininet,也可以搜索一下虚拟机连外网的方法。

第三部分:本地vscode连接虚拟机

参考自vscode 连接虚拟机(Ubuntu)系列问题

安装ssh的时候出现了点小问题,先是输入命令sudo apt - get install openssh-server,出现以下报错:

E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?

可以先重启一下系统,如果还是无法解决可以按照Linux 报错:Could not get lock /var/lib/dpkg/lock 该如何解决呢?How to Fix ‘E: Could not get lock /var/lib/dpkg/lock’ Error in Ubuntu Linux尝试解决。

持续更新……

  • 18
    点赞
  • 26
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值