使用CBSD克隆复制Ubuntu jail子系统环境
创始人
2025-01-09 14:35:44
0

CBSD介绍

CBSD是为FreeBSD jail子系统、bhyve、QEMU/NVMM和Xen编写的管理层。该项目定位为一个综合解决方案的单一集成工具,用于使用预定义的软件集以最少的配置快速构建和部署计算机虚拟环境。

具体安装使用见:jail管理器CBSD实践@FreeBSD_freebsd jail 部署-CSDN博客

为了快速搭建Jail 里的Ubuntu环境,可以采取建好一个jail系统,然后克隆出多个系统的方法。

cbsd克隆复制jail子系统

克隆命令

cbsd jclone old=jail2 new=jail3 host_hostname=jail3.my.domain ip4_addr=10.0.0.22/24

如原jail名字为focal,新名字为focal_to_jammy,设置好host_hostname主机名,再配置好ip地址,命令如下:

cbsd jclone old=focal new=focal_to_jammy host_hostname=focal_to_jammy.my.domain ip4_addr=10.0.0.2/24

如果原jail子系统还在运行,那么会提示加上checkstate=0 参数

cbsd jclone old=focal new=focal_to_jammy host_hostname=focal_to_jammy.my.domain ip4_addr=10.0.0.2/24 checkstate=0 

只要几秒就克隆好一个新系统了。


运行复制好的jail系统

使用cbsd jstart启动子系统 

cbsd jstart focal_to_jammy

登录jail子系统

使用cbsd jlogin 登录

root@fbhost:~ # cbsd jlogin focal_to_jammy Last login: Mon Jul 15 23:06:59 on pts/1 FreeBSD 14.1-RELEASE (GENERIC) releng/14.1-n267679-10e31f0946d8 focal_to_jammy:/root@[23:09] # chroot /compat/ubuntu/ /bin/bash root@focal_to_jammy:/# uname -a Linux focal_to_jammy.my.domain 5.15.0 FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC x86_64 x86_64 x86_64 GNU/Linux 

也可以使用jexex命令登录

jexec focal_to_jammy  chroot /compat/ubuntu /bin/bash 

 

jail子系统里升级focal到jammy(失败)

参考Install Ubuntu 22.04 Jammy in FreeBSD Jail | The FreeBSD Forums

进入子系统,使用命令:

jexec focal_to_jammy  chroot /compat/ubuntu /bin/bash 

然后,执行升级: 

apt install update-manager-core
do-release-upgrade -d

没升级成,后面也没看懂。 

这步好像不用再重复了

更新库

root@focal_to_jammy:/lib64# ls -l /lib/x86_64-linux-gnu/ld-2.31.so
-rwxr-xr-x 1 root root 191472 Apr 15  2020 /lib/x86_64-linux-gnu/ld-2.31.so

 

其它cbsd jail操作

重启子系统

cbsd jrestart focal_to_jammy 

删除

cbsd jremove jail1 

调试

do-release-upgrade -d提示set Prompt=norma

do-release-upgrade -d
Checking for a new Ubuntu release
There is no development version of an LTS available.
To upgrade to the latest non-LTS development release 
set Prompt=normal in /etc/update-manager/release-upgrades.

在/etc/update-manager/release-upgrades文件里,将Prompt=lts修改成Prompt=normal

结果执行后没什么反应:

root@focal_to_jammy:/# do-release-upgrade -d Checking for a new Ubuntu release Upgrades to the development release are only  available from the latest supported release. 

将do-release-upgrade -d的-d去掉后提示

