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

Problem on TS-419P+ "2 inodes containing multiply-claimed blocks." #42

Open dauhonk opened 1 year ago

dauhonk commented 1 year ago

I recently installed Debian 10 on my Qnap TS419P+ device. Before upgrading to bullseye I did a MDT backup and started the resize script in dry-mode. Unfortunately the output shows some errors:

[Check of the QNAP model and see if supported]
kirkwood-qnap: machine: QNAP TS419 family
DTB file: kirkwood-ts419-6282.dtb
Checking: flashcp -V
Checking: flash_erase --version
Using 'u-boot-tools' package

[find on which MTD device partitions are currently mounted]
   spi0.0

[Dump current U-boot config']
Current U-boot bootcmd:
    uart1 0x68;cp.l 0xf8200000 0x800000 0x80000;cp.l 0xf8400000 0xa00000 0x240000;bootm 0x800000
Current U-boot bootargs:
    console=ttyS0,115200 root=/dev/ram initrd=0xa00000,0x900000 ramdisk=34816

[Prepare new 'bootcmd']
   Old: uart1 0x68;cp.l 0xf8200000 0x800000 0x80000;cp.l 0xf8400000 0xa00000 0x240000;bootm 0x800000
   New: uart1 0x68;cp.l 0xf8100000 0x800000 0xc0000;cp.l 0xf8400000 0xb00000 0x300000;bootm 0x800000;echo Kernel_legacy layout fallback;bootm 0x900000

[Prepare new 'bootargs']
   Old: console=ttyS0,115200 root=/dev/ram initrd=0xa00000,0x900000 ramdisk=34816
   New: console=ttyS0,115200 root=/dev/ram initrd=0xb00000,0xc00000 ramdisk=34816 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)

[Prepare fw_setenv script (/tmp/fw_setenv.script)]

[Dump current 'NAS config' and 'Kernel' images]
+ cat /dev/mtd5
[Resize 'NAS config' dump from 1280KB to 256KB.]
+ modprobe loop
+ losetup --show -f /tmp/mtd_nas_config.dump
+ loopdev=/dev/loop0
+ e2fsck -f -p -v /dev/loop0
/dev/loop0: Duplicate or bad block in use!
/dev/loop0: Multiply-claimed block(s) in inode 13: 39
/dev/loop0: Multiply-claimed block(s) in inode 16: 39
/dev/loop0: (There are 2 inodes containing multiply-claimed blocks.)

