ophub / amlogic-s9xxx-armbian

Support for Armbian in Amlogic, Rockchip and Allwinner boxes. Support a311d, s922x, s905x3, s905x2, s912, s905d, s905x, s905w, s905, s905l, rk3588, rk3568, rk3399, rk3328, h6, etc.
GNU General Public License v2.0
6.09k stars 1.95k forks source link

update失败后无法启动 #937

Closed OwnerCM closed 1 year ago

OwnerCM commented 1 year ago

Device Information | 设备信息

Armbian Version | 系统版本

Describe the bug | 问题描述 好奇心驱使的情况下执行了更新,更新失败后重启失败,更新结果如下

armbian:/boot:# armbian-update [ STEPS ] Ready to update, please wait... [ STEPS ] Start initializing the environment... [ INFO ] Armbian PLATFORM: [ amlogic ] [ INFO ] Set the kernel name: [ ] [ INFO ] Set the kernel directory: [ stable ] [ INFO ] Current version: 5.15.86, Latest version: 5.15.88 [ STEPS ] Start downloading the kernel from [ https://github.com/ophub/kernel/tree/main/pub/stable/5.15.88 ]... A . A boot-5.15.88-happy-new-year.tar.gz A dtb-allwinner-5.15.88-happy-new-year.tar.gz A dtb-amlogic-5.15.88-happy-new-year.tar.gz A dtb-rockchip-5.15.88-happy-new-year.tar.gz A header-5.15.88-happy-new-year.tar.gz A modules-5.15.88-happy-new-year.tar.gz A sha256sums Exported revision 706.

[ STEPS ] Start checking the kernel... [ INFO ] Kernel name: [ 5.15.88-happy-new-year ] [ INFO ] K510: [ 0 ] [ INFO ] Enable sha256sum checking... [ INFO ] (1/4) [ boot-5.15.88-happy-new-year.tar.gz ] file sha256sum check same. [ INFO ] (2/4) [ dtb-amlogic-5.15.88-happy-new-year.tar.gz ] file sha256sum check same. [ INFO ] (3/4) [ header-5.15.88-happy-new-year.tar.gz ] file sha256sum check same. [ INFO ] (4/4) [ modules-5.15.88-happy-new-year.tar.gz ] file sha256sum check same.

[ STEPS ] Start unpacking the kernel... [ INFO ] (1/4) Unpacking [ boot-5.15.88-happy-new-year.tar.gz ] done. tar (child): dtb-amlogic-5.15.88-happy-new-year.tar.gz: Cannot open: No such file or directory tar (child): Error is not recoverable: exiting now tar: Child returned status 2 tar: Error is not recoverable: exiting now [ ERROR ] /boot/dtb/amlogic files is missing.

OwnerCM commented 1 year ago

这是我重启前查看的磁盘情况,更新失败的原因会不会是空间不足? image

ophub commented 1 year ago

你的boot占用有点不合理,正常占用没那么大,你存放什么了?

Snip20230116_3 Snip20230116_5

serrj-sv commented 1 year ago

I have the same issue on freshly installed X96 Max Plus2

