amouiche / qnap_mtd_resize_for_bullseye

Script for resizing MTD partitions on a QNAP device in order to be able to upgrade from buster to bullseye
GNU General Public License v2.0
53 stars 11 forks source link

Upgrade from Buster to Bullseye failed. #9

Closed lpaolini closed 2 years ago

lpaolini commented 2 years ago

Hi, first of all many thanks a lot for providing this script!

However, I have problem. I realized Bullseye was not supported on QNAP only at the end of the upgrade from Buster, when I got the following message:

Processing triggers for initramfs-tools (0.140) ...
update-initramfs: Generating /boot/initrd.img-5.10.0-9-marvell
kirkwood-qnap: machine: QNAP TS219 family
Using DTB: kirkwood-ts219-6282.dtb
Installing /usr/lib/linux-image-5.10.0-9-marvell/kirkwood-ts219-6282.dtb into /boot/dtbs/5.10.0-9-marvell/./kirkwood-ts219-6282.dtb
Taking backup of kirkwood-ts219-6282.dtb.
Installing new kirkwood-ts219-6282.dtb.
Installing /usr/lib/linux-image-5.10.0-9-marvell/kirkwood-ts219-6282.dtb into /boot/dtbs/5.10.0-9-marvell/./kirkwood-ts219-6282.dtb
Taking backup of kirkwood-ts219-6282.dtb.
Installing new kirkwood-ts219-6282.dtb.
flash-kernel: installing version 5.10.0-9-marvell
Not enough space for kernel in MTD 'Kernel' (need 2448968 but is actually 2097152).
run-parts: /etc/initramfs/post-update.d//flash-kernel exited with return code 1
dpkg: error processing package initramfs-tools (--configure):
 installed initramfs-tools package post-installation script subprocess returned error exit status 1
Processing triggers for libgdk-pixbuf-2.0-0:armel (2.42.2+dfsg-1) ...
Errors were encountered while processing:
 initramfs-tools
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)

I tried to run your script in dry mode, but it failed because both fw_setenv and fw_printenv required -V (vs -v) to check the version. I updated the script and it succeeded:

    SUCCESS. You can reboot now.

    Notes:
    - Don't perform kernel or system update before the next reboot...
      so don't wait too long.
    - Consider compressing initrd with 'xz' to optimize the size with:

        echo "COMPRESS=xz" > /etc/initramfs-tools/conf.d/compress

I thought rebooting would have failed at this point, so I tried to complete the upgrade by running apt full-upgrade once again, but I got the same error message:

Not enough space for kernel in MTD 'Kernel' (need 2448968 but is actually 2097152).

So, I rebooted and, as expected, it failed booting:

### Booting image at 00800000
Bad Magic Number

