[Solved] Espressobin: openwrt accessible after second powerup

Hi,
I am using openwrt ( OpenWrt 18.06.0 r7188-b0b5c64c22 / LuCI openwrt-18.06 branch (git-19.324.23087-ab9c812) on espressobin v5 (booting from sd card) on a remote place for 1.5 year.

It's been more than a month now that the power at place is unstable and with 5-6 power losses per week.
For some reason since last month, I can access (ssh or luci) openwrt on espressobin only after every second power loss.
During the first power loss, I can't access openwrt but internal espressobin switch works as I can access an ip camera connected to the switch. I only use the lan ports not the wan port and I have one usb to rs485 converter hooked on one usb port.

Could anyone help me debug - solve this issue?

I attach dmesg and uboot env.

Dmsg

Summary
root@OpenWrt:~# dmesg
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.14.54 (buildbot@builds-03.infra.lede-project.org) (gcc version 7.3.0 (OpenWrt GCC 7.3.0 r7101-a63e38b)) #0 SMP Sat Jul 14 11:10:08 2018
[    0.000000] Boot CPU: AArch64 Processor [410fd034]
[    0.000000] Machine model: Globalscale Marvell ESPRESSOBin Board
[    0.000000] earlycon: ar3700_uart0 at MMIO 0x00000000d0012000 (options '')
[    0.000000] bootconsole [ar3700_uart0] enabled
[    0.000000] On node 0 totalpages: 262144
[    0.000000]   DMA zone: 4096 pages used for memmap
[    0.000000]   DMA zone: 0 pages reserved
[    0.000000]   DMA zone: 262144 pages, LIFO batch:31
[    0.000000] psci: probing for conduit method from DT.
[    0.000000] psci: PSCIv1.0 detected in firmware.
[    0.000000] psci: Using standard PSCI v0.2 function IDs
[    0.000000] psci: MIGRATE_INFO_TYPE not supported.
[    0.000000] psci: SMC Calling Convention v1.0
[    0.000000] random: get_random_bytes called from 0xffffff80086d0810 with crng_init=0
[    0.000000] percpu: Embedded 17 pages/cpu @ffffffc03ffc5000 s29080 r8192 d32360 u69632
[    0.000000] pcpu-alloc: s29080 r8192 d32360 u69632 alloc=17*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 
[    0.000000] Detected VIPT I-cache on CPU0
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 258048
[    0.000000] Kernel command line: root=PARTUUID=15329679-02 rw rootwait console=ttyMV0,115200 earlycon=ar3700_uart,0xd0012000
[    0.000000] PID hash table entries: 4096 (order: 3, 32768 bytes)
[    0.000000] Dentry cache hash table entries: 131072 (order: 8, 1048576 bytes)
[    0.000000] Inode-cache hash table entries: 65536 (order: 7, 524288 bytes)
[    0.000000] Memory: 1022888K/1048576K available (5438K kernel code, 368K rwdata, 1004K rodata, 320K init, 302K bss, 25688K reserved, 0K cma-reserved)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     modules : 0xffffff8000000000 - 0xffffff8008000000   (   128 MB)
[    0.000000]     vmalloc : 0xffffff8008000000 - 0xffffffbebfff0000   (   250 GB)
[    0.000000]       .text : 0xffffff8008080000 - 0xffffff80085d0000   (  5440 KB)
[    0.000000]     .rodata : 0xffffff80085d0000 - 0xffffff80086d0000   (  1024 KB)
[    0.000000]       .init : 0xffffff80086d0000 - 0xffffff8008720000   (   320 KB)
[    0.000000]       .data : 0xffffff8008720000 - 0xffffff800877c008   (   369 KB)
[    0.000000]        .bss : 0xffffff800877c008 - 0xffffff80087c7958   (   303 KB)
[    0.000000]     fixed   : 0xffffffbefe7fb000 - 0xffffffbefec00000   (  4116 KB)
[    0.000000]     PCI I/O : 0xffffffbefee00000 - 0xffffffbeffe00000   (    16 MB)
[    0.000000]     vmemmap : 0xffffffbf00000000 - 0xffffffc000000000   (     4 GB maximum)
[    0.000000]               0xffffffbf00000000 - 0xffffffbf01000000   (    16 MB actual)
[    0.000000]     memory  : 0xffffffc000000000 - 0xffffffc040000000   (  1024 MB)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[    0.000000] Hierarchical RCU implementation.
[    0.000000] 	CONFIG_RCU_FANOUT set to non-default value of 32
[    0.000000] 	RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.
[    0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2
[    0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[    0.000000] GICv3: GIC: Using split EOI/Deactivate mode
[    0.000000] GICv3: no VLPI support, no direct LPI support
[    0.000000] GICv3: CPU0: found redistributor 0 region 0:0x00000000d1d40000
[    0.000000] arch_timer: cp15 timer(s) running at 12.50MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x2e2049cda, max_idle_ns: 440795202628 ns
[    0.000004] sched_clock: 56 bits at 12MHz, resolution 80ns, wraps every 4398046511080ns
[    0.008352] Calibrating delay loop (skipped), value calculated using timer frequency.. 25.00 BogoMIPS (lpj=125000)
[    0.018943] pid_max: default: 32768 minimum: 301
[    0.023767] Mount-cache hash table entries: 2048 (order: 2, 16384 bytes)
[    0.030600] Mountpoint-cache hash table entries: 2048 (order: 2, 16384 bytes)
[    0.038637] ASID allocator initialised with 32768 entries
[    0.044190] Hierarchical SRCU implementation.
[    0.048930] smp: Bringing up secondary CPUs ...
[    0.053774] Detected VIPT I-cache on CPU1
[    0.053803] GICv3: CPU1: found redistributor 1 region 0:0x00000000d1d60000
[    0.053834] CPU1: Booted secondary processor [410fd034]
[    0.053910] smp: Brought up 1 node, 2 CPUs
[    0.074617] SMP: Total of 2 processors activated.
[    0.079458] CPU features: detected feature: GIC system register CPU interface
[    0.086810] CPU features: detected feature: 32-bit EL0 Support
[    0.092807] CPU features: detected feature: Kernel page table isolation (KPTI)
[    0.102599] CPU: All CPU(s) started at EL2
[    0.106736] alternatives: patching kernel code
[    0.113095] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.123188] futex hash table entries: 512 (order: 4, 65536 bytes)
[    0.129516] pinctrl core: initialized pinctrl subsystem
[    0.135437] NET: Registered protocol family 16
[    0.140635] cpuidle: using governor ladder
[    0.144905] vdso: 2 pages (1 code @ ffffff80085d4000, 1 data @ ffffff8008724000)
[    0.152634] DMA: preallocated 256 KiB pool for atomic allocations
[    0.159810] d0012000.serial: ttyMV0 at MMIO 0xd0012000 (irq = 9, base_baud = 0) is a mvebu-uart
[    0.168706] console [ttyMV0] enabled
[    0.176078] bootconsole [ar3700_uart0] disabled
[    0.193967] SCSI subsystem initialized
[    0.197890] libata version 3.00 loaded.
[    0.198084] usbcore: registered new interface driver usbfs
[    0.203347] usbcore: registered new interface driver hub
[    0.209247] usbcore: registered new device driver usb
[    0.215184] clocksource: Switched to clocksource arch_sys_counter
[    0.222176] NET: Registered protocol family 2
[    0.227244] TCP established hash table entries: 8192 (order: 4, 65536 bytes)
[    0.234333] TCP bind hash table entries: 8192 (order: 5, 131072 bytes)
[    0.241278] TCP: Hash tables configured (established 8192 bind 8192)
[    0.247803] UDP hash table entries: 512 (order: 2, 16384 bytes)
[    0.253896] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
[    0.260230] NET: Registered protocol family 1
[    0.264594] PCI: CLS 0 bytes, default 128
[    0.265537] Crashlog allocated RAM at address 0x3f00000
[    0.271216] workingset: timestamp_bits=62 max_order=18 bucket_order=0
[    0.281108] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.287166] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.298641] io scheduler noop registered
[    0.302702] io scheduler deadline registered (default)
[    0.310264] OF: PCI: host bridge /soc/pcie@d0070000 ranges:
[    0.316097] OF: PCI:   MEM 0xe8000000..0xe8ffffff -> 0xe8000000
[    0.322221] OF: PCI:    IO 0xe9000000..0xe900ffff -> 0xe9000000
[    1.325176] advk-pcie d0070000.pcie: link never came up
[    1.330549] advk-pcie d0070000.pcie: PCI host bridge to bus 0000:00
[    1.337074] pci_bus 0000:00: root bus resource [bus 00-ff]
[    1.342747] pci_bus 0000:00: root bus resource [mem 0xe8000000-0xe8ffffff]
[    1.349776] pci_bus 0000:00: root bus resource [io  0x0000-0xffff] (bus address [0xe9000000-0xe900ffff])
[    1.365161] advk-pcie d0070000.pcie: config read/write timed out
[    1.372309] mv_xor d0060900.xor: Marvell shared XOR driver
[    1.445728] mv_xor d0060900.xor: Marvell XOR (Descriptor Mode): ( xor cpy intr )
[    1.525726] mv_xor d0060900.xor: Marvell XOR (Descriptor Mode): ( xor cpy intr )
[    1.533690] Serial: 8250/16550 driver, 16 ports, IRQ sharing enabled
[    1.541530] cacheinfo: Unable to detect cache hierarchy for CPU 0
[    1.550033] loop: module loaded
[    1.553611] ahci-mvebu d00e0000.sata: AHCI 0001.0300 32 slots 1 ports 6 Gbps 0x1 impl platform mode
[    1.562649] ahci-mvebu d00e0000.sata: flags: ncq sntf led only pmp fbs pio slum part sxs 
[    1.571827] scsi host0: ahci-mvebu
[    1.575124] ata1: SATA max UDMA/133 mmio [mem 0xd00e0000-0xd00e1fff] port 0x100 irq 14
[    1.587706] random: fast init done
[    1.597061] m25p80 spi0.0: w25q32dw (4096 Kbytes)
[    1.602990] libphy: Fixed MDIO Bus: probed
[    1.607607] libphy: orion_mdio_bus: probed
[    1.611994] mv88e6085 d0032004.mdio-mii:01: switch 0x3410 detected: Marvell 88E6341, revision 0
[    1.628721] libphy: /soc/internal-regs@d0000000/mdio@32004/switch0@1/mdio: probed
[    1.644818] mvneta d0030000.ethernet eth0: Using device tree mac address f0:ad:4e:05:36:b4
[    1.653560] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    1.660327] ehci-pci: EHCI PCI platform driver
[    1.664973] ehci-platform: EHCI generic platform driver
[    1.670385] ehci-orion: EHCI orion driver
[    1.674631] orion-ehci d005e000.usb: EHCI Host Controller
[    1.680243] orion-ehci d005e000.usb: new USB bus registered, assigned bus number 1
[    1.687823] orion-ehci d005e000.usb: irq 12, io mem 0xd005e000
[    1.715175] orion-ehci d005e000.usb: USB 2.0 started, EHCI 1.00
[    1.721588] hub 1-0:1.0: USB hub found
[    1.725125] hub 1-0:1.0: 1 port detected
[    1.729894] xhci-hcd d0058000.usb: xHCI Host Controller
[    1.734958] xhci-hcd d0058000.usb: new USB bus registered, assigned bus number 2
[    1.742990] xhci-hcd d0058000.usb: hcc params 0x0a000998 hci version 0x100 quirks 0x00010010
[    1.751682] xhci-hcd d0058000.usb: irq 11, io mem 0xd0058000
[    1.757677] hub 2-0:1.0: USB hub found
[    1.761305] hub 2-0:1.0: 1 port detected
[    1.765356] xhci-hcd d0058000.usb: xHCI Host Controller
[    1.770644] xhci-hcd d0058000.usb: new USB bus registered, assigned bus number 3
[    1.778481] xhci-hcd d0058000.usb: Host supports USB 3.0  SuperSpeed
[    1.784803] usb usb3: We don't know the algorithms for LPM for this host, disabling LPM.
[    1.793612] hub 3-0:1.0: USB hub found
[    1.797251] hub 3-0:1.0: 1 port detected
[    1.801444] usbcore: registered new interface driver usb-storage
[    1.807765] i2c /dev entries driver
[    1.811616] sdhci: Secure Digital Host Controller Interface driver
[    1.817846] sdhci: Copyright(c) Pierre Ossman
[    1.822575] sdhci-pltfm: SDHCI platform and OF driver helper
[    1.828489] xenon-sdhci d00d0000.sdhci: Got CD GPIO
[    1.833906] NET: Registered protocol family 10
[    1.839272] Segment Routing with IPv6
[    1.842929] NET: Registered protocol family 17
[    1.847252] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.
[    1.861266] 8021q: 802.1Q VLAN Support v1.8
[    1.867729] mv88e6085 d0032004.mdio-mii:01: switch 0x3410 detected: Marvell 88E6341, revision 0
[    1.884472] libphy: /soc/internal-regs@d0000000/mdio@32004/switch0@1/mdio: probed
[    1.898672] DSA: switch 0 0 parsed
[    1.902196] DSA: tree 0 parsed
[    1.906521] ata1: SATA link down (SStatus 0 SControl 300)
[    2.095177] usb 1-1: new full-speed USB device number 2 using orion-ehci
[    2.617115] Marvell 88E6390 !soc!internal-regs@d0000000!mdio@32004!switch0@1!mdio:11: attached PHY driver [Marvell 88E6390] (mii_bus:phy_addr=!soc!internal-regs@d0000000!mdio@32004!switch0@1!mdio:11, irq=POLL)
[    2.737116] Marvell 88E6390 !soc!internal-regs@d0000000!mdio@32004!switch0@1!mdio:12: attached PHY driver [Marvell 88E6390] (mii_bus:phy_addr=!soc!internal-regs@d0000000!mdio@32004!switch0@1!mdio:12, irq=POLL)
[    2.877114] Marvell 88E6390 !soc!internal-regs@d0000000!mdio@32004!switch0@1!mdio:13: attached PHY driver [Marvell 88E6390] (mii_bus:phy_addr=!soc!internal-regs@d0000000!mdio@32004!switch0@1!mdio:13, irq=POLL)
[    2.896999] xenon-sdhci d00d0000.sdhci: Got CD GPIO
[    2.965296] genirq: Setting trigger mode 3 for irq 35 failed (0xffffff80082f68c8)
[    2.972886] mmc0: SDHCI controller on d00d0000.sdhci [d00d0000.sdhci] using ADMA
[    2.980691] hctosys: unable to open rtc device (rtc0)
[    2.987351] Waiting for root device PARTUUID=15329679-02...
[    3.036289] mmc0: new high speed SDHC card at address fc72
[    3.043185] mmcblk0: mmc0:fc72 SU08G 7.40 GiB 
[    3.050511]  mmcblk0: p1 p2
[    3.068031] EXT4-fs (mmcblk0p2): warning: mounting unchecked fs, running e2fsck is recommended
[    3.083992] EXT4-fs (mmcblk0p2): mounted filesystem without journal. Opts: (null)
[    3.091703] VFS: Mounted root (ext4 filesystem) on device 179:2.
[    3.098392] Freeing unused kernel memory: 320K
[    3.253364] init: Console is alive
[    3.436056] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    3.459873] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    3.470839] init: - preinit -
[    3.645876] random: jshn: uninitialized urandom read (4 bytes read)
[    3.671125] random: jshn: uninitialized urandom read (4 bytes read)
[    3.704732] random: jshn: uninitialized urandom read (4 bytes read)
[    6.888493] mount_root: mounting /dev/root
[    6.895549] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[    6.901186] mount_root: loading kmods from internal overlay
[    6.926204] kmodloader: loading kernel modules from //etc/modules-boot.d/*
[    6.933697] kmodloader: done loading kernel modules from //etc/modules-boot.d/*
[    7.107908] block: attempting to load /etc/config/fstab
[    7.115702] block: extroot: not configured
[    7.124395] urandom_read: 2 callbacks suppressed
[    7.124401] random: procd: uninitialized urandom read (4 bytes read)
[    7.198562] fuse init (API version 7.26)
[    7.325409] EXT4-fs (mmcblk0p1): warning: mounting unchecked fs, running e2fsck is recommended
[    7.339222] EXT4-fs (mmcblk0p1): mounted filesystem without journal. Opts: (null)
[    7.421038] urandom-seed: Seeding with /etc/urandom.seed
[    7.447402] procd: - early -
[    8.052844] procd: - ubus -
[    8.068413] random: ubusd: uninitialized urandom read (4 bytes read)
[    8.096778] random: ubusd: uninitialized urandom read (4 bytes read)
[    8.206703] urandom_read: 1 callbacks suppressed
[    8.206722] random: ubusd: uninitialized urandom read (4 bytes read)
[    8.220733] procd: - init -
[    8.435357] kmodloader: loading kernel modules from /etc/modules.d/*
[    8.452156] ip6_tables: (C) 2000-2006 Netfilter Core Team
[    8.789039] Netfilter messages via NETLINK v0.30.
[    8.796418] ip_set: protocol 6
[    8.832846] usbcore: registered new interface driver cdc_wdm
[    8.840482] ip_tables: (C) 2000-2006 Netfilter Core Team
[    9.188424] nf_conntrack version 0.5.0 (8192 buckets, 32768 max)
[    9.404139] usbcore: registered new interface driver usbserial
[    9.410001] usbcore: registered new interface driver usbserial_generic
[    9.416861] usbserial: USB Serial support registered for generic
[    9.425671] wireguard: WireGuard 0.0.20180718 loaded. See www.wireguard.com for information.
[    9.434335] wireguard: Copyright (C) 2015-2018 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
[    9.461481] xt_time: kernel timezone is -0000
[    9.466818] usbcore: registered new interface driver ch341
[    9.472564] usbserial: USB Serial support registered for ch341-uart
[    9.478973] ch341 1-1:1.0: ch341-uart converter detected
[    9.489966] usb 1-1: ch341-uart converter now attached to ttyUSB0
[    9.497998] usbcore: registered new interface driver ftdi_sio
[    9.504139] usbserial: USB Serial support registered for FTDI USB Serial Device
[    9.689530] PPP generic driver version 2.4.2
[    9.697912] NET: Registered protocol family 24
[    9.704290] kmodloader: done loading kernel modules from /etc/modules.d/*
[   11.557899] random: crng init done
[   13.089596] mvneta d0030000.ethernet eth0: configuring for fixed/rgmii-id link mode
[   13.098585] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[   13.104744] mvneta d0030000.ethernet eth0: Link is Up - 1Gbps/Full - flow control off
[   13.114596] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[   13.121456] br-lan: port 1(lan0) entered blocking state
[   13.126773] br-lan: port 1(lan0) entered disabled state
[   13.143257] device lan0 entered promiscuous mode
[   13.148250] device eth0 entered promiscuous mode
[   13.157876] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready
[   13.181995] br-lan: port 2(lan1) entered blocking state
[   13.187343] br-lan: port 2(lan1) entered disabled state
[   13.199876] device lan1 entered promiscuous mode
[   14.302215] mv88e6085 d0032004.mdio-mii:01 lan0: Link is Down
[   14.375531] mv88e6085 d0032004.mdio-mii:01 lan1: Link is Down
[   15.426969] mv88e6085 d0032004.mdio-mii:01 lan1: Link is Up - 100Mbps/Full - flow control rx/tx
[   15.436316] br-lan: port 2(lan1) entered blocking state
[   15.441853] br-lan: port 2(lan1) entered forwarding state
[   15.449396] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
[   26.773564] mv88e6085 d0032004.mdio-mii:01 lan0: Link is Up - 100Mbps/Full - flow control off
[   26.782747] br-lan: port 1(lan0) entered blocking state
[   26.788255] br-lan: port 1(lan0) entered forwarding state

Uboot_env

Summary
root@OpenWrt:~# fw_printenv
baudrate=115200
boot_interface=usb
bootargs=console=ttyMV0,115200 earlycon=ar3700_uart,0xd0012000 root=/dev/nfs rw ip=0.0.0.0:0.0.0.0:10.4.50.254:255.255.255.0:marvell:eth0:none nfsroot=0.0.0.0:/srv/nfs/
bootcmd=load mmc 0:1 0x4d00000 boot.scr; source 0x4d00000
bootdelay=2
console=console=ttyMV0,115200 earlycon=ar3700_uart,0xd0012000
eth1addr=00:51:82:11:22:01
eth2addr=00:51:82:11:22:02
eth3addr=00:51:82:11:22:03
ethact=neta@30000
ethaddr=F0:AD:4E:05:36:B4
ethprime=eth0
fdt_addr=0x4f00000
fdt_high=0xffffffffffffffff
fdt_name=boot/armada-3720-community-v5.dtb
fdtcontroladdr=3f7161b8
gatewayip=10.4.50.254
get_images=tftpboot $kernel_addr $image_name; tftpboot $fdt_addr $fdt_name; run get_ramfs
get_ramfs=if test "${ramfs_name}" != "-"; then setenv ramfs_addr 0x8000000; tftpboot $ramfs_addr $ramfs_name; else setenv ramfs_addr -;fi
hostname=marvell
image_name=boot/Image
initrd_addr=0x1100000
initrd_size=0x2000000
ipaddr=0.0.0.0
kernel_addr=0x5000000
load_script=if test -e mmc 0:1 boot/boot.scr; then echo "... booting from SD";setenv boot_interface mmc;else echo "... booting from USB/SATA";usb start;setenv boot_interface usb;fi;if test -e $boot_interface 0:1 boot/boot.scr;then ext4load $boot_interface 0:1 0x00800000 boot/boot.scr; source; fi
loadaddr=0x5000000
netdev=eth0
netmask=255.255.255.0
ramfs_addr=-
ramfs_name=-
root=root=/dev/nfs rw
rootpath=/srv/nfs/
serverip=0.0.0.0
set_bootargs=setenv bootargs $console $root ip=$ipaddr:$serverip:$gatewayip:$netmask:$hostname:$netdev:none nfsroot=$serverip:$rootpath $extra_params
stderr=serial@12000
stdin=serial@12000
stdout=serial@12000

Maybe the filesystem is corrupt and need a second reboot to get up ?!

1 Like

Indeed, maybe it is corrupt filesystem problem:

[    3.079580] EXT4-fs (mmcblk0p2): warning: mounting unchecked fs, running e2fsck is recommended
[    3.091552] EXT4-fs (mmcblk0p2): mounted filesystem without journal. Opts: (null)
[    6.865536] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)

Any tip how to remotely re-mount the /dev/root as read only and run e2fsck?

To fix this type of issue, I use an overlay system and get filesystems beeing checked and fixed at bootup...

I just wrote an article in a french magazine explaining this technical howto...

The Linux Pratique Magazine #117...

The howto may be also findable on the forum...

Look about fstab and overlaying filesystems... You will need to copy the rootfs content to the overlayed partition !

Hope this will help or, if not, I will try to get my notes ready to you (I am not at home now)

1 Like

I have searched but couldn't find it. Can you please link to this posting?

Here is an advice of the method : https://openwrt.org/docs/guide-user/additional-software/extroot_configuration
I will look into my notes today...
I could explain the specific espressobin method if needed...

Just find this howto, may look better ; https://doc.turris.cz/doc/en/public/extroot

After reading about extroot, it seems that I need to be on site. Can't find any remote option for mounted fs . @erdoukki I would appreciate if you could provide espressobin specific method.
Though, I am not sure if I need to use a usb stick or the sd card is enough.

root@OpenWrt:~# lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
mtdblock0    31:0    0     4M  0 disk
mmcblk0     179:0    0   7.4G  0 disk
├─mmcblk0p1 179:1    0  16.3M  0 part /mnt/mmcblk0p2
└─mmcblk0p2 179:2    0 256.3M  0 part /mnt/mmcblk0p2
root@OpenWrt:~# block info
/dev/mmcblk0p1: UUID="57f8f4bc-abf4-655f-bf67-946fc0f9f25b" VERSION="1.0" MOUNT="/mnt/mmcblk0p2" TYPE="ext4"
/dev/mmcblk0p2: UUID="57f8f4bc-abf4-655f-bf67-946fc0f9f25b" VERSION="1.0" MOUNT="/" TYPE="ext4"

Edit: It seems that there is a way to mount the fs read only on boot here: (How to force all filesystems to read-only at boot?)

extroot overlay

Mainly, I flash the default ext4 openwrt system and then I add a third ext4 partition of the rest of the uSD (or eMMC) and will copy rootfs to it...
The the default rootfs will be used only at bootup and the pivot to extroot overlay will bring the default rootfs readonly...and can be checked and repaired... automagically !

here we go... we add the third ext4 partition
root@OWRT-DEV:/# fdisk /dev/mmcblk0


n
p
3
...
...
w
q

we make it ext4 and format it...
root@OWRT-DEV:/# mkfs.ext4 /dev/mmcblk0p3

we will then add the fstab package (block-mount)

root@OWRT-DEV:/# opkg install block-mount

We create fstab with our filesystems :
root@OWRT-DEV:/# block detect > /etc/config/fstab

We modify fstab with our configuration:
root@OWRT-DEV:/# vi /etc/config/fstab


config mount
        option enabled '1'
        option enabled_fsck '1'
        option target '/'       
        option device '/dev/mmcblk0p3'

we enable block-mount
root@OWRT-DEV:/# /etc/init.d/fstab enable

then we copy the rootfs filesystems to this third partition clone...

mkdir -p /tmp/cproot
mount --bind / /tmp/cproot
mkdir /tmp/mmcblk0p3
mount /dev/mmcblk0p3 /tmp/mmcblk0p3
tar -C /tmp/cproot -cvf - . | tar -C /tmp/mmcblk0p3 -xf -
umount /tmp/cproot
rmdir /tmp/cproot
umount /tmp/mmcblk0p3
rmdir /tmp/mmcblk0p3

we look at the mounted filestysems

root@OWRT-DEV:/# df -h

Filesystem                Size      Used Available Use% Mounted on
/dev/root               252.0M     11.8M    235.0M   5% /
tmpfs                   499.5M    432.0K    499.1M   0% /tmp
tmpfs                   512.0K         0    512.0K   0% /dev

after a reboot, we will check again :
root@OWRT-DEV:/# reboot
...

/dev/mmcblk0p3: clean, 1341/224448 files, 36986/896256 blocks
[    8.408467] EXT4-fs (mmcblk0p3): mounted filesystem with ordered data mode. Opts: 
[    8.418665] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[    8.429790] mount_root: switched to extroot

...
root@OWRT-DEV:/# df -h

Filesystem                Size      Used Available Use% Mounted on
/dev/root               252.0M     11.8M    235.0M   5% /rom
tmpfs                   499.5M     68.0K    499.4M   0% /tmp
/dev/mmcblk0p3            3.3G     25.4M      3.1G   1% /
tmpfs                   512.0K         0    512.0K   0% /dev

Now we can add all needed software, and have also a more stable power-fault espressobin !

Hope this helps...

1 Like

Also take care that this method need to be reapplyed after a sysupgrade...
the sysupgrade is a factory upgrade on the espressobin board...

Thank you very much for the method.
I will prepare a new sd card as you propose and plug it to the espressobin the next time that I will be onsite.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.