do-release-upgrade Checking for a new Ubuntu release Get:1 Upgrade tool signature [833 B]                                            Get:2 Upgrade tool [1270 kB]                                                    Fetched 1271 kB in 0s (0 B/s)                                                   authenticate 'jammy.tar.gz' against 'jammy.tar.gz.gpg'  extracting 'jammy.tar.gz'  Reading cache  Checking package manager   A fatal error occurred   Please report this as a bug and include the files  /var/log/dist-upgrade/main.log and /var/log/dist-upgrade/apt.log in  your report. The upgrade has aborted.  Your original sources.list was saved in  /etc/apt/sources.list.distUpgrade.   Traceback (most recent call last):   File "/tmp/ubuntu-release-upgrader-fdy6hyrf/jammy", line 8, in    sys.exit(main())   File  "/tmp/ubuntu-release-upgrader-fdy6hyrf/DistUpgrade/DistUpgradeMain.py",  line 241, in main  if app.run():   File  "/tmp/ubuntu-release-upgrader-fdy6hyrf/DistUpgrade/DistUpgradeController.py",  line 2042, in run  return self.fullUpgrade()   File  "/tmp/ubuntu-release-upgrader-fdy6hyrf/DistUpgrade/DistUpgradeController.py",  line 1807, in fullUpgrade  if not self.prepare():   File  "/tmp/ubuntu-release-upgrader-fdy6hyrf/DistUpgrade/DistUpgradeController.py",  line 414, in prepare  self._sshMagic()   File  "/tmp/ubuntu-release-upgrader-fdy6hyrf/DistUpgrade/DistUpgradeController.py",  line 273, in _sshMagic  is_child_of_process_name("sshd")):   File "/tmp/ubuntu-release-upgrader-fdy6hyrf/DistUpgrade/utils.py",  line 118, in is_child_of_process_name  with open(stat_file) as stat_f:   FileNotFoundError: [Errno 2] No such file or directory:  '/proc/35020/stat'   

发现source.list文件只有一行,不知道是否这个原因

/etc/apt# cat sources.list
deb http://archive.ubuntu.com/ubuntu focal main
添加了清华源,问题依旧。查看报错,发现/proc下没有东西,且ps报错

在ps -aux的时候报错Error, do this: mount -t proc proc /proc

ps -aux
Error, do this: mount -t proc proc /proc
按照提示mount -t proc proc /proc 

结果报错

 mount -t proc proc /proc
mount: /proc: permission denied.
root@focal_to_jammy:/# mount
mount: failed to read mtab: No such file or directory
root@focal_to_jammy:/# df
df: cannot read table of mounted file systems: No such file or directory
在/etc/fstab里加上配置:

devfs      /compat/linux/dev      devfs      rw,late                    0  0
tmpfs      /compat/linux/dev/shm  tmpfs      rw,late,size=1g,mode=1777  0  0
fdescfs    /compat/linux/dev/fd   fdescfs    rw,late,linrdlnk           0  0
linprocfs  /compat/linux/proc     linprocfs  rw,late                    0  0
linsysfs   /compat/linux/sys      linsysfs   rw,late                    0  0

问题依旧。

这样在FreeBSD的jail里,想要focal升级到jammy Ubuntu的实验失败告终。

相关内容

热门资讯

总算了解!广西老友有破解吗,开... 总算了解!广西老友有破解吗,开心泉州免费辅助器,攻略教程(有挂分享)1、开心泉州免费辅助器有没有辅助...
无独有偶!微信小程序免费黑科技... 无独有偶!微信小程序免费黑科技透视,微乐小程序多功能修改器法子教程(有挂分享)1、这是跨平台的微乐小...
避坑细节!宝宝游戏辅助,决战卡... 避坑细节!宝宝游戏辅助,决战卡五星游戏辅助器,积累教程(有挂规律)亲,关键说明,决战卡五星游戏辅助器...
据权威媒体报道!微信小程序免费... 据权威媒体报道!微信小程序免费黑科技透视,钱塘十三水其实真的有挂手段教程(有挂详细)1、钱塘十三水其...
实测揭晓!同乡游辅助工具制作,... 实测揭晓!同乡游辅助工具制作,永胜联盟会封号吗,模块教程(有挂教学)1、同乡游辅助工具制作模拟器是什...
实测必看!微信小程序免费黑科技... 实测必看!微信小程序免费黑科技开挂,皮皮胡子辅助举措教程(有挂详细)1、起透看视 微信小程序免费黑科...
一分钟揭秘!微乐小程序免费黑科... 一分钟揭秘!微乐小程序免费黑科技安卓,新超凡软件辅助练习教程(有挂存在)1、微乐小程序免费黑科技脚本...
必备辅助推荐!蜜瓜大厅可以装挂... 必备辅助推荐!蜜瓜大厅可以装挂吗,友友联盟辅助脚本,指南书教程(有挂技术)1、进入游戏-大厅左侧-新...
今日焦点!微信小程序免费黑科技... 今日焦点!微信小程序免费黑科技透视,川南久久辅助模块教程(存在有挂)运微信小程序免费黑科技辅助工具,...
技术分享!山西扣点点辅助工具,... 技术分享!山西扣点点辅助工具,福州十八扑外卦视频,诀窍教程(有挂方法)1、山西扣点点辅助工具公共底牌...