What can I do now? :-( I'm on a QNAP TS-221.

Thanks in advance for any help you can provide.

amouiche commented 2 years ago

Le 16/11/2021 à 11:32, Luca Paolini a écrit :

Hi, first of all many thanks a lot for providing this script!

However, I have problem. I realized Bullseye was not supported on QNAP only at the end of the upgrade from Buster, when I got the following message:

Processing triggers for initramfs-tools (0.140) ... update-initramfs: Generating /boot/initrd.img-5.10.0-9-marvell kirkwood-qnap: machine: QNAP TS219 family Using DTB: kirkwood-ts219-6282.dtb Installing /usr/lib/linux-image-5.10.0-9-marvell/kirkwood-ts219-6282.dtb into /boot/dtbs/5.10.0-9-marvell/./kirkwood-ts219-6282.dtb Taking backup of kirkwood-ts219-6282.dtb. Installing new kirkwood-ts219-6282.dtb. Installing /usr/lib/linux-image-5.10.0-9-marvell/kirkwood-ts219-6282.dtb into /boot/dtbs/5.10.0-9-marvell/./kirkwood-ts219-6282.dtb Taking backup of kirkwood-ts219-6282.dtb. Installing new kirkwood-ts219-6282.dtb. flash-kernel: installing version 5.10.0-9-marvell Not enough space for kernel in MTD 'Kernel' (need 2448968 but is actually 2097152). run-parts: /etc/initramfs/post-update.d//flash-kernel exited with return code 1 dpkg: error processing package initramfs-tools (--configure): installed initramfs-tools package post-installation script subprocess returned error exit status 1 Processing triggers for libgdk-pixbuf-2.0-0:armel (2.42.2+dfsg-1) ... Errors were encountered while processing: initramfs-tools needrestart is being skipped since dpkg has failed E: Sub-process /usr/bin/dpkg returned an error code (1)
Yes, there is on ongoing work to make it compatible with Bullseye due

to a switch of uboot tools package.

||

I tried to run your script in dry mode, but it failed because both fw_setenv and fw_printenv required -V (vs -v) to check the version. I updated the script and it succeeded:

|SUCCESS. You can reboot now. Notes: - Don't perform kernel or system update before the next reboot... so don't wait too long. - Consider compressing initrd with 'xz' to optimize the size with: echo "COMPRESS=xz" > /etc/initramfs-tools/conf.d/compress |

I thought rebooting would have failed at this point, so I tried to complete the upgrade by running apt full-upgrade once again, but I got the same error message:

For clarification:

is that right ?

|Not enough space for kernel in MTD 'Kernel' (need 2448968 but is actually 2097152). |

So, I reboot and, as expected, it failed booting:

|### Booting image at 00800000 Bad Magic Number |

What can I do now? :-( I'm on a QNAP TS-221.

I guess that if you see this message, it means you have access to a serial port on uboot. Good news in this case, we just need to do manually what was not done by fw_setenv... Can you.

Regards, Arnaud

Thanks in advance for any help you can provide.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/amouiche/qnap_mtd_resize_for_bullseye/issues/9, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADXHI5C7VUX3OQBPRKA3LILUMIXK3ANCNFSM5ID4ZWVQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

cavokz commented 2 years ago

Hi, you did exactly the same I did with -v vs. -V and discovered in the worst way that fw_setenv on Bullseye is not backward compatible with older versions, it comes from a different code base. Further readings: https://github.com/sbabic/libubootenv/issues/18, https://groups.google.com/g/swupdate/c/tZMm_eTl9fE/m/RYqzpZM5DgAJ.

Your situation is a bit more complicated than mine in that, if I got it right, you also messed up with the content of the kernel partition. Do you have accessible MTD backup images? If so you can follow these instructions to boot via tftp: https://cyrius.com/debian/kirkwood/qnap/ts-219/uboot/.

lpaolini commented 2 years ago

Yes, I do have a backup of the MTD (in the form of flashable image) I made before I changed the MTD partitions by running the script in this project.

This is what I did for creating the backup:

modprobe mtdblock
cat /dev/mtdblock0 /dev/mtdblock4 /dev/mtdblock5 /dev/mtdblock1 /dev/mtdblock2 /dev/mtdblock3 > F_TS-219_current
lpaolini commented 2 years ago

To recap:

Yes, I got serial console.

cavokz commented 2 years ago

First of all, make a duplicate of all the backups you have and put them aside ;)

Yes, I do have a backup of the MTD (in the form of flashable image) I made before I changed the MTD partitions by running the script in this project.

The script also made a backup of the mtd partitions individually, would be easier to use that.

This is what I did for creating the backup:

modprobe mtdblock
cat /dev/mtdblock0 /dev/mtdblock4 /dev/mtdblock5 /dev/mtdblock1 /dev/mtdblock2 /dev/mtdblock3 > F_TS-219_current

All you need is kernel and initrd partitions. If all you have is this backup you need to slice them back to individual files.

lpaolini commented 2 years ago

This is the result of u-boot printenv:

         __  __                      _ _ 
        |  \/  | __ _ _ ____   _____| | | 
        | |\/| |/ _` | '__\ \ / / _ \ | | 
        | |  | | (_| | |   \ V /  __/ | | 
        |_|  |_|\__,_|_|    \_/ \___|_|_| 
 _   _     ____              _ 
| | | |   | __ )  ___   ___ | |_ 
| | | |___|  _ \ / _ \ / _ \| __| 
| |_| |___| |_) | (_) | (_) | |_ 
 \___/    |____/ \___/ \___/ \__|  ** LOADER ** 
 ** MARVELL BOARD: DB-88F6282A-BP LE TS-221 ,PHY=1.8v 

U-Boot 1.1.4 (Nov  2 2012 - 10:46:48) Marvell version: 3.5.3 

U-Boot code: 00600000 -> 0067FFF0  BSS: -> 006CD5C0 

Soc: MV88F6282 Rev 1CPU running @ 2000Mhz L2 running @ 500Mhz 
SysClock = 500Mhz , TClock = 200Mhz 

DRAM (DDR3) CAS Latency = 7 tRP = 7 tRAS = 20 tRCD=7 
DRAM CS[0] base 0x00000000   size 512MB 
DRAM CS[1] base 0x20000000   size 512MB 
DRAM Total size   1GB  16bit width 
Addresses 8M - 0M are saved for the U-Boot usage. 
Mem malloc Initialization (8M - 7M): Done 
[16384kB@f8000000] Flash: 16 MB 

CPU : Marvell Feroceon (Rev 1) 
USB 0: host mode 
PEX 0: PCI Express Root Complex Interface 
PEX interface detected Link X1 
PEX 1: PCI Express Root Complex Interface 
PEX interface detected Link X1 

Reset IDE: 
Marvell Serial ATA Adapter 
Integrated Sata device found 
[0 1 0]: Enable DMA mode (6) 
  Device 1 @ 0 1: 
Model: WDC WD2002FYPS-02W3B0                    Firm: 04.01G01 Ser#:      WD-WCAVY7358489 
            Type: Hard Disk 
            Supports 48-bit addressing 
            Capacity: 1907729.0 MB = 1863.0 GB (-387938128 x 512) 
[0,0]: device connected event received 

Net:   egiga0 [PRIME] 
Hit any key to stop autoboot:  0  
QNAP: Recovery Button pressed: 0 
Marvell>> printenv 
CASset=min 
MALLOC_len=1 
autoload=no 
baudrate=115200 
bootargs=console=ttyS0,115200 root=/dev/ram initrd=0xa00000,0x900000 ramdisk=34816 mem=768M 
bootargs           console=ttyS0,115200 root=/dev/ram initrd=0xb00000,0xc00000 ramdisk=34816 mem=768M cmdlinepart.mtdparts="spi0.0:512k@0(uboot)ro,3M@0x100000(Kernel),12M@0x400000(RootFS1),2M@0x200000(Kernel_legacy),256k@0x80000(U-Boot Config),256k@0xc0000(NAS Config)" mtdparts="spi0.0:512k@0(uboot)ro,3M@0x100000(Kernel),12M@0x400000(RootFS1),2M@0x200000(Kernel_legacy),256k@0x80000(U-Boot Config),256k@0xc0000(NAS Config)" 
bootargs_backup    console=ttyS0,115200 root=/dev/ram initrd=0xa00000,0x900000 ramdisk=34816 mem=768M 
bootcmd=uart1 0x68;cp.l 0xf8200000 0x800000 0x80000;cp.l 0xf8400000 0xa00000 0x240000;bootm 0x800000 
console=console=ttyS0,115200 
ethact=egiga0 
ethaddr=00:50:43:00:02:02 
ethmtu=1500 
ethprime=egiga0 
ipaddr=192.168.0.50 
loadaddr=0x02000000 
loads_echo=0 
netmask=255.255.255.0 
netretry=no 
rcvrip=169.254.100.100 
rootpath=/mnt/ARM_FS/ 
run_diag=yes 
serverip=192.168.0.1 
usb0Mode=host 
stdin=serial 
stdout=serial 
stderr=serial 
mainlineLinux=no 
enaMonExt=no 
enaCpuStream=no 
enaWrAllo=no 
pexMode=RC 
disL2Cache=no 
setL2CacheWT=yes 
disL2Prefetch=yes 
enaICPref=yes 
enaDCPref=yes 
sata_dma_mode=yes 
netbsd_en=no 
bootdelay=1 
disaMvPnp=no 
bootp_vendor_class=F_TS-221 
enaAutoRecovery=yes 
pcieTune=no 

Environment size: 1354/4092 bytes 
Marvell>>  
cavokz commented 2 years ago

This is the result of u-boot printenv:

         __  __                      _ _ 
        |  \/  | __ _ _ ____   _____| | | 
        | |\/| |/ _` | '__\ \ / / _ \ | | 
        | |  | | (_| | |   \ V /  __/ | | 
        |_|  |_|\__,_|_|    \_/ \___|_|_| 
 _   _     ____              _ 
| | | |   | __ )  ___   ___ | |_ 
| | | |___|  _ \ / _ \ / _ \| __| 
| |_| |___| |_) | (_) | (_) | |_ 
 \___/    |____/ \___/ \___/ \__|  ** LOADER ** 
 ** MARVELL BOARD: DB-88F6282A-BP LE TS-221 ,PHY=1.8v 

