linux安装32位库
sudo apt-get install libc6-dev-i386
sudo apt-get install lib32z1
带gdb调试bochs
安装相关依赖:
sudo apt install build-essential libx11-dev libxrandr-dev libsdl1.2-dev vgabios bximage
安装脚本:进入bochs目录执行即可
#!/bin/bash
./configure --enable-debugger --enable-readline
make -j8
sudo make install
sudo mv `which bochs` `which bochs`dbg
./configure --enable-gdb-stub
make -j8
sudo make install
bochsrc脚本配置:
# enable gdb debug
gdbstub: enabled = 1, port = 1234, text_base = 0, data_base = 0, bss_base = 0
dpkg锁错误
错误提示:
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?
解决方案:依次执行如下命令
sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock*
sudo dpkg --configure -a
Ubu 开机自启动 ssh
安装 openssh-server:
sudo apt-get install openssh-server
设置开机自启动:
sudo service ssh start
Ubu 虚拟机共享主机带你
虚拟机网络模式设置为 NAT
clash 开启 Alloc LAN
点击 Allow LAN 后面的那个 “三角形” :
为虚拟机设置代理:
IP 和端口就是上面圈出来的:
向 .bashrc 中写入:IP 和端口改成自己的就行
export all_proxy=socks5://10.201.65.119:63577
export http_proxy=http://10.201.65.119:63577
export https_proxy=http://10.201.65.119:63577
VScode远程调试 - 利用RemoteX11+Xming显示GUI
参考:VScode远程调试 - 利用RemoteX11+Xming显示GUI_failed to get display: error: all configured authe-CSDN博客
VScode 配置
1)请更新 vscode 到最新版本,不然无法安装 Remote 相关扩展
2)安装相关扩展
Xming 配置
1)安装 Xming:Xming X Server for Windows - Browse /Xming-mesa/6.9.0.31 at SourceForge.net
2)配置 X0.hosts ==> 这个文件在你的安装目录下
里面写上虚拟机的 ip 地址即可
SSH 配置
加上如下选项:
ForwardX11 yes
ForwardX11Trusted yes
ForwardAgent yes
虚拟机配置
添加环境变量 DISPLAY 即可:
export DISPLAY="localhost:0.0"
打开 XLaunch 一直下一步即可,然后就可以用 vscode 远程调试了,这里我就单纯测试下 GUI
V8 代理问题 .boto file
[Boto]
proxy = 100.100.100.100
proxy_port = 8080
然后执行:
export NO_AUTH_BOTO_CONFIG=~/.boto
Ubu 更换 gcc/g++ 版本
sudo apt install cmake
sudo apt install ruby
sudo apt install libicu-dev
// 添加 GCC Toolchain PPA:GCC Toolchain PPA 提供了最新版本的 GCC 软件包。
// 打开终端并执行以下命令以添加该 PPA:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
// 更新软件包列表:添加 PPA 后,需要更新软件包列表以获取最新的软件包信息。运行以下命令进行更新
sudo apt update
// 安装 GCC:现在可以安装最新版本的 GCC
sudo apt install gcc-<version> g++-<version>
// 配置默认编译器:安装完 GCC 10 后,你可以使用 update-alternatives 命令配置默认编译器。
// 运行以下命令来配置 GCC 10 为默认编译器
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-<version> 100 --slave /usr/bin/g++ g++ /usr/bin/g++-<version>
编译 linux 内核可能需要的依赖
sudo apt install flex bison
sudo apt-get install libncurses-dev libelf-dev
切换内核版本
首先 apt 寻找相关版本:
sudo apt-cache search linux | grep linux-image-5.15.0 | grep generic
也可以自己下载源码编译安装
结果如下:
linux-image-5.15.0-25-generic - Signed kernel image generic
linux-image-5.15.0-100-generic - Signed kernel image generic
linux-image-5.15.0-101-generic - Signed kernel image generic
linux-image-5.15.0-102-generic - Signed kernel image generic
linux-image-5.15.0-105-generic - Signed kernel image generic
linux-image-5.15.0-72-generic - Signed kernel image generic
linux-image-5.15.0-73-generic - Signed kernel image generic
linux-image-5.15.0-75-generic - Signed kernel image generic
linux-image-5.15.0-78-generic - Signed kernel image generic
linux-image-5.15.0-79-generic - Signed kernel image generic
linux-image-5.15.0-82-generic - Signed kernel image generic
linux-image-5.15.0-83-generic - Signed kernel image generic
linux-image-5.15.0-84-generic - Signed kernel image generic
linux-image-5.15.0-86-generic - Signed kernel image generic
linux-image-5.15.0-87-generic - Signed kernel image generic
linux-image-5.15.0-88-generic - Signed kernel image generic
linux-image-5.15.0-89-generic - Signed kernel image generic
linux-image-5.15.0-91-generic - Signed kernel image generic
linux-image-5.15.0-92-generic - Signed kernel image generic
linux-image-5.15.0-94-generic - Signed kernel image generic
linux-image-5.15.0-97-generic - Signed kernel image generic
再用 apt 安装对应版本的内核:
sudo apt install linux-image-5.15.0-72-generic
安装完成之后,修改 /etc/default/grub 如下配置:
GRUB_TIMEOUT_STYLE=hidden 给删除或者注释掉
GRUB_TIMEOUT=30 timeout为30s
修改保存之后使用如下命令更新grub配置
sudo update-grub
如果要编译内核模块则安装相关头文件:
sudo apt-get install linux-headers-5.15.0-72-generic
重启后进入advance选择目标内核进启动
debootstrap 制作文件系统
这里直接使用 syzkaller 提供的脚本 来生成:
sudo apt-get install debian-archive-keyring
sudo apt install make gcc flex bison libncurses-dev libelf-dev libssl-dev
mkdir image
cd image
wget https://raw.githubusercontent.com/google/syzkaller/master/tools/create-image.sh -O create-image.sh
chmod +x create-image.sh
./create-image.sh
安装 libmnl/libnftnl
sudo apt install autoconf automake libtool
git clone git://git.netfilter.org/libmnl
cd libmnl
./autogen.sh
./configure --prefix=/usr && make
sudo make install
git clone git://git.netfilter.org/libnftnl
cd libnftnl
./autogen.sh
./configure --prefix=/usr && make
sudo make install
静态库安装
libmnl:
sudo apt install autoconf automake libtool
git clone git://git.netfilter.org/libmnl
cd libmnl
./autogen.sh
mkdir _install
./configure LDFLAGS=-static --prefix=$PWD/_install
make
make install
然后 libmnl.a 在 $PWD/_install/lib/ 目录下
libnftnl:
git clone git://git.netfilter.org/libnftnl
cd libnftnl
./autogen.sh
mkdir _install
./configure LDFLAGS=-static --prefix=$PWD/_install PKG_CONFIG_PATH=/path/libmnl/_install/lib/pkgconfig
make
make install
gcc -static -masm=intel -no-pie -o demo demo.c -L/path/ -lnftnl -L/path/ -lmnl -w -pthread
Ubu Link 时 Out of memory 比如编译 chrome
// 查看
sudo sysctl -a | grep vm.max_map_count
// vm.max_map_count = 65530
// 临时修改
sudo sysctl -w vm.max_map_count=262144