sami Posted August 7, 2024 Posted August 7, 2024 hello guys, i ve been lately working with nanopi-r5s which comes with a default openwrt os installed on EMMC. but i prefer working on the armbian images. that is why i installed debian 12 bookworm from https://www.armbian.com/nanopi-r5s/ anyway, r5s refuses to boot from sd card for no matter what. until i corrupted the emmc by mistake(i started flashing a default image to emmc but then took the power off before it is done). so now it boots from sd card. but now when m trying to install the image from sd card to emmc through armbian-install. it only shows option 5 and 6. as if it can not detect the emmc. so what m trying to figure out is: how to force nanopi r5s to boot from sd card even though there is openwrt at emmc and how then could i flash my sd os to the emmc. thanks in advance 0 Quote
going Posted August 7, 2024 Posted August 7, 2024 On 8/7/2024 at 6:42 AM, sami said: trying to install the image from sd card to emmc through armbian-install. it only shows option 5 and 6. Expand Please try to replace the /usr/sbin/armbian-install file with this new version: packages/bsp/common/usr/sbin/armbian-install Please show the output of the `lsblk` command. Please post screenshots of the armbian-install dialog. 1 Quote
sami Posted August 7, 2024 Author Posted August 7, 2024 (edited) lsblk: lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS mmcblk1 179:0 0 28.9G 0 disk └─mmcblk1p1 179:1 0 1.2G 0 part mmcblk1boot0 179:32 0 4M 1 disk mmcblk1boot1 179:64 0 4M 1 disk mmcblk0 179:96 0 29.1G 0 disk └─mmcblk0p1 179:97 0 28.8G 0 part /var/log.hdd / zram0 251:0 0 1.8G 0 disk [SWAP] zram1 251:1 0 50M 0 disk /var/log zram2 251:2 0 0B 0 disk and there i posted three screenshots of the output of armbian-install where i choose second option and then i confirmed then it says done in less than one second. and i did replace the file with what u proposed. editted: sorry m adding this extra picture: Edited August 7, 2024 by sami 0 Quote
going Posted August 7, 2024 Posted August 7, 2024 On 8/7/2024 at 10:21 AM, sami said: and i did replace the file with what u proposed. Expand It looks very strange. It looks like this to me: leo@bananapim3:~$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS sda 8:0 0 0B 0 disk mmcblk0 179:0 0 7,4G 0 disk └─mmcblk0p1 179:1 0 7,4G 0 part /var/log.hdd / mmcblk2 179:8 0 7,3G 0 disk └─mmcblk2p1 179:9 0 7,2G 0 part mmcblk2boot0 179:16 0 4M 1 disk mmcblk2boot1 179:24 0 4M 1 disk zram0 253:0 0 1005,7M 0 disk [SWAP] zram1 253:1 0 50M 0 disk /var/log zram2 253:2 0 0B 0 disk leo@bananapim3:~$ bash --version GNU bash, версия 5.2.15(1)-release (arm-unknown-linux-gnueabihf) leo@bananapim3:~$ lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Armbian_community 24.8.0-trunk.104 bookworm Release: 12 Codename: bookworm I booted from the SD card and sudo armbian-install 0 Quote
going Posted August 7, 2024 Posted August 7, 2024 @sami Please publish your OS and BASH version. leo@bananapim3:~$ lsblk --version lsblk from util-linux 2.38.1 1 Quote
sami Posted August 7, 2024 Author Posted August 7, 2024 root@nanopi-r5s:/usr/sbin# lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Armbian 24.8.0-trunk.525 bookworm Release: 12 Codename: bookworm root@nanopi-r5s:~# bash --version GNU bash, version 5.2.15(1)-release (aarch64-unknown-linux-gnu) Copyright (C) 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> 0 Quote
going Posted August 7, 2024 Posted August 7, 2024 On 8/7/2024 at 11:19 AM, sami said: Codename: bookworm Expand I'm shocked. We use the same versions of the system packages. There is something else that needs to be checked. Wait for me to type it now. 0 Quote
sami Posted August 7, 2024 Author Posted August 7, 2024 i believe it has to do with the hardware m using. i just cant figure it out as well. 0 Quote
going Posted August 7, 2024 Posted August 7, 2024 On 8/7/2024 at 11:50 AM, sami said: i believe it has to do with the hardware m using. i just cant figure it out as well. Expand No Create a check-command.sh file: #!/bin/bash cm="ls grep awk blkid tr lsblk xargs sync mount df head cat sed mktemp nl chroot lsof parted partprobe mkfs fdisk" for c in $cm do echo "# $c =: $(command -v $c)" done echo "=====" root_uuid=$(sed -e 's/^.*root=//' -e 's/ .*$//' < /proc/cmdline) root_partition=$(blkid | tr -d '":' | grep "${root_uuid}" | awk '{print $1}') root_partition_name=$(echo $root_partition | sed 's/\/dev\///g') root_partition_device_name=$(lsblk -ndo pkname $root_partition) root_partition_device=/dev/$root_partition_device_name emmccheck=$(ls -d -1 /dev/mmcblk* 2>/dev/null | grep -w 'mmcblk[0-9]' | grep -v "$root_partition_device") diskcheck=$(lsblk -l | awk -F" " '/ disk / {print $1}' | grep -E '^sd|^nvme|^mmc' | grep -v "$root_partition_device_name" | grep -v boot) echo "root_partition_device=$root_partition_device" echo "emmccheck=$emmccheck" echo "diskcheck=$diskcheck" and make it executable. chmod +x check-command.sh Run on board and publish sudo ./check-command.sh 1 Quote
going Posted August 7, 2024 Posted August 7, 2024 leo@bananapim3:~$ sudo ./check-command.sh [sudo] пароль для leo: # ls =: /usr/bin/ls # grep =: /usr/bin/grep # awk =: /usr/bin/awk # blkid =: /usr/sbin/blkid # tr =: /usr/bin/tr # lsblk =: /usr/bin/lsblk # xargs =: /usr/bin/xargs # sync =: /usr/bin/sync # mount =: /usr/bin/mount # df =: /usr/bin/df # head =: /usr/bin/head # cat =: /usr/bin/cat # sed =: /usr/bin/sed # mktemp =: /usr/bin/mktemp # nl =: /usr/bin/nl # chroot =: /usr/sbin/chroot # lsof =: /usr/bin/lsof # parted =: /usr/sbin/parted # partprobe =: /usr/sbin/partprobe # mkfs =: /usr/sbin/mkfs # fdisk =: /usr/sbin/fdisk ===== root_partition_device=/dev/mmcblk0 emmccheck=/dev/mmcblk2 diskcheck=sda mmcblk2 0 Quote
sami Posted August 7, 2024 Author Posted August 7, 2024 this is my output!!!! very strange!!!!! root@nanopi-r5s:~# sudo ./check-command.sh # ls =: /usr/bin/ls # grep =: /usr/bin/grep # awk =: /usr/bin/awk # blkid =: /usr/sbin/blkid # tr =: /usr/bin/tr # lsblk =: /usr/bin/lsblk # xargs =: /usr/bin/xargs # sync =: /usr/bin/sync # mount =: /usr/bin/mount # df =: /usr/bin/df # head =: /usr/bin/head # cat =: /usr/bin/cat # sed =: /usr/bin/sed # mktemp =: /usr/bin/mktemp # nl =: /usr/bin/nl # chroot =: /usr/sbin/chroot # lsof =: /usr/bin/lsof # parted =: /usr/sbin/parted # partprobe =: /usr/sbin/partprobe # mkfs =: /usr/sbin/mkfs # fdisk =: /usr/sbin/fdisk ===== root_partition_device=/dev/mmcblk1 mmcblk0 emmccheck= diskcheck= 0 Quote
going Posted August 7, 2024 Posted August 7, 2024 On 8/7/2024 at 12:11 PM, sami said: root_partition_device=/dev/mmcblk1 Expand Is your OS loaded from eMMC? Your OS is loaded from eMMC!! Insert the SD card on running OS and run armbian-install 0 Quote
sami Posted August 7, 2024 Author Posted August 7, 2024 I inserted my sd card on a new r5s which contains a friendlywrt os on its emmc, but the problem is that i can not choose to boot from sd card!!!! it always boots from emmc! and how is it loaded from emmc? since whenever i remove the sd card then it wont boot again! at all! 0 Quote
going Posted August 7, 2024 Posted August 7, 2024 On 8/7/2024 at 12:28 PM, sami said: I inserted my sd card on a new r5s which contains a friendlywrt os on its emmc, but the problem is that i can not choose to boot from sd card!!!! it always boots from emmc! and how is it loaded from emmc? since whenever i remove the sd card then it wont boot again! at all! Expand Let's try to figure out where you are. Boot from the SD and print the output of the df -h command 0 Quote
sami Posted August 7, 2024 Author Posted August 7, 2024 that;s what m trying to say bro. this r5s would not boot from any external environment if the emmc is loaded with an OS. it only booted from sd card because i corrupted the emmc by mistake. well this is exactly my main concern: how could i force boot from an external environment if the emmc is loaded with the default friendlywrt os? 0 Quote
going Posted August 7, 2024 Posted August 7, 2024 On 8/7/2024 at 12:37 PM, sami said: it only booted from sd card Expand Boot from the SD. On 8/7/2024 at 10:21 AM, sami said: lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS mmcblk1 179:0 0 28.9G 0 disk └─mmcblk1p1 179:1 0 1.2G 0 part mmcblk1boot0 179:32 0 4M 1 disk mmcblk1boot1 179:64 0 4M 1 disk mmcblk0 179:96 0 29.1G 0 disk └─mmcblk0p1 179:97 0 28.8G 0 part /var/log.hdd / Expand Try to clear (write zeros) the first 10 megabytes on the /dev/mmcblk1 disk. Try the installation again from the CD. 0 Quote
going Posted August 8, 2024 Posted August 8, 2024 On 8/7/2024 at 12:37 PM, sami said: that;s what m trying to say bro. Expand If your device is in the same condition, I will ask you to provide some additional information about the downloaded operating system. Your case is unique. Your device and mine have the same OS and the same set of packages installed. But the armbian-install script behaves completely differently and crashes in your case. I need to understand why this is happening and correct the erroneous behavior. Please post the output of the following commands: cat /proc/cmdline | tr " " "\n" lsblk -Py df -h sudo blkid On 8/7/2024 at 12:37 PM, sami said: how could i force boot from an external environment if the emmc is loaded with the default friendlywrt os? Expand 1) You can use a utility from the manufacturer of the chip or device. If this software exists. 2) You can become a hacker, listen to the following harmful tips, or find them on the Internet: Boot the device in any way and get access to the command line with superuser rights. The bootloader, u-boot or other, can be written in whole or in parts to three locations on the eMMC: /dev/mmcblkXboot0 /dev/mmcblkXboot1 /dev/mmcblkX X - This is the number for your eMMC In order for the device not to boot from eMMC, it is necessary to clear those areas in which parts of the bootloader can be placed. sudo su echo 0 > /sys/block/mmcblkXboot0/force_ro dd if=/dev/zero of=/dev/mmcblkXboot0 bs=1M count=4 echo 0 > /sys/block/mmcblkXboot1/force_ro dd if=/dev/zero of=/dev/mmcblkXboot1 bs=1M count=4 dd if=/dev/zero of=/dev/mmcblkX bs=1M count=10 After these steps, your device will be able to boot from the SD card correctly. You can also use the helpful tips described in great detail in the wiki documentation for NanoPi R5S. With respect 1 Quote
sami Posted August 8, 2024 Author Posted August 8, 2024 i will try this tomorrow and will update. big thanks for all of that infos. i hope this would work! 0 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.