U-Boot 1.1.4 (Nov  2 2012 - 10:46:48) Marvell version: 3.5.3 

U-Boot code: 00600000 -> 0067FFF0  BSS: -> 006CD5C0 

Soc: MV88F6282 Rev 1CPU running @ 2000Mhz L2 running @ 500Mhz 
SysClock = 500Mhz , TClock = 200Mhz 

DRAM (DDR3) CAS Latency = 7 tRP = 7 tRAS = 20 tRCD=7 
DRAM CS[0] base 0x00000000   size 512MB 
DRAM CS[1] base 0x20000000   size 512MB 
DRAM Total size   1GB  16bit width 
Addresses 8M - 0M are saved for the U-Boot usage. 
Mem malloc Initialization (8M - 7M): Done 
[16384kB@f8000000] Flash: 16 MB 

CPU : Marvell Feroceon (Rev 1) 
USB 0: host mode 
PEX 0: PCI Express Root Complex Interface 
PEX interface detected Link X1 
PEX 1: PCI Express Root Complex Interface 
PEX interface detected Link X1 

Reset IDE: 
Marvell Serial ATA Adapter 
Integrated Sata device found 
[0 1 0]: Enable DMA mode (6) 
  Device 1 @ 0 1: 
Model: WDC WD2002FYPS-02W3B0                    Firm: 04.01G01 Ser#:      WD-WCAVY7358489 
            Type: Hard Disk 
            Supports 48-bit addressing 
            Capacity: 1907729.0 MB = 1863.0 GB (-387938128 x 512) 
[0,0]: device connected event received 

