如何使用Ubunut20.04根文件系统

发布时间 2023-05-25 16:33:07作者: Ctrl攻城狮

rootfs

cd /home/kunyi/ubuntu_rootfs
⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️第一次⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️
sudo apt-get install qemu-user-static
sudo cp /usr/bin/qemu-arm-static ./usr/bin/
⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️第一次⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️
sudo cp /etc/resolv.conf ./etc/resolv.conf
安装常用的命令和软件
1  apt update
2  apt upgrade
3  apt install sudo
4  apt install net-tools
5  apt install ifupdown
6  apt install ethtool
7  apt install iputils-ping
8  apt install udhcpc
9  apt install vim
10 apt install udev
⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️
11 apt install systemd
⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️
设置 root 用户密码
passwd root
123456

img

添加用户
adduser faker

img

vim /etc/sudoers

img

设置本机名称和IP地址
echo "Ubuntu" > /etc/hostname
echo "127.0.0.1 localhost" >> /etc/hosts
echo "127.0.1.1 Ubuntu" >> /etc/hosts  
配置网络 dhcp
vim /etc/network/interfaces
⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️
auto lo
allow-hotplug eth0
iface eth0 inet dhcp
⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️
⭕⭕⭕使用systemd作为init程序⭕⭕⭕

Error:

[    9.566167] VFS: Mounted root (nfs filesystem) readonly on device 0:19.
[    9.573276] devtmpfs: mounted
[    9.576859] Freeing unused kernel memory: 2112K
[    9.588451] Run /sbin/init as init process
[    9.594324] Run /etc/init as init process
[    9.599036] Run /bin/init as init process
[    9.604125] Run /bin/sh as init process
[    9.621377] random: fast init done
/bin/sh: 0: can't access tty; job control turned off

solution:

⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️
ln -s /lib/systemd/systemd /sbin/init
⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️

⬇️有箭头的特别要注意⬇️