2026年3月27日 星期五

Raise3D 修改 root 密碼

Raise3D N2 的主板。



重開後,看到 U-Boot 訊息(Hit any key to stop autoboot: 0)就代表你已經掌握了這台機器的「生殺大權」。既然不知道 Linux 層級的帳號密碼,我們可以繞過登入程序,直接從 U-Boot 進入 Single User Mode 來重設密碼。 

1. 進入 U-Boot 指令模式

將板子重啟(斷電再通電)。

在看到 Hit any key to stop autoboot 倒數到 0 之前,趕快在鍵盤按下 任意鍵(通常是 Enter 或空白鍵)。

如果成功,提示字元會變成 MX6-SabreSD>(或是類似的標籤)。

使用 printenv 列出環境變數。

----------
=> setenv mmcargs 'setenv bootargs console=${console},${baudrate} root=${mmcroot} init=/bin/sh video=mxcfb0:dev=ldb,if=RGB24,bpp=32 consoleblank=0'
=> run mmcboot
Booting from mmc ...
reading imx6q-sabresd.dtb
49185 bytes read in 20 ms (2.3 MiB/s)
Bad Linux ARM zImage magic!
==>
----------

出現 Bad Linux ARM zImage magic! 這個錯誤,通常是因為 U-Boot 在載入核心鏡像(zImage)時發生了位移或是抓錯了檔案位置。

觀察你的 printenv,這塊板子預設會先執行 loadbootscript(去讀 SD 卡或 eMMC 上的 boot.scr)。當我們手動改動 mmcargs 並執行 run mmcboot 時,可能因為環境變數中的位址(如 ${loadaddr})與實際檔案不匹配,導致 U-Boot 讀到了破碎的資料。

既然自動腳本 run mmcboot 失敗,我們改用最原始、最手動的方式來載入核心,這樣最精準。

手動啟動步驟 (Manual Boot)

-----------
=> mmc dev 2
mmc2(part 0) is current device
=> fatload mmc 2:1 ${loadaddr} zImage
reading zImage
5370320 bytes read in 143 ms (35.8 MiB/s)
=> fatload mmc 2:1 ${fdt_addr} imx6q-sabresd.dtb
reading imx6q-sabresd.dtb=> mmc dev 2
mmc2(part 0) is current device
=> fatload mmc 2:1 ${loadaddr} zImage
reading zImage
5370320 bytes read in 143 ms (35.8 MiB/s)
=> fatload mmc 2:1 ${fdt_addr} imx6q-sabresd.dtb
reading imx6q-sabresd.dtb
49185 bytes read in 19 ms (2.5 MiB/s)
=> setenv bootargs console=ttymxc0,115200 root=/dev/mmcblk3p2 rootwait rw init=/bin/sh video=mxcfb0:dev=ldb,if=RGB24,bpp=32
=> bootz ${loadaddr} - ${fdt_addr}

49185 bytes read in 19 ms (2.5 MiB/s)
=> setenv bootargs console=ttymxc0,115200 root=/dev/mmcblk3p2 rootwait rw init=/bin/sh video=mxcfb0:dev=ldb,if=RGB24,bpp=32
=> bootz ${loadaddr} - ${fdt_addr}
... 以下是啟動訊息 ...
Kernel image @ 0x12000000 [ 0x000000 - 0x51f1d0 ]
## Flattened Device Tree blob at 18000000
   Booting using the fdt blob at 0x18000000
   Using Device Tree in place at 18000000, end 1800f020
switch to ldo_bypass mode!

Starting kernel ...

Booting Linux on physical CPU 0x0
....
....
....
journald starting.  Commit interval 5 seconds
EXT3-fs (mmcblk3p2): using internal journal
EXT3-fs (mmcblk3p2): recovery complete
EXT3-fs (mmcblk3p2): mounted filesystem with ordered data mode
VFS: Mounted root (ext3 filesystem) on device 179:2.
devtmpfs: mounted
Freeing unused kernel memory: 296K (80c02000 - 80c4c000)
sh: cannot set terminal process group (-1): Inappropriate
-----------

修改密碼,重新啟動。

-------------
-- 掛載文件系統為「可讀寫」
# mount -o remount,rw /
-- 修改 root 密碼
# passwd root
-- 確保資料確實寫入 eMMC
# sync
# reboot -f
-------------

重啟後,就可以進入了。

----------
一直出現這樣的訊息,很擾人,SSH又進不去,console 的資訊一下就被洗掉
"[NetworkCheck Task]" gateway invalid, check wifi info valid end 1
[PaintMain] network status change "eth0" false 1 "" "" "" ""

修改 /etc/rc.local,把最後一行啟動指令關掉
#/opt/Raise3D/MXCUI-start.sh
-------------

現代電腦(SSH 客戶端)認為 ssh-rsa(基於 SHA-1)已經不夠安全,所以預設停用了它;而這塊板子上的 Dropbear 版本較舊,只提供這種加密方式。

------------
從遠端登入,出現下面的錯誤

$ ssh root@192.168.66.55

Unable to negotiate with 192.168.66.55 port 22: no matching host key type found. Their offer: ssh-rsa

-- 在連線時手動允許這台機器使用舊的密鑰類型
$ ssh -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa root@192.168.66.55
------------














沒有留言:

張貼留言

網誌存檔