hi
我想使用RAM Disk,并在里面加入e2fsck修复硬盘的方式,我现在有点疑惑。
我已经在Linux_for_tegra/bootloader_l4t_initrd.img拷贝并解压出,并讲e2fsck拷贝到bin下,然后修改init文件在最下面加入修复指令如下
最后打包成新的img
我有几个疑问如下
1、是否在init加入修复指令有效? 我应该如何查看加入的指令生效?可以通过串口查看打印日志吗?
2、如何重新烧录l4t_initrd.img?
3、如果在不刷机的情况下,直接在运行的系统中替换img?
Flashing Support — NVIDIA Jetson Linux Developer Guide 1 documentation
根据文档中描述,把img拷贝到/boot下即可,但是我看系统中boot下原本并没有l4t_initrd.img
参考如下
Hi,
If the device cannot be flashed/booted, please refer to the page to get uart log from the device:
Jetson/General debug - eLinux.org
And get logs of host PC and Jetson device for reference. If you are using custom board, you can compare uart log of developer kit and custom board to get more information.
Also please check FAQs:
Jetson AGX Orin FAQ
If possible, we would suggest follow quick start in developer guide to re-flash the system:
Quick Start — NVIDIA Jetson Linux Developer Guide 1 documentation
And see if the issue still persists on a clean-flashed system.
Thanks!
Question1
- 有效
echo ${Message} > /dev/kmsg
會在 dmesg
中出現
- 也可以透過 serial console log 看到
Question 2
Question3
For example:
[ 8.292715] Root device found:
[ 8.300012] start to e2fsck the root device
[ 8.305593] e2fsck 1.47.2-rc1 (28-Nov-2024)
[ 8.307146] usb 1-3: new full-speed USB device number 2 using tegra-xusb
[ 8.318300] /dev/mmcblk0p1: recovering journal
[ 8.399562] Setting free
[ 8.399571] inode
[ 8.402270] s count to
[ 8.404273] 3362875
[ 8.406793] (was
[ 8.408969] 3362650
[ 8.411037] )
[ 8.414815] Setting free
[ 8.416405] printk: e2fsck: 8 output lines suppressed due to ratelimiting
[ 8.426384] finish the e2fsck
謝謝
好的,目前已经基本可以调试、打印和输出,但是现在没有办法确保修复指令是否被执行。
我将e2fsck可执行文件拷贝到了bin下