Net:   egiga0 [PRIME] 
Hit any key to stop autoboot:  0  
QNAP: Recovery Button pressed: 0 
Marvell>> printenv 
CASset=min 
MALLOC_len=1 
autoload=no 
baudrate=115200 
bootargs=console=ttyS0,115200 root=/dev/ram initrd=0xa00000,0x900000 ramdisk=34816 mem=768M 
bootargs           console=ttyS0,115200 root=/dev/ram initrd=0xb00000,0xc00000 ramdisk=34816 mem=768M cmdlinepart.mtdparts="spi0.0:512k@0(uboot)ro,3M@0x100000(Kernel),12M@0x400000(RootFS1),2M@0x200000(Kernel_legacy),256k@0x80000(U-Boot Config),256k@0xc0000(NAS Config)" mtdparts="spi0.0:512k@0(uboot)ro,3M@0x100000(Kernel),12M@0x400000(RootFS1),2M@0x200000(Kernel_legacy),256k@0x80000(U-Boot Config),256k@0xc0000(NAS Config)" 
bootargs_backup    console=ttyS0,115200 root=/dev/ram initrd=0xa00000,0x900000 ramdisk=34816 mem=768M 
bootcmd=uart1 0x68;cp.l 0xf8200000 0x800000 0x80000;cp.l 0xf8400000 0xa00000 0x240000;bootm 0x800000 
console=console=ttyS0,115200 
ethact=egiga0 
ethaddr=00:50:43:00:02:02 
ethmtu=1500 
ethprime=egiga0 
ipaddr=192.168.0.50 
loadaddr=0x02000000 
loads_echo=0 
netmask=255.255.255.0 
netretry=no 
rcvrip=169.254.100.100 
rootpath=/mnt/ARM_FS/ 
run_diag=yes 
serverip=192.168.0.1 
usb0Mode=host 
stdin=serial 
stdout=serial 
stderr=serial 
mainlineLinux=no 
enaMonExt=no 
enaCpuStream=no 
enaWrAllo=no 
pexMode=RC 
disL2Cache=no 
setL2CacheWT=yes 
disL2Prefetch=yes 
enaICPref=yes 
enaDCPref=yes 
sata_dma_mode=yes 
netbsd_en=no 
bootdelay=1 
disaMvPnp=no 
bootp_vendor_class=F_TS-221 
enaAutoRecovery=yes 
pcieTune=no 

Environment size: 1354/4092 bytes 
Marvell>>  

Looks good. I actually overlooked the first error message you posted. Your MTD might actually be 100% healthy and bootable. In that case you don't need to play with the tftp at all.

You can quickly try with:

setenv bootargs console=ttyS0,115200 root=/dev/ram initrd=0xb00000,0xc00000 ramdisk=34816 mem=768M cmdlinepart.mtdparts="spi0.0:512k@0(uboot)ro,3M@0x100000(Kernel),12M@0x400000(RootFS1),2M@0x200000(Kernel_legacy),256k@0x80000(U-Boot Config),256k@0xc0000(NAS Config)" mtdparts="spi0.0:512k@0(uboot)ro,3M@0x100000(Kernel),12M@0x400000(RootFS1),2M@0x200000(Kernel_legacy),256k@0x80000(U-Boot Config),256k@0xc0000(NAS Config)"

This is not a permanent fix but could allow you to boot back into the system. You may need to adjust also the bootcmd variable. Side note, there is a watchdog and might kick while you are editing ;)

If it works you can repeat everything and use saveenv to make it permanent.

lpaolini commented 2 years ago

After running that long single-line command I tried running boot (is this correct?) but it failed again, with the same Bad Magic Number error.

cavokz commented 2 years ago

After running that long single-line command I tried running boot (is this correct?) but it failed again, with the same Bad Magic Number error.

The bootcmd (which is the one executed when you do boot) needs to be adjusted. I used a piece of paper, wrote down all the numbers, old and new, and figured out what to put where. I suggest to keep a log of the attempts you do.

amouiche commented 2 years ago

bootcmd didn't look to be patched correctly, and you are currently downloading the kernel for a different place than the one where it was moved.

can you run on uboot

setenv bootcmd uart1 0x68\;cp.l 0xf8100000 0x800000 0xc0000\;cp.l
0xf8400000 0xb00000 0x300000\;bootm 0x800000
saveenv
reset

This should provide the proper configuration. You should be able to boot on the new layout with everything in place Arnaud

Le 16/11/2021 à 12:19, Domenico Andreoli a écrit :

This is the result of u-boot printenv:

|__ __ _ _ | \/ | __ _ _ ____ _____| | | | |\/| |/ _` | '__\ \ / /
_ \ | | | | | | (_| | | \ V / __/ | | |_| |_|\__,_|_| \_/
\___|_|_| _ _ ____ _ | | | | | __ ) ___ ___ | |_ | | | |___| _ \ /
_ \ / _ \| __| | |_| |___| |_) | (_) | (_) | |_ \___/ |____/ \___/
\___/ \__| ** LOADER ** ** MARVELL BOARD: DB-88F6282A-BP LE TS-221
,PHY=1.8v U-Boot 1.1.4 (Nov 2 2012 - 10:46:48) Marvell version:
3.5.3 U-Boot code: 00600000 -> 0067FFF0 BSS: -> 006CD5C0 Soc:
MV88F6282 Rev 1CPU running @ 2000Mhz L2 running @ 500Mhz SysClock
= 500Mhz , TClock = 200Mhz DRAM (DDR3) CAS Latency = 7 tRP = 7
tRAS = 20 tRCD=7 DRAM CS[0] base 0x00000000 size 512MB DRAM CS[1]
base 0x20000000 size 512MB DRAM Total size 1GB 16bit width
Addresses 8M - 0M are saved for the U-Boot usage. Mem malloc
Initialization (8M - 7M): Done ***@***.*** Flash: 16 MB CPU
: Marvell Feroceon (Rev 1) USB 0: host mode PEX 0: PCI Express
Root Complex Interface PEX interface detected Link X1 PEX 1: PCI
Express Root Complex Interface PEX interface detected Link X1
Reset IDE: Marvell Serial ATA Adapter Integrated Sata device found
[0 1 0]: Enable DMA mode (6) Device 1 @ 0 1: Model: WDC
WD2002FYPS-02W3B0 Firm: 04.01G01 Ser#: WD-WCAVY7358489 Type: Hard
Disk Supports 48-bit addressing Capacity: 1907729.0 MB = 1863.0 GB
(-387938128 x 512) [0,0]: device connected event received Net:
egiga0 [PRIME] Hit any key to stop autoboot: 0 QNAP: Recovery
Button pressed: 0 Marvell>> printenv CASset=min MALLOC_len=1
autoload=no baudrate=115200 bootargs=console=ttyS0,115200
root=/dev/ram initrd=0xa00000,0x900000 ramdisk=34816 mem=768M
bootargs console=ttyS0,115200 root=/dev/ram
initrd=0xb00000,0xc00000 ramdisk=34816 mem=768M
***@***.******@***.******@***.******@***.******@***.***(U-Boot
***@***.***(NAS Config)"
***@***.******@***.******@***.******@***.******@***.***(U-Boot
***@***.***(NAS Config)" bootargs_backup
console=ttyS0,115200 root=/dev/ram initrd=0xa00000,0x900000
ramdisk=34816 mem=768M bootcmd=uart1 0x68;cp.l 0xf8200000 0x800000
0x80000;cp.l 0xf8400000 0xa00000 0x240000;bootm 0x800000
console=console=ttyS0,115200 ethact=egiga0
ethaddr=00:50:43:00:02:02 ethmtu=1500 ethprime=egiga0
ipaddr=192.168.0.50 loadaddr=0x02000000 loads_echo=0
netmask=255.255.255.0 netretry=no rcvrip=169.254.100.100
rootpath=/mnt/ARM_FS/ run_diag=yes serverip=192.168.0.1
usb0Mode=host stdin=serial stdout=serial stderr=serial
mainlineLinux=no enaMonExt=no enaCpuStream=no enaWrAllo=no
pexMode=RC disL2Cache=no setL2CacheWT=yes disL2Prefetch=yes
enaICPref=yes enaDCPref=yes sata_dma_mode=yes netbsd_en=no
bootdelay=1 disaMvPnp=no bootp_vendor_class=F_TS-221
enaAutoRecovery=yes pcieTune=no Environment size: 1354/4092 bytes
Marvell>> |

Looks good. I actually overlooked the first error message you posted. Your MTD might actually be 100% healthy and bootable. In that case you don't need to play with the tftp at all.

You can quickly try with:

|setenv bootargs console=ttyS0,115200 root=/dev/ram initrd=0xb00000,0xc00000 ramdisk=34816 mem=768M @.**@*.**@*.**@*.**@*.(U-Boot @.(NAS Config)" @.**@*.**@*.**@*.**@*.(U-Boot @.(NAS Config)" |

This is not a permanent fix but could allow you to boot back into the system. If it works you can repeat it and use |saveenv| to make it permanent.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/amouiche/qnap_mtd_resize_for_bullseye/issues/9#issuecomment-970172633, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADXHI5A4FWWMLEIRWI2DQM3UMI447ANCNFSM5ID4ZWVQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

lpaolini commented 2 years ago

Yay, a step forward! Now it starts booting kernel 4.19.0 from Buster, as the upgrade to Bullseye didn't complete as it could not flash the kernel.

However, after a few seconds it halts with a kernel panic Unable to mount root fs on unknownblock(1,0)

I guess the target is to find a way for running again the flash-kernel command, now that MTD Kernel partition can fit the new kernel, but I don't really know how to do that.

amouiche commented 2 years ago

can you copy/paste the full console from the start of the boot ?

arnaud

Le 16/11/2021 à 13:27, Luca Paolini a écrit :

Yay, a step forward! Now it starts booting kernel 4.19.0 from Buster, as the upgrade to Bullseye didn't complete as it could not flash the kernel.

However, after a few seconds it halts with a kernel panic |Unable to mount root fs on unknownblock(1,0)|

I guess the target is to find a way for running again the flash-kernel command, now that MTD Kernel partition can fit the new kernel, but I don't really know how to do that.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/amouiche/qnap_mtd_resize_for_bullseye/issues/9#issuecomment-970223762, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADXHI5CBM6E5BKGPZ7KC6NTUMJE2VANCNFSM5ID4ZWVQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

lpaolini commented 2 years ago
         __  __                      _ _
        |  \/  | __ _ _ ____   _____| | |
        | |\/| |/ _` | '__\ \ / / _ \ | |
        | |  | | (_| | |   \ V /  __/ | |
        |_|  |_|\__,_|_|    \_/ \___|_|_|
 _   _     ____              _
| | | |   | __ )  ___   ___ | |_
| | | |___|  _ \ / _ \ / _ \| __|
| |_| |___| |_) | (_) | (_) | |_
 \___/    |____/ \___/ \___/ \__|  ** LOADER **
 ** MARVELL BOARD: DB-88F6282A-BP LE TS-221 ,PHY=1.8v

