当前位置: 首页 > news >正文

jail子系统里升级Ubuntu focal到jammy

Ubuntu focal是20.04 ,jammy版本是22.04,本次的目的就是将FreeBSD jail子系统里的Ubuntu 从20.04升级到22.04 。这个focal 子系统是通过cbsd克隆得到的。使用CBSD克隆复制Ubuntu jail子系统环境-CSDN博客

do-release-upgrade升级没成功,用debootstrap重装升级成功! 

说明,有三个系统:FreeBSD宿主机,FreeBSD jail子系统, Ubuntu jail 子系统

安装好后,可以从宿主机进入FreeBSD或Ubuntu jail子系统。在FreeBSD jail子系统里可以安装多个Ubuntu jail子系统,并进入该子系统。

Ubuntu jail子系统里升级focal到jammy

使用do-release-upgrade升级(失败)

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

在FreeBSD宿主机进入Ubuntu jail 子系统,使用命令:

jexec focal_to_jammy  chroot /compat/ubuntu /bin/bash

子系统是以前克隆的focal版本,依次执行升级命令: 

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

没升级成功。

用-d选项的话没有错误信息,去掉-d选项,有报错信息,见后面调试部分。最终没有用这种方法升级成功。

使用debootstrap升级

使用cbsd jlogin focal_to_jammy 进入FreeBSD jail子系统,这时候是处于FreeBSD系统下,有pkg指令,所以:

先pkg安装debootstrap

pkg install debootstrap

执行debootstrap 下载jammy

debootstrap jammy /compat/jammy

 这样FreeBSD jail子系统里的操作就结束了,后面就是进入jammy jail子系统进行操作了。

进入jammy jail子系统

从FreeBSD jail子系统执行chroot进入jammy子系统

focal_to_jammy:/root@[9:37] # chroot /compat/jammy/ /bin/bash
groups: cannot find name for group ID 0
groups: cannot find name for group ID 5
I have no name!@focal_to_jammy:/# 

如果顺利,到了这一步就可以结束了,但是:

发现这个jammy子系统里又没有apt

怎么老碰到这个问题?  

debootstrap安装jammy时的输出,有apt这个包啊

I: Retrieving apt 2.4.5
I: Validating apt 2.4.5
 

I: Extracting base-files...
I: Extracting base-passwd...
I: Extracting bash...
发现确实没有解开apt的包

第二次使用--include=apt选项

debootstrap --include=apt jammy /compat/jammy

I: Validating adduser 3.118ubuntu5
I: Validating apt 2.4.5
I: Validating apt-utils 2.4.5
 

还是没有Extracting解开apt 包。话说debootstrap就这么节俭吗? 连个apt包都不给? 还是说只有FreeBSD下的这个debootstrap不给? 

看看jammy里的/usr/bin 目录,里面就是没有apt !

jammy jail子系统里手工安装apt

以前手工安装apt,会碰到依赖库的问题,操作很繁琐,这回找到了一个最方便的方法