/dev/loop0: File /BOOT_COUNT (inode #13, mod time Thu Aug  1 16:34:53 2013) 
  has 1 multiply-claimed block(s), shared with 1 file(s):
/dev/loop0:     /smb.conf.cksum (inode #16, mod time Fri Jun  9 15:12:29 2023)
/dev/loop0:

/dev/loop0: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
    (i.e., without -a or -p options)
+ true
+ e2fsck -f -p -v /dev/loop0
/dev/loop0: Duplicate or bad block in use!
/dev/loop0: Multiply-claimed block(s) in inode 13: 39
/dev/loop0: Multiply-claimed block(s) in inode 16: 39
/dev/loop0: (There are 2 inodes containing multiply-claimed blocks.)

/dev/loop0: File /BOOT_COUNT (inode #13, mod time Thu Aug  1 16:34:53 2013) 
  has 1 multiply-claimed block(s), shared with 1 file(s):
/dev/loop0:     /smb.conf.cksum (inode #16, mod time Fri Jun  9 15:12:29 2023)
/dev/loop0: 

/dev/loop0: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
    (i.e., without -a or -p options)
+ echo e2fsck failed. 'NAS config' resize not possible automatically
e2fsck failed. 'NAS config' resize not possible automatically
+ losetup -d /dev/loop0
+ exit 1
Traceback (most recent call last):
  File "./qnap_mtd_resize.py", line 446, in <module>
    subprocess.check_call(cmd, shell=True)
  File "/usr/lib/python3.7/subprocess.py", line 347, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '
    set -e
    set -x
    modprobe loop

    loopdev=$(losetup --show -f /tmp/mtd_nas_config.dump)

    # run e2fsck twice. the First may return an error status even if FS is corrected
    e2fsck -f -p -v $loopdev || true
    if ! e2fsck -f -p -v $loopdev; then
        echo "e2fsck failed. 'NAS config' resize not possible automatically"
        losetup -d $loopdev
        exit 1
    fi

    if ! resize2fs $loopdev 128; then
        echo "resize2fs failed. 'NAS config' resize not possible automatically"
        losetup -d $loopdev
        exit 1
    fi
    losetup -d $loopdev
    ' returned non-zero exit status 1.

As a filesystem noob I thought to fix the error with

sudo losetup -f /tmp/mtd_nas_config.dump
sudo e2fsck -f -v /dev/loop0
sudo e2fsck -f -v /dev/loop0 #needed to run twice for error fix
sudo losetup -d /dev/loop0

e2fsck output:

e2fsck 1.44.5 (15-Dec-2018)
Pass 1: Checking inodes, blocks, and sizes

Running additional passes to resolve blocks claimed by more than one inode...
Pass 1B: Rescanning for multiply-claimed blocks
Multiply-claimed block(s) in inode 13: 39
Multiply-claimed block(s) in inode 16: 39
Pass 1C: Scanning directories for inodes with multiply-claimed blocks
Pass 1D: Reconciling multiply-claimed blocks
(There are 2 inodes containing multiply-claimed blocks.)

File /BOOT_COUNT (inode #13, mod time Thu Aug  1 16:34:53 2013) 
  has 1 multiply-claimed block(s), shared with 1 file(s):
    /smb.conf.cksum (inode #16, mod time Fri Jun  9 15:12:29 2023)
Clone multiply-claimed blocks<y>? yes
File /smb.conf.cksum (inode #16, mod time Fri Jun  9 15:12:29 2023) 
  has 1 multiply-claimed block(s), shared with 1 file(s):
    /BOOT_COUNT (inode #13, mod time Thu Aug  1 16:34:53 2013)
Multiply-claimed blocks already reassigned or cloned.

Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Block bitmap differences:  -513
Fix<y>? yes to all
Free blocks count wrong for group #0 (966, counted=965).
Fix? yes

Free blocks count wrong (966, counted=965).
Fix? yes

/dev/loop0: ***** FILE SYSTEM WAS MODIFIED *****

          19 inodes used (14.84%, out of 128)
           2 non-contiguous files (10.5%)
           0 non-contiguous directories (0.0%)
             # of inodes with ind/dind/tind blocks: 0/0/0
          59 blocks used (5.76%, out of 1024)
           0 bad blocks
           0 large files

           8 regular files
           2 directories
           0 character device files
           0 block device files
           0 fifos
           0 links
           0 symbolic links (0 fast symbolic links)
           0 sockets
------------
          10 files

Restarting the resize script after this does result in the same error as the first time.

Currently I am stuck with buster. What am I missing? Is there a way to fix the error? Is maybe the creation of "mtd_nas_config.dump" buggy? Any ideas are welcome.

dauhonk commented 1 year ago

Here is the output of "uname -a" "cat /proc/mtd" "lsmod" "dmesg"

uname -a
Linux debian 4.19.0-21-marvell #1 Debian 4.19.249-2 (2022-06-30) armv5tel GNU/Linux
cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00080000 00040000 "U-Boot"
mtd1: 00200000 00040000 "Kernel"
mtd2: 00900000 00040000 "RootFS1"
mtd3: 00300000 00040000 "RootFS2"
mtd4: 00040000 00040000 "U-Boot Config"
mtd5: 00140000 00040000 "NAS Config"
lsmod
Module                  Size  Used by
loop                   28672  2
af_packet              40960  2
ehci_orion             16384  0
ofpart                 16384  0
cmdlinepart            16384  0
ehci_hcd               61440  1 ehci_orion
m25p80                 16384  0
spi_nor                32768  1 m25p80
mtd                    49152  9 m25p80,ofpart,cmdlinepart
marvell                20480  2
mvmdio                 16384  0
mv643xx_eth            36864  0
usbcore               172032  2 ehci_orion,ehci_hcd
usb_common             16384  1 usbcore
marvell_cesa           36864  0
nls_base               16384  1 usbcore
orion_wdt              16384  0
des_generic            24576  1 marvell_cesa
rtc_s35390a            16384  0
spi_orion              16384  0
kirkwood_thermal       16384  0
thermal_sys            65536  1 kirkwood_thermal
hwmon                  16384  1 thermal_sys
sg                     32768  0
evdev                  24576  1
gpio_keys              20480  0
ip_tables              20480  0
x_tables               24576  1 ip_tables
sha256_generic         20480  0
sha256_arm             24576  1
hmac                   16384  2
ipv6                  409600  12
autofs4                36864  2
ext4                  532480  2
crc16                  16384  1 ext4
mbcache                16384  1 ext4
jbd2                   90112  1 ext4
fscrypto               24576  1 ext4
ecb                    16384  0
aes_arm                16384  0
dm_mod                106496  9
raid10                 53248  0
raid1                  40960  0
raid0                  20480  0
multipath              16384  0
linear                 16384  0
raid456               147456  1
libcrc32c              16384  1 raid456
crc32c_generic         16384  5
async_raid6_recov      16384  1 raid456
async_memcpy           16384  2 raid456,async_raid6_recov
async_pq               16384  2 raid456,async_raid6_recov
async_xor              16384  3 async_pq,raid456,async_raid6_recov
xor                    16384  1 async_xor
async_tx               16384  5 async_xor,async_pq,raid456,async_memcpy,async_raid6_recov
raid6_pq               98304  3 async_pq,raid456,async_raid6_recov
md_mod                126976  7 raid1,raid10,multipath,linear,raid0,raid456
sd_mod                 45056  8
sata_mv                32768  4
libata                180224  1 sata_mv
scsi_mod              180224  3 sd_mod,libata,sg
dmesg
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.19.0-21-marvell (debian-kernel@lists.debian.org) (gcc version 8.3.0 (Debian 8.3.0-6)) #1 Debian 4.19.249-2 (2022-06-30)
[    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 TS419 family
[    0.000000] Memory policy: Data cache writeback
[    0.000000] On node 0 totalpages: 131072
[    0.000000]   Normal zone: 1024 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 131072 pages, LIFO batch:31
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0 
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 130048
[    0.000000] Kernel command line: root=/dev/ram initrd=0xa00000,0x900000 ramdisk=34816
[    0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] Memory: 504424K/524288K available (3988K kernel code, 339K rwdata, 1036K rodata, 312K init, 218K bss, 19864K reserved, 0K cma-reserved, 0K highmem)
[    0.000000] Virtual kernel memory layout:
                   vector  : 0xffff0000 - 0xffff1000   (   4 kB)
                   fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
                   vmalloc : 0xe0800000 - 0xff800000   ( 496 MB)
                   lowmem  : 0xc0000000 - 0xe0000000   ( 512 MB)
                   pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
                   modules : 0xbf000000 - 0xbfe00000   (  14 MB)
                     .text : 0x(ptrval) - 0x(ptrval)   (3989 kB)
                     .init : 0x(ptrval) - 0x(ptrval)   ( 312 kB)
                     .data : 0x(ptrval) - 0x(ptrval)   ( 340 kB)
                      .bss : 0x(ptrval) - 0x(ptrval)   ( 219 kB)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] ftrace: allocating 18996 entries in 56 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.000140] Calibrating delay loop (skipped), value calculated using timer frequency.. 400.00 BogoMIPS (lpj=800000)
[    0.000157] pid_max: default: 32768 minimum: 301
[    0.000562] Security Framework initialized
[    0.000576] Yama: disabled by default; enable with sysctl kernel.yama.*
[    0.000722] AppArmor: AppArmor initialized
[    0.000904] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.000920] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.001961] CPU: Testing write buffer coherency: ok
[    0.002924] Setting up static identity map for 0x8200 - 0x823c
[    0.003104] mvebu-soc-id: MVEBU SoC ID=0x6282, Rev=0x0
[    0.004456] devtmpfs: initialized
[    0.007814] VFP support v0.3: not present
[    0.007927] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.007946] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.008280] pinctrl core: initialized pinctrl subsystem
[    0.009689] NET: Registered protocol family 16
[    0.009966] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.010530] audit: initializing netlink subsys (disabled)
[    0.011228] cpuidle: using governor ladder
[    0.011240] cpuidle: using governor menu
[    0.011487] Feroceon L2: Enabling L2
[    0.011518] Feroceon L2: Cache support initialised.
[    0.011692] [Firmware Info]: /ocp@f1000000/ethernet-controller@72000/ethernet0-port@0: local-mac-address is not set
[    0.011766] [Firmware Info]: /ocp@f1000000/ethernet-controller@76000/ethernet1-port@0: local-mac-address is not set
[    0.015029] No ATAGs?
[    0.016075] audit: type=2000 audit(0.008:1): state=initialized audit_enabled=0 res=1
[    0.018814] clocksource: Switched to clocksource orion_clocksource
[    0.039755] VFS: Disk quotas dquot_6.6.0
[    0.039833] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    0.040320] AppArmor: AppArmor Filesystem Enabled
[    0.041305] NET: Registered protocol family 2
[    0.041470] IP idents hash table entries: 8192 (order: 4, 65536 bytes)
[    0.042271] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes)
[    0.042302] TCP established hash table entries: 4096 (order: 2, 16384 bytes)
[    0.042354] TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
[    0.042403] TCP: Hash tables configured (established 4096 bind 4096)
[    0.042484] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.042505] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.042691] NET: Registered protocol family 1
[    0.042733] PCI: CLS 0 bytes, default 32
[    0.042933] Unpacking initramfs...
[    0.556809] Freeing initrd memory: 9216K
[    0.557519] Initialise system trusted keyrings
[    0.557574] Key type blacklist registered
[    0.557740] workingset: timestamp_bits=30 max_order=17 bucket_order=0
[    0.561878] zbud: loaded
[    0.563501] Key type asymmetric registered
[    0.563511] Asymmetric key parser 'x509' registered
[    0.563549] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[    0.563681] io scheduler noop registered
[    0.563913] io scheduler cfq registered (default)
[    0.565188] kirkwood-pinctrl f1010000.pin-controller: registered pinctrl driver
[    0.566522] mvebu-pcie mbus@f1000000:pcie@82000000: PCI host bridge to bus 0000:00
[    0.566537] pci_bus 0000:00: root bus resource [bus 00-ff]
[    0.566546] pci_bus 0000:00: root bus resource [mem 0xe0000000-0xefffffff]
[    0.566555] pci_bus 0000:00: root bus resource [io  0x1000-0xeffff]
[    0.566621] pci 0000:00:01.0: [11ab:6282] type 01 class 0x060400
[    0.566869] pci 0000:00:02.0: [11ab:6282] type 01 class 0x060400
[    0.567701] PCI: bus0: Fast back to back transfers disabled
[    0.567714] pci 0000:00:01.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[    0.567724] pci 0000:00:02.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[    0.567870] pci 0000:01:00.0: [11ab:7042] type 00 class 0x010000
[    0.567904] pci 0000:01:00.0: reg 0x10: [mem 0x90000000-0x900fffff 64bit]
[    0.567917] pci 0000:01:00.0: reg 0x18: [io  0xf0000000-0xf00000ff]
[    0.568016] pci 0000:01:00.0: 2.000 Gb/s available PCIe bandwidth, limited by 2.5 GT/s x1 link at 0000:00:01.0 (capable of 8.000 Gb/s with 2.5 GT/s x4 link)
[    0.568850] PCI: bus1: Fast back to back transfers disabled
[    0.568863] pci_bus 0000:01: busn_res: [bus 01-ff] end is updated to 01
[    0.569652] PCI: bus2: Fast back to back transfers enabled
[    0.569664] pci_bus 0000:02: busn_res: [bus 02-ff] end is updated to 02
[    0.569802] pci 0000:00:01.0: BAR 8: assigned [mem 0xe0000000-0xe00fffff]
[    0.569813] pci 0000:00:01.0: BAR 7: assigned [io  0x10000-0x10fff]
[    0.569825] pci 0000:01:00.0: BAR 0: assigned [mem 0xe0000000-0xe00fffff 64bit]
[    0.569842] pci 0000:01:00.0: BAR 2: assigned [io  0x10000-0x100ff]
[    0.569853] pci 0000:00:01.0: PCI bridge to [bus 01]
[    0.569861] pci 0000:00:01.0:   bridge window [io  0x10000-0x10fff]
[    0.569871] pci 0000:00:01.0:   bridge window [mem 0xe0000000-0xe00fffff]
[    0.569881] pci 0000:00:02.0: PCI bridge to [bus 02]
[    0.569959] pcieport 0000:00:01.0: enabling device (0140 -> 0143)
[    0.570345] mv_xor f1060800.xor: Marvell shared XOR driver
[    0.599475] mv_xor f1060800.xor: Marvell XOR (Registers Mode): ( xor cpy intr )
[    0.599610] mv_xor f1060900.xor: Marvell shared XOR driver
[    0.627470] mv_xor f1060900.xor: Marvell XOR (Registers Mode): ( xor cpy intr )
[    0.627749] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[    0.628495] console [ttyS0] disabled
[    0.628542] f1012000.serial: ttyS0 at MMIO 0xf1012000 (irq = 27, base_baud = 12500000) is a 16550A
[    8.340054] console [ttyS0] enabled
[    8.382234] f1012100.serial: ttyS1 at MMIO 0xf1012100 (irq = 28, base_baud = 12500000) is a 16550A
[    8.490175] i2c /dev entries driver
[    8.532962] ledtrig-cpu: registered to indicate activity on CPUs
[    8.605706] registered taskstats version 1
[    8.654728] Loading compiled-in X.509 certificates
[    8.732147] Loaded X.509 cert 'Debian Secure Boot CA: 6ccece7e4c6c0d1f6149f3dd27dfcc5cbb419ea1'
[    8.855453] Loaded X.509 cert 'Debian Secure Boot Signer 2021 - linux: 4b6ef5abca669825178e052c84667ccbc0531f8c'
[    8.977507] AppArmor: AppArmor sha1 policy hashing enabled
[    9.044476] hctosys: unable to open rtc device (rtc0)
[    9.105085] OF: fdt: not creating '/sys/firmware/fdt': CRC check failed
[    9.187465] Freeing unused kernel memory: 312K
[    9.240626] This architecture does not have kernel memory protection.
[    9.317804] Run /init as init process
[    9.701647] SCSI subsystem initialized
[    9.813340] libata version 3.00 loaded.
[    9.817734] sata_mv 0000:01:00.0: version 1.28
[    9.817936] sata_mv 0000:01:00.0: Gen-IIE 32 slots 4 ports SCSI mode IRQ via INTx
[    9.935875] scsi host0: sata_mv
[    9.975689] scsi host1: sata_mv
[   10.014238] scsi host2: sata_mv
[   10.052863] scsi host3: sata_mv
[   10.091365] ata1: SATA max UDMA/133 mmio m1048576@0xe0000000 port 0xe0022000 irq 38
[   10.183078] ata2: SATA max UDMA/133 mmio m1048576@0xe0000000 port 0xe0024000 irq 38
[   10.274832] ata3: SATA max UDMA/133 mmio m1048576@0xe0000000 port 0xe0026000 irq 38
[   10.366596] ata4: SATA max UDMA/133 mmio m1048576@0xe0000000 port 0xe0028000 irq 38
[   10.460753] sata_mv f1080000.sata: version 1.28
[   10.460943] sata_mv f1080000.sata: slots 32 ports 2
[   10.523407] scsi host4: sata_mv
[   10.562059] scsi host5: sata_mv
[   10.600528] ata5: SATA max UDMA/133 irq 35
[   10.649610] ata6: SATA max UDMA/133 irq 35
[   10.958859] ata1: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
[   11.033008] ata5: SATA link down (SStatus 0 SControl F300)
[   11.101308] ata1.00: ATA-9: ST4000VN000-1H4168, SC43, max UDMA/133
[   11.175298] ata1.00: 7814037168 sectors, multi 0: LBA48 NCQ (depth 31/32)
[   11.263567] ata1.00: configured for UDMA/133
[   11.314952] scsi 0:0:0:0: Direct-Access     ATA      ST4000VN000-1H41 SC43 PQ: 0 ANSI: 5
[   11.886862] ata2: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
[   11.982880] ata2.00: ATA-9: WDC WD80EFZX-68UW8N0, 83.H0A83, max UDMA/133
[   12.063164] ata2.00: 15628053168 sectors, multi 0: LBA48 NCQ (depth 31/32)
[   12.152500] ata2.00: configured for UDMA/133
[   12.203842] scsi 1:0:0:0: Direct-Access     ATA      WDC WD80EFZX-68U 0A83 PQ: 0 ANSI: 5
[   12.774861] ata3: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
[   12.853661] ata3.00: ATA-9: ST4000VN000-1H4168, SC43, max UDMA/133
[   12.927687] ata3.00: 7814037168 sectors, multi 0: LBA48 NCQ (depth 31/32)
[   13.013952] ata3.00: configured for UDMA/133
[   13.065330] scsi 2:0:0:0: Direct-Access     ATA      ST4000VN000-1H41 SC43 PQ: 0 ANSI: 5
[   18.674828] ata4: link is slow to respond, please be patient (ready=0)
[   23.190825] ata4: SRST failed (errno=-16)
[   28.750825] ata4: link is slow to respond, please be patient (ready=0)
[   28.886851] ata4: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
[   28.983116] ata4.00: ATA-10: ST8000VN0022-2EL112, SC61, max UDMA/133
[   29.059262] ata4.00: 15628053168 sectors, multi 0: LBA48 NCQ (depth 31/32)
[   29.203114] ata4.00: configured for UDMA/133
[   29.254502] scsi 3:0:0:0: Direct-Access     ATA      ST8000VN0022-2EL SC61 PQ: 0 ANSI: 5
[   29.669085] ata6: SATA link down (SStatus 0 SControl F300)
[   29.781355] sd 0:0:0:0: [sda] 7814037168 512-byte logical blocks: (4.00 TB/3.64 TiB)
[   29.874119] sd 0:0:0:0: [sda] 4096-byte physical blocks
[   29.939162] sd 1:0:0:0: [sdb] 15628053168 512-byte logical blocks: (8.00 TB/7.28 TiB)
[   30.032957] sd 1:0:0:0: [sdb] 4096-byte physical blocks
[   30.100119] sd 2:0:0:0: [sdc] 7814037168 512-byte logical blocks: (4.00 TB/3.64 TiB)
[   30.192956] sd 2:0:0:0: [sdc] 4096-byte physical blocks
[   30.256870] sd 3:0:0:0: [sdd] 15628053168 512-byte logical blocks: (8.00 TB/7.28 TiB)
[   30.350755] sd 3:0:0:0: [sdd] 4096-byte physical blocks
[   30.417650] sd 0:0:0:0: [sda] Write Protect is off
[   30.475017] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
[   30.475073] sd 2:0:0:0: [sdc] Write Protect is off
[   30.532396] sd 2:0:0:0: [sdc] Mode Sense: 00 3a 00 00
[   30.532446] sd 1:0:0:0: [sdb] Write Protect is off
[   30.589788] sd 1:0:0:0: [sdb] Mode Sense: 00 3a 00 00
[   30.589835] sd 3:0:0:0: [sdd] Write Protect is off
[   30.647186] sd 3:0:0:0: [sdd] Mode Sense: 00 3a 00 00
[   30.647281] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[   30.755779] sd 2:0:0:0: [sdc] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[   30.864207] sd 1:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[   30.972635] sd 3:0:0:0: [sdd] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[   31.133042]  sdd: sdd1
[   31.164256] sd 3:0:0:0: [sdd] Attached SCSI disk
[   31.220142]  sda: sda1
[   31.248683]  sdb: sdb1
[   31.277729]  sdc: sdc1
[   31.308851] sd 0:0:0:0: [sda] Attached SCSI disk
[   31.364475] sd 1:0:0:0: [sdb] Attached SCSI disk
[   31.421567] sd 2:0:0:0: [sdc] Attached SCSI disk
[   31.903087] raid6: int32x1  gen()   115 MB/s
[   32.019167] raid6: int32x1  xor()    80 MB/s
[   32.135199] raid6: int32x2  gen()   147 MB/s
[   32.251090] raid6: int32x2  xor()   115 MB/s
[   32.367006] raid6: int32x4  gen()   160 MB/s
[   32.482976] raid6: int32x4  xor()   107 MB/s
[   32.599072] raid6: int32x8  gen()   165 MB/s
[   32.715093] raid6: int32x8  xor()   112 MB/s
[   32.766204] raid6: using algorithm int32x8 gen() 165 MB/s
[   32.830884] raid6: .... xor() 112 MB/s, rmw enabled
[   32.889317] raid6: using intx1 recovery algorithm
[   32.950462] async_tx: api initialized (async)
[   33.004336] xor: measuring software checksum speed
[   33.098821]    arm4regs  :  1445.000 MB/sec
[   33.186822]    8regs     :   868.000 MB/sec
[   33.274820]    32regs    :  1261.000 MB/sec
[   33.324915] xor: using function: arm4regs (1445.000 MB/sec)
[   33.409136] md/raid:md0: not clean -- starting background reconstruction
[   33.490502] md/raid:md0: device sdb1 operational as raid disk 1
[   33.561379] md/raid:md0: device sdd1 operational as raid disk 3
[   33.632294] md/raid:md0: device sda1 operational as raid disk 0
[   33.703224] md/raid:md0: device sdc1 operational as raid disk 2
[   33.776591] md/raid:md0: raid level 5 active with 4 out of 4 devices, algorithm 2
[   33.889881] random: crng init done
[   33.970935] md0: detected capacity change from 0 to 12001949515776
[   34.453590] device-mapper: uevent: version 1.0.3
[   34.511710] device-mapper: ioctl: 4.39.0-ioctl (2018-04-03) initialised: dm-devel@redhat.com
[   35.186390] md: resync of RAID array md0
[   35.522807] EXT4-fs (dm-0): mounted filesystem with ordered data mode. Opts: (null)
[   36.900903] systemd[1]: System time before build time, advancing clock.
[   37.263452] systemd[1]: Inserted module 'autofs4'
[   37.425524] NET: Registered protocol family 10
[   37.725561] Segment Routing with IPv6
[   37.855847] systemd[1]: systemd 241 running in system mode. (+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN -PCRE2 default-hierarchy=hybrid)
[   38.115774] systemd[1]: Detected architecture arm.
[   38.304898] systemd[1]: Set hostname to <debian>.
[   39.474221] systemd[1]: File /lib/systemd/system/systemd-journald.service:12 configures an IP firewall (IPAddressDeny=any), but the local system does not support BPF/cgroup based firewalling.
[   39.685566] systemd[1]: Proceeding WITHOUT firewalling in effect! (This warning is only shown for the first loaded unit using IP firewalling.)
[   40.680693] systemd[1]: Reached target Remote File Systems.
[   40.839453] systemd[1]: Listening on initctl Compatibility Named Pipe.
[   41.025049] systemd[1]: Created slice User and Session Slice.
[   41.180847] systemd[1]: Created slice system-systemd\x2dfsck.slice.
[   41.347842] systemd[1]: Reached target Slices.
[   42.549484] input: gpio_keys as /devices/platform/gpio_keys/input/input0
[   42.859376] systemd[1]: Started Dispatch Password Requests to Console Directory Watch.
[   43.075185] systemd[1]: Reached target Local Encrypted Volumes.
[   43.239218] systemd[1]: Reached target Paths.
[   43.371026] systemd[1]: Starting Journal Service...
[   43.544284] systemd[1]: Starting udev Coldplug all Devices...
[   43.775828] systemd[1]: Listening on Device-mapper event daemon FIFOs.
[   44.103610] systemd[1]: Listening on LVM2 poll daemon socket.
[   44.312143] systemd[1]: Starting Availability of block devices...
[   44.486977] systemd[1]: Starting Remount Root and Kernel File Systems...
[   44.665017] systemd[1]: Starting Monitoring of LVM2 mirrors, snapshots etc. using dmeventd or progress polling...
[   45.148004] EXT4-fs (dm-0): re-mounted. Opts: errors=remount-ro
[   46.692211] systemd-journald[209]: Received request to flush runtime journal from PID 1
[   48.069753] sd 0:0:0:0: Attached scsi generic sg0 type 0
[   48.424672] rtc-s35390a 0-0030: rtc core: registered rtc-s35390a as rtc0
[   48.544705] orion_wdt: Initial timeout 21 sec
[   48.678609] usbcore: registered new interface driver usbfs
[   48.763271] marvell-cesa f1030000.crypto: CESA device successfully registered
[   48.875721] mv643xx_eth: MV-643xx 10/100/1000 ethernet driver version 1.4
[   49.017299] sd 1:0:0:0: Attached scsi generic sg1 type 0
[   49.379748] rtc-mv f1010300.rtc: internal RTC not ticking
[   49.446058] usbcore: registered new interface driver hub
[   49.535050] sd 2:0:0:0: Attached scsi generic sg2 type 0
[   49.627709] mv643xx_eth_port mv643xx_eth_port.0: DMA mask not set
[   50.010963] usbcore: registered new device driver usb
[   50.096453] sd 3:0:0:0: Attached scsi generic sg3 type 0
[   50.284607] m25p80 spi0.0: m25p128 (16384 Kbytes)
[   50.411877] mv643xx_eth_port mv643xx_eth_port.0 eth0: port 0 with MAC address 00:08:9b:xx:xx:x1
[   50.761846] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[   51.071662] 6 fixed-partitions partitions found on MTD device spi0.0
[   51.147749] Creating 6 MTD partitions on "spi0.0":
[   51.309316] mv643xx_eth_port mv643xx_eth_port.1: DMA mask not set
[   51.422074] ehci-orion: EHCI orion driver
[   51.603091] orion-ehci f1050000.ehci: EHCI Host Controller
[   51.765472] 0x000000000000-0x000000080000 : "U-Boot"
[   51.839909] mv643xx_eth_port mv643xx_eth_port.1 eth1: port 0 with MAC address 00:08:9b:xx:xx:x2
[   51.990905] orion-ehci f1050000.ehci: new USB bus registered, assigned bus number 1
[   52.146867] 0x000000200000-0x000000400000 : "Kernel"
[   52.372650] orion-ehci f1050000.ehci: irq 32, io mem 0xf1050000
[   52.457471] 0x000000400000-0x000000d00000 : "RootFS1"
[   52.634569] 0x000000d00000-0x000001000000 : "RootFS2"
[   52.722872] orion-ehci f1050000.ehci: USB 2.0 started, EHCI 1.00
[   52.890163] 0x000000080000-0x0000000c0000 : "U-Boot Config"
[   53.000798] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 4.19
[   53.100119] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[   53.186681] usb usb1: Product: EHCI Host Controller
[   53.245111] usb usb1: Manufacturer: Linux 4.19.0-21-marvell ehci_hcd
[   53.321245] usb usb1: SerialNumber: f1050000.ehci
[   53.472689] 0x0000000c0000-0x000000200000 : "NAS Config"
[   54.276594] hub 1-0:1.0: USB hub found
[   54.437556] hub 1-0:1.0: 1 port detected
[   54.835041] usb 1-1: new high-speed USB device number 2 using orion-ehci
[   54.960509] Adding 974844k swap on /dev/mapper/lvm-swap.  Priority:-2 extents:1 across:974844k FS
[   55.253920] usb 1-1: New USB device found, idVendor=05e3, idProduct=0608, bcdDevice=77.63
[   55.355128] usb 1-1: New USB device strings: Mfr=0, Product=1, SerialNumber=0
[   55.457282] usb 1-1: Product: USB2.0 Hub
[   55.815397] hub 1-1:1.0: USB hub found
[   55.877894] hub 1-1:1.0: 4 ports detected
[  356.406754] EXT4-fs (dm-2): mounted filesystem with ordered data mode. Opts: (null)
[  357.363138] audit: type=1400 audit(1550139438.460:2): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/bin/man" pid=315 comm="apparmor_parser"
[  358.071419] audit: type=1400 audit(1550139438.460:3): apparmor="STATUS" operation="profile_load" profile="unconfined" name="man_filter" pid=315 comm="apparmor_parser"
[  358.521027] audit: type=1400 audit(1550139438.460:4): apparmor="STATUS" operation="profile_load" profile="unconfined" name="man_groff" pid=315 comm="apparmor_parser"
[  358.709118] audit: type=1400 audit(1550139438.672:5): apparmor="STATUS" operation="profile_load" profile="unconfined" name="nvidia_modprobe" pid=317 comm="apparmor_parser"
[  358.905508] audit: type=1400 audit(1550139438.672:6): apparmor="STATUS" operation="profile_load" profile="unconfined" name="nvidia_modprobe//kmod" pid=317 comm="apparmor_parser"
[  359.112815] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[  359.307650] NET: Registered protocol family 17
[  361.562718] mv643xx_eth_port mv643xx_eth_port.0 eth0: link up, 1000 Mb/s, full duplex, flow control disabled
[  362.633792] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
amouiche commented 1 year ago