然后我在init里面加入了e2fsck加入命令如下
mmc=$(e2fsck -y /dev/mmcblk0p1)
nvme=$(e2fsck -y /dev/nvme0n1p1)
test=$(ls)
echo “e2fsck /dev/mmcblkOp1:” > /dev/kmsg;
echo “${mmc}” > /dev/kmsg;
echo “e2fsck /dev/nvme0n1p1:” > /dev/kmsg;
echo “${nvme}” > /dev/kmsg;
echo “test:” > /dev/kmsg;
echo “${test}” > /dev/kmsg;
但是,最后并没有看到e2fsck指令有输出信息,串口日志如下
[ 12.042586] EXT4-fs (mmcblk0p1): mounted filesystem with ordered data mode. Opts: (null)
[ 12.054310] Rootfs mounted over mmcblk0p1
[ 12.070607] e2fsck /dev/mmcblkOp1:
[ 12.074157]
[ 12.075711] e2fsck /dev/mmcblkOp1:
[ 12.079246]
[ 12.080795] test:
[ 12.082801] bin
[ 12.082801] boot
[ 12.082801] data
[ 12.082801] dev
[ 12.082801] etc
[ 12.082801] home
[ 12.082801] lib
[ 12.082801] lost+found
[ 12.082801] media
[ 12.082801] mnt
[ 12.082801] opt
[ 12.082801] proc
[ 12.082801] root
[ 12.082801] run
[ 12.082801] sbin
[ 12.082801] srv
[ 12.082801] sys
[ 12.082801] tmp
[ 12.082801] usr
[ 12.118122] var
[ 12.119937] jyh build initrd
[ 12.122929] Switching from initrd to actual rootfs
[ 12.245074] systemd[1]: System time before build time, advancing clock.
很奇怪,这e2fsck是未执行吗?
試試 2&1
來看 standard error 的訊息
hi,
是否有可能与我加入的位置有关系?我在init尾部加入,局部代码如下.
# Disable luks-srv TA
nvluks-srv-app -n > /dev/null 2>&1;
echo "Rootfs mounted over ${rootdev}" > /dev/kmsg;
mount -o bind /proc /mnt/proc;
mount -o bind /sys /mnt/sys;
mount -o bind /dev/ /mnt/dev;
cd /mnt;
cp /etc/resolv.conf etc/resolv.conf
mmc=$(e2fsck -y /dev/mmcblk0p1)
nvme=$(e2fsck -y /dev/nvme0n1p1)
test=$(ls)
echo "e2fsck /dev/mmcblkOp1:" > /dev/kmsg;
echo "${mmc}" > /dev/kmsg;
echo "e2fsck /dev/nvmeOn1p1:" > /dev/kmsg;
echo "${nvme}" > /dev/kmsg;
echo "test:" > /dev/kmsg;
echo "${test}" > /dev/kmsg;
echo "jyh build initrd" > /dev/kmsg;
echo "Switching from initrd to actual rootfs" > /dev/kmsg;
mount --move . /
exec chroot . /sbin/init 2;
2、不好意思,我不太清楚怎么使用2&1,是mmc=$(e2fsck -y /dev/mmcblk0p1 2&1)
这样吗?
我的做法是
/usr/sbin/e2fsck -y /dev/mmcblk0p1 > /dev/kmsg 2>&1
可以參考一下
謝謝
ok。thanks,应该是拷贝的文件在ram system里面出现点问题导致未执行
[ 11.595751] /usr/sbin/e2fsck: error while loading shared libraries: libuuid.so.1: cannot open shared object file: No such file or directory
[ 11.570667] EXT4-fs (mmcblk0p1): mounted filesystem with ordered data mode. Opts: (null)
[ 11.581965] Rootfs mounted over mmcblk0p1
[ 11.595751] /usr/sbin/e2fsck: error while loading shared libraries: libuuid.so.1: cannot open shared object file: No such file or directory
[ 11.608763] jyh build initrd
[ 11.611783] Switching from initrd to actual rootfs
你的e2fsck
是在host上(x86) 還是在 device上 (aarch64) build?
是orin上的
root@mos:/tmp/temp2# file bin/e2fsck
bin/e2fsck: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, BuildID[sha1]=6b4fc33f7ebb6f6a764aa29603fa9357ac352db8, for GNU/Linux 3.7.0, stripped
您可以嘗試用
# In AGX Orin
$ldd /usr/sbin/e2fsck
linux-vdso.so.1 (0x0000ffff826ac000)
libblkid.so.1 => /lib/aarch64-linux-gnu/libblkid.so.1 (0x0000ffff82530000)
libuuid.so.1 => /lib/aarch64-linux-gnu/libuuid.so.1 (0x0000ffff82510000)
libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000ffff82360000)
/lib/ld-linux-aarch64.so.1 (0x0000ffff82673000)
來確認 initrd 上有沒有缺少相關的shared library
Thanks
1 Like
谢谢,解决了share lib,和我猜测的一样,不应该在后面加入这段指令,因为在后面就已经mount上rootfs了
[ 12.030151] EXT4-fs (mmcblk0p1): mounted filesystem with ordered data mode. Opts: (null)
[ 12.041728] Rootfs mounted over mmcblk0p1
[ 12.056285] e2fsck 1.45.5 (07-Jan-2020)
[ 12.060337] /dev/mmcblk0p1 is mounted.
[ 12.064205] e2fsck: Cannot continue, aborting.
[ 12.064205]
[ 12.064205]
[ 12.072034] jyh build initrd
1 Like
我刚刚一直使用的initrd文件,也就是修改后编译替换initrd文件,可以一直用initrd文件而不修改/boot/l4t_initrd.img文件吗?因为感觉只要在/boot/extlinux/extlinux.conf文件中规定好文件名称即可。
可以
不過最好留一個backup entry。如果您的custom initrd crash的話,可能系統無法開機
謝謝
请问这是什么意思呢?不太理解具体追加什么?下面是我的conf文件截图,谢谢
把 LABEL backup
那邊 uncomment 掉
會在 boot up 時顯示如下
L4T boot options
0: primary kernel
1: backup kernel
Press 0-1 to boot selection within 3.0 seconds.
Press any other key to boot default (Option: 0)
您可以在serial console 輸入keyboard選擇您要boot up的entry
如果 primary failed 還有 backup 可以進入
hi,
请问我如果将LABEL backup进行uncomment,那么是否每次开机的时候都要使用键盘进行选择?
$cat /boot/extlinux/extlinux.conf
TIMEOUT 30
DEFAULT primary
您可以更改default
是默认会使用 primary进入,如果系统出现crash之后才会进入backup?
系統crash您就要重啟並在L4T boot options
選擇backup