root@nvr:/boot# uname -a
Linux nvr 5.15.87-happy-new-year #1 SMP PREEMPT Fri Jan 13 13:21:09 CST 2023 aarch64 GNU/Linux
root@nvr:/boot# armbian-update
[ STEPS ] Ready to update, please wait...
[ STEPS ] Start initializing the environment...
[ INFO ] Armbian PLATFORM: [ amlogic ]
[ INFO ] Set the kernel name: [  ]
[ INFO ] Set the kernel directory: [ stable ]
[ INFO ] Current version: 5.15.87, Latest version: 5.15.88
[ STEPS ] Start downloading the kernel from [ https://github.com/ophub/kernel/tree/main/pub/stable/5.15.88 ]...
A    .
A    boot-5.15.88-happy-new-year.tar.gz
A    dtb-allwinner-5.15.88-happy-new-year.tar.gz
A    dtb-amlogic-5.15.88-happy-new-year.tar.gz
A    dtb-rockchip-5.15.88-happy-new-year.tar.gz
A    header-5.15.88-happy-new-year.tar.gz
A    modules-5.15.88-happy-new-year.tar.gz
A    sha256sums
Exported revision 706.

[ STEPS ] Start checking the kernel...
[ INFO ] Kernel name: [ 5.15.88-happy-new-year ]
[ INFO ] K510: [ 0 ]
[ INFO ] Enable sha256sum checking...
[ INFO ] (1/4) [ boot-5.15.88-happy-new-year.tar.gz ] file sha256sum check same.
[ INFO ] (2/4) [ dtb-amlogic-5.15.88-happy-new-year.tar.gz ] file sha256sum check same.
[ INFO ] (3/4) [ header-5.15.88-happy-new-year.tar.gz ] file sha256sum check same.
[ INFO ] (4/4) [ modules-5.15.88-happy-new-year.tar.gz ] file sha256sum check same.

[ STEPS ] Start unpacking the kernel...
[ INFO ] (1/4) Unpacking [ boot-5.15.88-happy-new-year.tar.gz ] done.
tar (child): dtb-amlogic-5.15.88-happy-new-year.tar.gz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
[ ERROR ] /boot/dtb/amlogic files is missing.
root@nvr:/boot#
ophub commented 1 year ago

我反复更新了5.15.87 -- 5.15.88几次,都可以正常下载更新。你检查下/boot下多了什么,删除不用的占用。

Snip20230116_6 Snip20230116_7

ophub commented 1 year ago

因为加了md5校验,所以文件是完整的才更新,所以更新失败很少见到。boot基本上是等量替换,占用空间应该不会有大的增长。

我想了想,以后要不要在更新前先备份一下原内核,这样失败了就自动还原。

OwnerCM commented 1 year ago

你的boot占用有点不合理,正常占用没那么大,你存放什么了?

Snip20230116_3 Snip20230116_5

一开始只boot占用40%,是更新操作后占用85%的

OwnerCM commented 1 year ago

因为加了md5校验,所以文件是完整的才更新,所以更新失败很少见到。boot基本上是等量替换,占用空间应该不会有大的增长。

我想了想,以后要不要在更新前先备份一下原内核,这样失败了就自动还原。

我现在的问题是重启无法开机了,请问这种情况是不是只能重新刷机?

ophub commented 1 year ago

u盘刷系统,从U盘启动后,把emmc挂载到U盘的某个目录,然后手动把内核解压到对应的目录即可修复。

OwnerCM commented 1 year ago

u盘刷系统,从U盘启动后,把emmc挂载到U盘的某个目录,然后手动把内核解压到对应的目录即可修复。

请教一些,手动把内核解压到对应目录是不是就更新过程中的4个文件?另外我是否可以自己把U盘系统的boot目录cp到emmc中? 我看到你的更新使用了参数-k,我和上面的同学失败都是没有使用参数,会不会和这个有关系?

ophub commented 1 year ago

-k是可选参数,用于指定固定版本的内核,不使用就是自动更新为最新。

https://github.com/ophub/amlogic-s9xxx-armbian/blob/f864a9826edf1a93f0a36c79d273eec430281c9b/build-armbian/armbian-files/common-files/usr/sbin/armbian-update#L291

看脚本里面的更新方法

serrj-sv commented 1 year ago

I found why its happening

armbian:/boot:# armbian-update

You should not start an update while in /boot directory, go to home for example (cd ~). Because files are downloaded in current dir and /boot partition is already very small: https://github.com/ophub/amlogic-s9xxx-armbian/blob/f864a9826edf1a93f0a36c79d273eec430281c9b/build-armbian/armbian-files/common-files/usr/sbin/armbian-update#L41

ophub commented 1 year ago

Yes, usually do not write other files into /boot, this is the boot partition, and some boxes have less space

ophub commented 1 year ago

https://github.com/ophub/amlogic-s9xxx-armbian/commit/ee6b30a7e3fda19045c640d5d2f16839fa45b22b

我升级了一下内核更新工具,现在使用在线下载时将保存在/tmp/下的临时目录。使用当前目录下的本地内核进行更新前,也会先把内核移动到/tmp/下的临时目录。这样避免了有人可能在/boot下执行内核下载更新时,空间不足的问题。

使用armbian-sync可以把这个最新的内核更新工具同步更新到本地。

Snip20230117_2

Snip20230117_3

OwnerCM commented 1 year ago

-k是可选参数,用于指定固定版本的内核,不使用就是自动更新为最新。

https://github.com/ophub/amlogic-s9xxx-armbian/blob/f864a9826edf1a93f0a36c79d273eec430281c9b/build-armbian/armbian-files/common-files/usr/sbin/armbian-update#L291

看脚本里面的更新方法

O大,很抱歉,尝试失败了,我再次把当初使用的U盘进行引导,并将boot目录覆盖到emmc的boot目录,但是未成功,依旧无法启动,还没弄清原因,想跟你确认下这种方式是否可行?

ophub commented 1 year ago

u盘启动后,挂载/dev/mmcblk2p1 和p2到U盘中的某个目录,删除挂载的目标中的以下目录,复制U盘中同路径的替换。

/usr/lib/modules/ /boot/ (除uEnv.txt)

OwnerCM commented 1 year ago

u盘启动后,挂载/dev/mmcblk2p1 和p2到U盘中的某个目录,删除挂载的目标中的以下目录,复制U盘中同路径的替换。

/usr/lib/modules/ /boot/ (除uEnv.txt)

uEnv.txt文件我已经替换了,哭晕,现在启动的报错如下:稍后我替换下modules目录后再看看 1674563652888

ophub commented 1 year ago

uEnv.txt里面有UUID 你可以从 emmc里的/etc/fstab文件里看一下值,改到emmc的uEnv.txt里。

只要上面两个目录对就可以启动

OwnerCM commented 1 year ago

uEnv.txt里面有UUID 你可以从 emmc里的/etc/fstab文件里看一下值,改到emmc的uEnv.txt里。

只要上面两个目录对就可以启动

非常感谢,从上面的报错已经能看到UUID了,我查看了uEnv.txt的UUID和fatab的UUID是一致的,但是启动报错的确是报boot未找到。 另外如果不得不重装的情况下,请问是否有方法保留数据的方式重装系统。

ophub commented 1 year ago

不用重装,更新内核就是/boot和/usr/lib/modules这两个目录(还有一个/usr/src/linux-headers-*和启动无关了,不自定义编译驱动用不到,可忽略)的文件换了一套新的。你手动更换和脚本更换结果是一样的,只要删了原来的,复制新的肯定可以。

OwnerCM commented 1 year ago

不用重装,更新内核就是/boot和/usr/lib/modules这两个目录(还有一个/usr/src/linux-headers-*和启动无关了,不自定义编译驱动用不到,可忽略)的文件换了一套新的。你手动更换和脚本更换结果是一样的,只要删了原来的,复制新的肯定可以。

OK了,感谢O大春节期间还这么及时的答复,祝O大新年快乐,事业蒸蒸日上!!!

ophub commented 1 year ago

恭喜你,力挽狂澜救金砖,新年更上一层楼。