dpkg --force-depends -Ei /var/cache/apt/archives/*.deb

 jammy jail子系统里所有的deb包放在/var/cache/apt/archives目录,

只要使用这一条命令就能装好apt包,使用命令

dpkg --force-depends -Ei /var/cache/apt/archives/*.deb

过程中问到键盘设置啥的, 还有pam的配置改变要不要覆盖:

 One or more of the files                                                  │ 
 │ /etc/pam.d/common-{auth,account,password,session} have been locally       │ 
 │ modified.  Please indicate whether these local changes should be          │ 
 │ overridden using the system-provided configuration.  If you decline this  │ 
 │ option, you will need to manage your system's authentication              │ 
 │ configuration by hand.                                                    │ 
 │                                                                           │ 
 │ Override local changes to /etc/pam.d/common-*?                            │ 
 │                                                                           │ 
 │                    <Yes>                       <No>      

因为是新系统,本地没啥,所以选择了Yes覆盖

后面还有设置时区shanghai 等

安装完成后,终于有了APT

但是刚开始使用apt会报错

apt update 报错问题解决

apt update
Get:1 http://archive.ubuntu.com/ubuntu jammy InRelease [270 kB]
0% [Working]/usr/bin/apt-key: 95: cannot create /dev/null: Permission denied
/usr/bin/apt-key: 95: cannot create /dev/null: Permission denied
/usr/bin/apt-key: 95: cannot create /dev/null: Permission denied
E: gpgv, gpgv2 or gpgv1 required for verification, but neither seems installed
Err:1 http://archive.ubuntu.com/ubuntu jammy InRelease
  gpgv, gpgv2 or gpgv1 required for verification, but neither seems installed
Reading package lists... Done
W: GPG error: http://archive.ubuntu.com/ubuntu jammy InRelease: gpgv, gpgv2 or gpgv1 required for verification, but neither seems installed
E: The repository 'http://archive.ubuntu.com/ubuntu jammy InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
 看里面讲到 /dev/null: Permission denied,就给它666权限:

 执行chmod 666 /dev/null  

将/dev/null设为666 

chmod 666 /dev/null

然后update 搞定,但是upgrade报错

apt upgrade
Reading package lists... Done
Building dependency tree... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 dash : Depends: dpkg (>= 1.19.1) but it is not installed
 grep : Depends: dpkg (>= 1.15.4) but it is not installed or
                 install-info but it is not installed
 gzip : Depends: dpkg (>= 1.15.4) but it is not installed or
                 install-info but it is not installed
 perl-base : PreDepends: dpkg (>= 1.17.17) but it is not installed
 python3-minimal : Depends: dpkg (>= 1.13.20) but it is not installed
 readline-common : Depends: dpkg (>= 1.15.4) but it is not installed or
                            install-info but it is not installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

尝试apt --fix-broken install修复apt upgrade报错问题

按照报错提示,输入

apt --fix-broken install

修复完成,apt install wget ,成功!

现在看看版本:

lsb_release -a

lsb_release -a
No LSB modules are available.
Distributor ID:    Ubuntu
Description:    Ubuntu 22.04 LTS
Release:    22.04
Codename:    jammy
成功升级到jammy版本!

总结

本来想用下面两条执行将focal升级到jammy,但是没有成功。

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

最终还是使用了debootstrap 老办法升级成功。

debootstrap安装jammy

​pkg install debootstrapdebootstrap jammy /compat/jammychroot /compat/jammy/ /bin/bash chmod 666 /dev/nulldpkg --force-depends -Ei /var/cache/apt/archives/*.debapt updateapt --fix-broken installapt upgrade# 看版本lsb_release -a

调试

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 cacheChecking package managerA 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 
<module> 
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的实验失败告终。

相关文章:

  • 北京网站建设多少钱?
  • 辽宁网页制作哪家好_网站建设
  • 高端品牌网站建设_汉中网站制作
  • XML 验证器:确保数据完整性和准确性的关键工具
  • 如何查看极狐GitLab Helm Chart?
  • 用Pytorch实现线性回归(Linear Regression with Pytorch)
  • 基于luckysheet实现在线电子表格和Excel在线预览
  • 防火墙NAT地址转换和智能选举综合实验
  • 代谢组数据分析(十五):基于python语言构建PLS-DA算法构建分类模型
  • LLM-阿里 DashVector + langchain self-querying retriever 优化 RAG 实践【Query 优化】
  • springboot系列教程(一):简介与入门案例(含源码)
  • html5——CSS列表样式属性
  • django报错(一):python manage.py makemigrations,显示“No changes detected”
  • android的跨进程通讯方式
  • Qt窗口程序整理汇总
  • 【D3.js in Action 3 精译】第二章 DOM 的操作方法
  • 大语言模型 API
  • 虚拟机及其Debian(kali)安装
  • SegmentFault for Android 3.0 发布
  • 【刷算法】求1+2+3+...+n
  • 【知识碎片】第三方登录弹窗效果
  • Android组件 - 收藏集 - 掘金
  • angular2 简述
  • ComponentOne 2017 V2版本正式发布
  • es6--symbol
  • Eureka 2.0 开源流产,真的对你影响很大吗?
  • Java|序列化异常StreamCorruptedException的解决方法
  • java2019面试题北京
  • JavaScript DOM 10 - 滚动
  • javascript数组去重/查找/插入/删除
  • JS函数式编程 数组部分风格 ES6版
  • Js实现点击查看全文(类似今日头条、知乎日报效果)
  • nginx 配置多 域名 + 多 https
  • rc-form之最单纯情况
  • React-flux杂记
  • 彻底搞懂浏览器Event-loop
  • 更好理解的面向对象的Javascript 1 —— 动态类型和多态
  • 简析gRPC client 连接管理
  • 文本多行溢出显示...之最后一行不到行尾的解决
  • 正则表达式
  • 字符串匹配基础上
  • # Redis 入门到精通(八)-- 服务器配置-redis.conf配置与高级数据类型
  • ###C语言程序设计-----C语言学习(6)#
  • #绘制圆心_R语言——绘制一个诚意满满的圆 祝你2021圆圆满满
  • $Django python中使用redis, django中使用(封装了),redis开启事务(管道)
  • $NOIp2018$劝退记
  • (2020)Java后端开发----(面试题和笔试题)
  • (7) cmake 编译C++程序(二)
  • (C语言)输入自定义个数的整数,打印出最大值和最小值
  • (SERIES12)DM性能优化
  • (附源码)ssm高校运动会管理系统 毕业设计 020419
  • (附源码)SSM环卫人员管理平台 计算机毕设36412
  • (三)模仿学习-Action数据的模仿
  • (十六)串口UART
  • (一)【Jmeter】JDK及Jmeter的安装部署及简单配置
  • (原創) 如何解决make kernel时『clock skew detected』的warning? (OS) (Linux)
  • (转)JVM内存分配 -Xms128m -Xmx512m -XX:PermSize=128m -XX:MaxPermSize=512m
  • (转)linux下的时间函数使用