U-Boot 1.1.4 (Nov  2 2012 - 10:46:48) Marvell version: 3.5.3

U-Boot code: 00600000 -> 0067FFF0  BSS: -> 006CD5C0

Soc: MV88F6282 Rev 1CPU running @ 2000Mhz L2 running @ 500Mhz
SysClock = 500Mhz , TClock = 200Mhz

DRAM (DDR3) CAS Latency = 7 tRP = 7 tRAS = 20 tRCD=7
DRAM CS[0] base 0x00000000   size 512MB
DRAM CS[1] base 0x20000000   size 512MB
DRAM Total size   1GB  16bit width
Addresses 8M - 0M are saved for the U-Boot usage.
Mem malloc Initialization (8M - 7M): Done
[16384kB@f8000000] Flash: 16 MB

CPU : Marvell Feroceon (Rev 1)
USB 0: host mode
PEX 0: PCI Express Root Complex Interface
PEX interface detected Link X1
PEX 1: PCI Express Root Complex Interface
PEX interface detected Link X1

Reset IDE:
Marvell Serial ATA Adapter
Integrated Sata device found
[0 1 0]: Enable DMA mode (6)
  Device 1 @ 0 1:
Model: WDC WD2002FYPS-02W3B0                    Firm: 04.01G01 Ser#:      WD-WCAVY7358489
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 1907729.0 MB = 1863.0 GB (-387938128 x 512)
[0,0]: device connected event received

Net:   egiga0 [PRIME]
Hit any key to stop autoboot:  0
Send Cmd : 0x68 to UART1
## Booting image at 00800000 ...
   Image Name:   kernel 4.19.0-18-marvell
   Created:      2021-10-12   7:08:55 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2069986 Bytes =  2 MB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