Hello,

the 'NAS config' partition really only hold stuff required (even not sure ?) for the QNAP firmware. The script tries to resize it for clean behavior, but, given you keep a MTD backup of the content for the case you will recover the QNAP original firmware, we can consider to force the new partition layout, even if the'NAS config' resize failed.

Either you do it manually with a mkfs.ext2, or I can also add a option to the script to force and apply the new partition layout

What do you think ? Arnaud

On Tue, 2023-06-20 at 07:07 -0700, dauhonk wrote:

I recently installed Debian 10 on my Qnap TS419P+ device. Before upgrading to bullseye I did a MDT backup and started the resize script in dry-mode. Unfortunately the output shows some errors: [Check of the QNAP model and see if supported] kirkwood-qnap: machine: QNAP TS419 family DTB file: kirkwood-ts419-6282.dtb Checking: flashcp -V Checking: flash_erase --version Using 'u-boot-tools' package

[find on which MTD device partitions are currently mounted] spi0.0

[Dump current U-boot config'] Current U-boot bootcmd: uart1 0x68;cp.l 0xf8200000 0x800000 0x80000;cp.l 0xf8400000 0xa00000 0x240000;bootm 0x800000 Current U-boot bootargs: console=ttyS0,115200 root=/dev/ram initrd=0xa00000,0x900000 ramdisk=34816

[Prepare new 'bootcmd'] Old: uart1 0x68;cp.l 0xf8200000 0x800000 0x80000;cp.l 0xf8400000 0xa00000 0x240000;bootm 0x800000 New: uart1 0x68;cp.l 0xf8100000 0x800000 0xc0000;cp.l 0xf8400000 0xb00000 0x300000;bootm 0x800000;echo Kernel_legacy layout fallback;bootm 0x900000

[Prepare new 'bootargs'] Old: console=ttyS0,115200 root=/dev/ram initrd=0xa00000,0x900000 ramdisk=34816 New: console=ttyS0,115200 root=/dev/ram initrd=0xb00000,0xc00000 ramdisk=34816 @.**@*.**@*.**@*.**@*.**@.(NAS_Config) @.**@*.**@*.**@*.**@*.**@.(NAS_Config)

[Prepare fw_setenv script (/tmp/fw_setenv.script)]

[Dump current 'NAS config' and 'Kernel' images]

  • cat /dev/mtd5 [Resize 'NAS config' dump from 1280KB to 256KB.]
  • modprobe loop
  • losetup --show -f /tmp/mtd_nas_config.dump
  • loopdev=/dev/loop0
  • e2fsck -f -p -v /dev/loop0 /dev/loop0: Duplicate or bad block in use! /dev/loop0: Multiply-claimed block(s) in inode 13: 39 /dev/loop0: Multiply-claimed block(s) in inode 16: 39 /dev/loop0: (There are 2 inodes containing multiply-claimed blocks.)

/dev/loop0: File /BOOT_COUNT (inode #13, mod time Thu Aug 1 16:34:53 2013) has 1 multiply-claimed block(s), shared with 1 file(s): /dev/loop0: /smb.conf.cksum (inode #16, mod time Fri Jun 9 15:12:29 2023) /dev/loop0:

/dev/loop0: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY. (i.e., without -a or -p options)

  • true
  • e2fsck -f -p -v /dev/loop0 /dev/loop0: Duplicate or bad block in use! /dev/loop0: Multiply-claimed block(s) in inode 13: 39 /dev/loop0: Multiply-claimed block(s) in inode 16: 39 /dev/loop0: (There are 2 inodes containing multiply-claimed blocks.)

/dev/loop0: File /BOOT_COUNT (inode #13, mod time Thu Aug 1 16:34:53 2013) has 1 multiply-claimed block(s), shared with 1 file(s): /dev/loop0: /smb.conf.cksum (inode #16, mod time Fri Jun 9 15:12:29 2023) /dev/loop0:

/dev/loop0: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY. (i.e., without -a or -p options)

  • echo e2fsck failed. 'NAS config' resize not possible automatically e2fsck failed. 'NAS config' resize not possible automatically
  • losetup -d /dev/loop0
  • exit 1 Traceback (most recent call last): File "./qnap_mtd_resize.py", line 446, in subprocess.check_call(cmd, shell=True) File "/usr/lib/python3.7/subprocess.py", line 347, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command ' set -e set -x modprobe loop

    loopdev=$(losetup --show -f /tmp/mtd_nas_config.dump)

    run e2fsck twice. the First may return an error status even if FS is corrected

    e2fsck -f -p -v $loopdev || true if ! e2fsck -f -p -v $loopdev; then echo "e2fsck failed. 'NAS config' resize not possible automatically" losetup -d $loopdev exit 1 fi

    if ! resize2fs $loopdev 128; then echo "resize2fs failed. 'NAS config' resize not possible automatically" losetup -d $loopdev exit 1 fi losetup -d $loopdev ' returned non-zero exit status 1.

As a filesystem noob I thought to fix the error with sudo losetup -f /tmp/mtd_nas_config.dump sudo e2fsck -f -v /dev/loop0 sudo e2fsck -f -v /dev/loop0 #needed to run twice for error fix sudo losetup -d /dev/loop0 e2fsck output: e2fsck 1.44.5 (15-Dec-2018) Pass 1: Checking inodes, blocks, and sizes

Running additional passes to resolve blocks claimed by more than one inode... Pass 1B: Rescanning for multiply-claimed blocks Multiply-claimed block(s) in inode 13: 39 Multiply-claimed block(s) in inode 16: 39 Pass 1C: Scanning directories for inodes with multiply-claimed blocks Pass 1D: Reconciling multiply-claimed blocks (There are 2 inodes containing multiply-claimed blocks.)

File /BOOT_COUNT (inode #13, mod time Thu Aug 1 16:34:53 2013) has 1 multiply-claimed block(s), shared with 1 file(s): /smb.conf.cksum (inode #16, mod time Fri Jun 9 15:12:29 2023) Clone multiply-claimed blocks? yes File /smb.conf.cksum (inode #16, mod time Fri Jun 9 15:12:29 2023) has 1 multiply-claimed block(s), shared with 1 file(s): /BOOT_COUNT (inode #13, mod time Thu Aug 1 16:34:53 2013) Multiply-claimed blocks already reassigned or cloned.

Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information Block bitmap differences: -513 Fix? yes to all Free blocks count wrong for group #0 (966, counted=965). Fix? yes

Free blocks count wrong (966, counted=965). Fix? yes

/dev/loop0: FILE SYSTEM WAS MODIFIED

      19 inodes used (14.84%, out of 128)
       2 non-contiguous files (10.5%)
       0 non-contiguous directories (0.0%)
         # of inodes with ind/dind/tind blocks: 0/0/0
      59 blocks used (5.76%, out of 1024)
       0 bad blocks
       0 large files

       8 regular files
       2 directories
       0 character device files
       0 block device files
       0 fifos
       0 links
       0 symbolic links (0 fast symbolic links)
       0 sockets

      10 files

Restarting the resize script after this does result in the same error as the first time. Currently I am stuck with buster. What am I missing? Is there a way to fix the error? Is maybe the creation of "mtd_nas_config.dump" buggy? Any ideas are welcome. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

dauhonk commented 1 year ago

Thank you for the quick response! I do not have a deep knowledge when it comes to filesystem partitioning. I would appreciate it, if you could provide the commands to manually force the layout. What are the necessary steps afterwards? Do I need to start your script again?

A command line switch for the script would be perfect in case anyone else experiences a similar problem.