[Share Experiences] deepin使用chroot做子系统subsystem
Tofloor
poster avatar
ThinkYoung
deepin
2022-07-07 02:40
Author

大神用chroot拯救世界,挂载根目录修复系统,arch系战友亦可用它安装系统。

chroot这个根目录切换命令,本来用来做什么呢?

chroot,本来功能叫jail(我翻译它为域/狱,一种“可泄露”的沙盒,为了避免进程泄露的尴尬,我干脆使用了tmpfs挂载了临时分区/memdisk给它),

chroot是lxc(容器)的基石,docker又是高于lxc的存在

所以chroot它本来可以用做打包环境的,子系统,

我想bedrock linux 多种依赖包分层管理 原理大概就是如此吧

schroot是个优化版 有一些指定版本安装脚本在/usr/share/deboostrap/script,例如ubuntu20.04/focal,很遗憾22.04/jammy并不存在

安装ubuntu(20.04/focal)

1.安装
sudo apt-get install schroot debootstrap
2.指定
mkdir memdisk
sudo debootstrap --arch amd64 focal /memdisk/chroot/ubuntu http://archive.ubuntu.com/ubuntu/
chroot ubuntu

安装Arch

需要本身的镜像去解压

sudo apt install squashfs-tools
sudo unsquashfs airootfs.sfs
sudo mv squashfs-root /memdisk/arch
chroot arch

截图_2022-07-06_18-00-45.png

但是chroot下桌面显示,我调试的不是很成功,startx,或者vnc,都有点问题,接下来再研究研究吧

Reply Favorite View the author
All Replies
gfdgd_xi
deepin
Ecological co-builder
2022-07-07 03:05
#1

支持,也同求 chroot 的桌面显示

Reply View the author
dgmenghuan
deepin
2022-07-07 17:10
#2

applaud

Reply View the author
zccrs
deepin
2022-07-08 18:17
#3

这种事情建议用 systemd-nspawn

Reply View the author