OK

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.19.0-18-marvell (debian-kernel@lists.debian.org) (gcc version 8.3.0 (Debian 8.3.0-6)) #1 Debian 4.19.208-1 (2021-09-29)
[    0.000000] CPU: Feroceon 88FR131 [56251311] revision 1 (ARMv5TE), cr=0005397f
[    0.000000] CPU: VIVT data cache, VIVT instruction cache
[    0.000000] OF: fdt: Machine model: QNAP TS219 family
[    0.000000] Memory policy: Data cache writeback
[    0.000000] random: get_random_bytes called from start_kernel+0x78/0x4a8 with crng_init=0
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 195072
[    0.000000] Kernel command line: console=ttyS0,115200 root=/dev/ram initrd=0xa00000,0x900000 ramdisk=34816 mem=768M
[    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Memory: 764124K/786432K available (3987K kernel code, 342K rwdata, 1040K rodata, 316K init, 220K bss, 22308K reserved, 0K cma-reserved, 0K highmem)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0xf0800000 - 0xff800000   ( 240 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xf0000000   ( 768 MB)
[    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
[    0.000000]       .text : 0x(ptrval) - 0x(ptrval)   (3989 kB)
[    0.000000]       .init : 0x(ptrval) - 0x(ptrval)   ( 316 kB)
[    0.000000]       .data : 0x(ptrval) - 0x(ptrval)   ( 343 kB)
[    0.000000]        .bss : 0x(ptrval) - 0x(ptrval)   ( 221 kB)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] ftrace: allocating 18981 entries in 38 pages
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] clocksource: orion_clocksource: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 9556302233 ns
[    0.000006] sched_clock: 32 bits at 200MHz, resolution 5ns, wraps every 10737418237ns
[    0.000029] Switching to timer-based delay loop, resolution 5ns
[    0.000095] Calibrating delay loop (skipped), value calculated using timer frequency.. 400.00 BogoMIPS (lpj=800000)
[    0.000111] pid_max: default: 32768 minimum: 301
[    0.000300] Security Framework initialized
[    0.000314] Yama: disabled by default; enable with sysctl kernel.yama.*
[    0.000404] AppArmor: AppArmor initialized
[    0.000497] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000517] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.001212] CPU: Testing write buffer coherency: ok
[    0.001971] Setting up static identity map for 0x8200 - 0x823c
[    0.002139] mvebu-soc-id: MVEBU SoC ID=0x6282, Rev=0x1
[    0.003380] devtmpfs: initialized
[    0.006069] VFP support v0.3: not present
[    0.006195] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.006214] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.006414] pinctrl core: initialized pinctrl subsystem
[    0.007240] NET: Registered protocol family 16
[    0.007525] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.007963] audit: initializing netlink subsys (disabled)
[    0.008587] cpuidle: using governor ladder
[    0.008599] cpuidle: using governor menu
[    0.008834] Feroceon L2: Enabling L2
[    0.008865] Feroceon L2: Cache support initialised.
[    0.009030] [Firmware Info]: /ocp@f1000000/ethernet-controller@72000/ethernet0-port@0: local-mac-address is not set
[    0.011600] No ATAGs?
[    0.012071] audit: type=2000 audit(0.008:1): state=initialized audit_enabled=0 res=1
[    0.014558] clocksource: Switched to clocksource orion_clocksource
[    0.029974] VFS: Disk quotas dquot_6.6.0
[    0.030035] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    0.030384] AppArmor: AppArmor Filesystem Enabled
[    0.031194] NET: Registered protocol family 2
[    0.031345] IP idents hash table entries: 16384 (order: 5, 131072 bytes)
[    0.032408] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes)
[    0.032432] TCP established hash table entries: 8192 (order: 3, 32768 bytes)
[    0.032532] TCP bind hash table entries: 8192 (order: 3, 32768 bytes)
[    0.032631] TCP: Hash tables configured (established 8192 bind 8192)
[    0.032712] UDP hash table entries: 512 (order: 1, 8192 bytes)
[    0.032744] UDP-Lite hash table entries: 512 (order: 1, 8192 bytes)
[    0.032892] NET: Registered protocol family 1
[    0.033080] Unpacking initramfs...
[    0.033093] Initramfs unpacking failed: junk in compressed archive
[    0.060996] Freeing initrd memory: 9216K
[    0.061546] Initialise system trusted keyrings
[    0.061576] Key type blacklist registered
[    0.061699] workingset: timestamp_bits=30 max_order=18 bucket_order=0
[    0.064746] zbud: loaded
[    0.065974] Key type asymmetric registered
[    0.065982] Asymmetric key parser 'x509' registered
[    0.066018] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[    0.066125] io scheduler noop registered
[    0.066300] io scheduler cfq registered (default)
[    0.067351] kirkwood-pinctrl f1010000.pin-controller: registered pinctrl driver
[    0.068468] mvebu-pcie mbus@f1000000:pcie@82000000: PCI host bridge to bus 0000:00
[    0.068482] pci_bus 0000:00: root bus resource [bus 00-ff]
[    0.068490] pci_bus 0000:00: root bus resource [mem 0xe0000000-0xefffffff]
[    0.068497] pci_bus 0000:00: root bus resource [io  0x1000-0xeffff]
[    0.069421] PCI: bus0: Fast back to back transfers disabled
[    0.069432] pci 0000:00:01.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[    0.069442] pci 0000:00:02.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[    0.069825] pci 0000:01:00.1: [Firmware Bug]: reg 0x10: invalid BAR (can't size)
[    0.069838] pci 0000:01:00.1: [Firmware Bug]: reg 0x14: invalid BAR (can't size)
[    0.069850] pci 0000:01:00.1: [Firmware Bug]: reg 0x18: invalid BAR (can't size)
[    0.069862] pci 0000:01:00.1: [Firmware Bug]: reg 0x1c: invalid BAR (can't size)
[    0.069873] pci 0000:01:00.1: [Firmware Bug]: reg 0x20: invalid BAR (can't size)
[    0.070653] PCI: bus1: Fast back to back transfers disabled
[    0.070861] pci 0000:02:00.0: enabling Extended Tags
[    0.070960] pci 0000:02:00.0: 2.000 Gb/s available PCIe bandwidth, limited by 2.5 GT/s x1 link at 0000:00:02.0 (capable of 4.000 Gb/s with 5 GT/s x1 link)
[    0.071649] PCI: bus2: Fast back to back transfers disabled
[    0.071782] pci 0000:00:01.0: BAR 8: assigned [mem 0xe0000000-0xe00fffff]
[    0.071792] pci 0000:00:02.0: BAR 8: assigned [mem 0xe0100000-0xe01fffff]
[    0.071803] pci 0000:01:00.0: BAR 6: assigned [mem 0xe0000000-0xe000ffff pref]
[    0.071811] pci 0000:01:00.0: BAR 5: assigned [mem 0xe0010000-0xe0011fff]
[    0.071822] pci 0000:00:01.0: PCI bridge to [bus 01]
[    0.071831] pci 0000:00:01.0:   bridge window [mem 0xe0000000-0xe00fffff]
[    0.071843] pci 0000:02:00.0: BAR 0: assigned [mem 0xe0100000-0xe0107fff 64bit]
[    0.071859] pci 0000:00:02.0: PCI bridge to [bus 02]
[    0.071868] pci 0000:00:02.0:   bridge window [mem 0xe0100000-0xe01fffff]
[    0.071923] pcieport 0000:00:01.0: enabling device (0140 -> 0142)
[    0.071980] pcieport 0000:00:02.0: enabling device (0140 -> 0142)
[    0.072004] pci 0000:01:00.0: async suspend disabled to avoid multi-function power-on ordering issue
[    0.072022] pci 0000:01:00.1: async suspend disabled to avoid multi-function power-on ordering issue
[    0.072354] mv_xor f1060800.xor: Marvell shared XOR driver
[    0.099133] mv_xor f1060800.xor: Marvell XOR (Registers Mode): ( xor cpy intr )
[    0.099261] mv_xor f1060900.xor: Marvell shared XOR driver
[    0.127105] mv_xor f1060900.xor: Marvell XOR (Registers Mode): ( xor cpy intr )
[    0.127350] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[    0.127998] console [ttyS0] disabled
[    0.128043] f1012000.serial: ttyS0 at MMIO 0xf1012000 (irq = 27, base_baud = 12500000) is a 16550A
[    0.856672] console [ttyS0] enabled
[    0.860575] f1012100.serial: ttyS1 at MMIO 0xf1012100 (irq = 28, base_baud = 12500000) is a 16550A
[    0.870032] libphy: Fixed MDIO Bus: probed
[    0.874161] i2c /dev entries driver
[    0.878582] ledtrig-cpu: registered to indicate activity on CPUs
[    0.885258] registered taskstats version 1
[    0.889389] Loading compiled-in X.509 certificates
[    0.894686] Loaded X.509 cert 'Debian Secure Boot CA: 6ccece7e4c6c0d1f6149f3dd27dfcc5cbb419ea1'
[    0.903742] Loaded X.509 cert 'Debian Secure Boot Signer 2021 - linux: 4b6ef5abca669825178e052c84667ccbc0531f8c'
[    0.914036] AppArmor: AppArmor sha1 policy hashing enabled
[    0.920460] hctosys: unable to open rtc device (rtc0)
[    0.925842] List of all partitions:
[    0.929361] No filesystem could mount root, tried:
[    0.929363]
[    0.935768] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(1,0)
[    0.944072] CPU: 0 PID: 1 Comm: swapper Not tainted 4.19.0-18-marvell #1 Debian 4.19.208-1
[    0.952368] Hardware name: Marvell Kirkwood (Flattened Device Tree)
[    0.958672] [<c00166bc>] (unwind_backtrace) from [<c0013648>] (show_stack+0x18/0x1c)
[    0.966448] [<c0013648>] (show_stack) from [<c03e6fdc>] (panic+0xb8/0x250)
[    0.973355] [<c03e6fdc>] (panic) from [<c05165c4>] (mount_block_root+0x244/0x2e8)
[    0.980870] [<c05165c4>] (mount_block_root) from [<c0516840>] (prepare_namespace+0x14c/0x18c)
[    0.989432] [<c0516840>] (prepare_namespace) from [<c0516108>] (kernel_init_freeable+0x204/0x284)
[    0.998345] [<c0516108>] (kernel_init_freeable) from [<c03e89bc>] (kernel_init+0x10/0xf8)
[    1.006559] [<c03e89bc>] (kernel_init) from [<c00090e0>] (ret_from_fork+0x14/0x34)
[    1.014158] Exception stack(0xef4e1fb0 to 0xef4e1ff8)
[    1.019226] 1fa0:                                     00000000 00000000 00000000 00000000
[    1.027434] 1fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    1.035638] 1fe0: 00000000 00000000 00000000 00000000 00000013 00000000
[    1.042277] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(1,0) ]---
[    1.478557] random: fast init done
[   53.938593] random: crng init done
lpaolini commented 2 years ago

I hope you can help me with this as I don't know how to solve it.

cavokz commented 2 years ago

I hope you can help me with this as I don't know how to solve it.

From the line

[    0.000000] Kernel command line: console=ttyS0,115200 root=/dev/ram initrd=0xa00000,0x900000 ramdisk=34816 mem=768M

in your bootlog, I see that you are using the wrong bootargs. Could you try with setting it as I pointed in https://github.com/amouiche/qnap_mtd_resize_for_bullseye/issues/9#issuecomment-970172633?

lpaolini commented 2 years ago

YES!!! It booted Bullseye using the old kernel!

Then I ran apt full-upgrade for flashing the new kernel and initrd into the expanded partitions, rebooted, reapplied the setenv ... command you provided and made the change persistent with saveenv.

Thanks a lot @cavokz and @amouiche, you saved my life! :-)

cavokz commented 2 years ago

Then I ran apt full-upgrade for flashing the new kernel and initrd into the expanded partitions, rebooted, reapplied the setenv ... command you provided and made the change persistent with saveenv.

It's the time to save that u-boot env somewhere safe ;)

lpaolini commented 2 years ago

I'll do. Thanks a million!