OpenWrt Forum Archive

Topic: Raspberry Pi 3 - root mounting as read-only

The content of this topic has been archived on 3 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I am attempting to get OpenWrt running on a Raspberry Pi 3. I tried a couple random images found online and did not have immediate success, so I built from trunk using the default config for the Pi 3. I made a few changes to the cmdline.txt and config.txt files within the image so that the UART console worked.

However, the root filesystem is being mounted as read-only. I don't see any errors in the boot log, just that it is mounting read-only. The boot log is below. You can see the mount entry around timestamp 1.81.

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.4.7 (parallels@ubuntu) (gcc version 5.3.0 (OpenWrt GCC 5.3.0 r49390) ) #3 SMP Fri Jun 24 18:36:14 UTC 2016
[    0.000000] CPU: ARMv7 Processor [410fd034] revision 4 (ARMv7), cr=10c5383d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] Machine model: Raspberry Pi 3 Model B Rev 1.2
[    0.000000] cma: Reserved 16 MiB at 0x3a000000
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] [bcm2709_smp_init_cpus] enter (9480->f3003010)
[    0.000000] [bcm2709_smp_init_cpus] ncores=4
[    0.000000] PERCPU: Embedded 12 pages/cpu @b984f000 s17984 r8192 d22976 u49152
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 239776
[    0.000000] Kernel command line: 8250.nr_uarts=1 dma.dmachans=0x7f35 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2709.boardrev=0xa22082 bcm2709.serial=0x308b76f8 smsc95xx.macaddr=B8:27:EB:8B:76:F8 bcm2708_fb.fbswap=1 bcm2709.uart_clock=3000000 vc_mem.mem_base=0x3dc00000 vc_mem.mem_size=0x3f000000  dwc_otg.lpm_enable=0 console=ttyS0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait
[    0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
[    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: 935540K/966656K available (3922K kernel code, 124K rwdata, 1408K rodata, 220K init, 368K bss, 14732K reserved, 16384K cma-reserved)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0xbb800000 - 0xff800000   (1088 MB)
[    0.000000]     lowmem  : 0x80000000 - 0xbb000000   ( 944 MB)
[    0.000000]     modules : 0x7f000000 - 0x80000000   (  16 MB)
[    0.000000]       .text : 0x80008000 - 0x8053cd2c   (5332 kB)
[    0.000000]       .init : 0x8053d000 - 0x80574000   ( 220 kB)
[    0.000000]       .data : 0x80574000 - 0x8059322c   ( 125 kB)
[    0.000000]        .bss : 0x8059322c - 0x805ef2ac   ( 369 kB)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] Hierarchical RCU implementation.
[    0.000000] NR_IRQS:16 nr_irqs:16 16
[    0.000000] Architected cp15 timer(s) running at 19.20MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x46d987e47, max_idle_ns: 440795202767 ns
[    0.000008] sched_clock: 56 bits at 19MHz, resolution 52ns, wraps every 4398046511078ns
[    0.000023] Switching to timer-based delay loop, resolution 52ns
[    0.000195] Console: colour dummy device 80x30
[    0.000829] console [tty1] enabled
[    0.000871] Calibrating delay loop (skipped), value calculated using timer frequency.. 38.40 BogoMIPS (lpj=192000)
[    0.000927] pid_max: default: 32768 minimum: 301
[    0.001058] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.001090] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.001770] CPU: Testing write buffer coherency: ok
[    0.002207] CPU0: update cpu_capacity 1024
[    0.002237] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.002266] [bcm2709_smp_prepare_cpus] enter
[    0.002377] Setting up static identity map for 0x8240 - 0x8298
[    0.003589] [bcm2709_boot_secondary] cpu:1 started (0) 17
[    0.003862] [bcm2709_secondary_init] enter cpu:1
[    0.003892] CPU1: update cpu_capacity 1024
[    0.003898] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[    0.004200] [bcm2709_boot_secondary] cpu:2 started (0) 18
[    0.004400] [bcm2709_secondary_init] enter cpu:2
[    0.004419] CPU2: update cpu_capacity 1024
[    0.004425] CPU2: thread -1, cpu 2, socket 0, mpidr 80000002
[    0.004706] [bcm2709_boot_secondary] cpu:3 started (0) 18
[    0.004889] [bcm2709_secondary_init] enter cpu:3
[    0.004908] CPU3: update cpu_capacity 1024
[    0.004914] CPU3: thread -1, cpu 3, socket 0, mpidr 80000003
[    0.004965] Brought up 4 CPUs
[    0.005055] SMP: Total of 4 processors activated (153.60 BogoMIPS).
[    0.005081] CPU: All CPU(s) started in HYP mode.
[    0.005105] CPU: Virtualization extensions available.
[    0.013354] VFP support v0.3: implementor 41 architecture 3 part 40 variant 3 rev 4
[    0.013672] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.014342] pinctrl core: initialized pinctrl subsystem
[    0.014829] NET: Registered protocol family 16
[    0.019837] DMA: preallocated 4096 KiB pool for atomic coherent allocations
[    0.049941] cpuidle: using governor ladder
[    0.079959] cpuidle: using governor menu
[    0.085420] bcm2709: Mini UART enabled
[    0.085522] Serial: AMBA PL011 UART driver
[    0.085668] uart-pl011 3f201000.uart: could not find pctldev for node /soc/gpio@7e200000/uart0_pins, deferring probe
[    0.085854] bcm2835-mbox 3f00b880.mailbox: mailbox enabled
[    0.140862] bcm2835-dma 3f007000.dma: DMA legacy API manager at f3007000, dmachans=0x1
[    0.142214] SCSI subsystem initialized
[    0.142390] usbcore: registered new interface driver usbfs
[    0.142486] usbcore: registered new interface driver hub
[    0.142570] usbcore: registered new device driver usb
[    0.150039] raspberrypi-firmware soc:firmware: Attached to firmware from 2016-03-04 17:53
[    0.176999] clocksource: Switched to clocksource arch_sys_counter
[    0.184758] NET: Registered protocol family 2
[    0.185322] TCP established hash table entries: 8192 (order: 3, 32768 bytes)
[    0.185455] TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
[    0.185662] TCP: Hash tables configured (established 8192 bind 8192)
[    0.185767] UDP hash table entries: 512 (order: 2, 16384 bytes)
[    0.185832] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
[    0.186032] NET: Registered protocol family 1
[    0.187689] futex hash table entries: 1024 (order: 4, 65536 bytes)
[    0.196337] io scheduler noop registered
[    0.196377] io scheduler deadline registered
[    0.196435] io scheduler cfq registered (default)
[    0.198845] BCM2708FB: allocated DMA memory fa400000
[    0.198891] BCM2708FB: allocated DMA channel 0 @ f3007000
[    0.203641] Console: switching to colour frame buffer device 82x26
[    0.207549] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
[    0.210176] console [ttyS0] disabled
[    0.211420] 3f215040.uart: ttyS0 at MMIO 0x3f215040 (irq = 59, base_baud = 31250000) is a 16550
[    0.805323] console [ttyS0] enabled
[    0.810683] vc-cma: Videocore CMA driver
[    0.815851] vc-cma: vc_cma_base      = 0x00000000
[    0.821805] vc-cma: vc_cma_size      = 0x00000000 (0 MiB)
[    0.828425] vc-cma: vc_cma_initial   = 0x00000000 (0 MiB)
[    0.835116] vc-mem: phys_addr:0x00000000 mem_base=0x3dc00000 mem_size:0x3f000000(1008 MiB)
[    0.856676] brd: module loaded
[    0.867733] loop: module loaded
[    0.872723] vchiq: vchiq_init_state: slot_zero = 0xba480000, is_master = 0
[    0.882361] usbcore: registered new interface driver smsc95xx
[    0.889351] dwc_otg: version 3.00a 10-AUG-2012 (platform bus)
[    1.096504] Core Release: 2.80a
[    1.100813] Setting default values for core params
[    1.106822] Finished setting default values for core params
[    1.313918] Using Buffer DMA mode
[    1.318425] Periodic Transfer Interrupt Enhancement - disabled
[    1.325496] Multiprocessor Interrupt Enhancement - disabled
[    1.332306] OTG VER PARAM: 0, OTG VER FLAG: 0
[    1.337850] Dedicated Tx FIFOs mode
[    1.342697] WARN::dwc_otg_hcd_init:1047: FIQ DMA bounce buffers: virt = 0xba414000 dma = 0xfa414000 len=9024
[    1.354969] FIQ FSM acceleration enabled for :
[    1.354969] Non-periodic Split Transactions
[    1.354969] Periodic Split Transactions
[    1.354969] High-Speed Isochronous Endpoints
[    1.376677] WARN::hcd_init_fiq:413: FIQ on core 1 at 0x80296154
[    1.383853] WARN::hcd_init_fiq:414: FIQ ASM at 0x8000ee78 length 36
[    1.391381] WARN::hcd_init_fiq:439: MPHI regs_base at 0xbb87e000
[    1.398694] dwc_otg 3f980000.usb: DWC OTG Controller
[    1.404922] dwc_otg 3f980000.usb: new USB bus registered, assigned bus number 1
[    1.413552] dwc_otg 3f980000.usb: irq 62, io mem 0x00000000
[    1.420403] Init: Port Power? op_state=1
[    1.425499] Init: Power Port (0)
[    1.430058] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    1.438116] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.446594] usb usb1: Product: DWC OTG Controller
[    1.452505] usb usb1: Manufacturer: Linux 4.4.7 dwc_otg_hcd
[    1.459295] usb usb1: SerialNumber: 3f980000.usb
[    1.465658] hub 1-0:1.0: USB hub found
[    1.470599] hub 1-0:1.0: 1 port detected
[    1.476330] usbcore: registered new interface driver uas
[    1.482875] usbcore: registered new interface driver usb-storage
[    1.490120] mousedev: PS/2 mouse device common for all mice
[    1.497631] bcm2835-wdt 3f100000.watchdog: Broadcom BCM2835 watchdog timer
[    1.505814] sdhci: Secure Digital Host Controller Interface driver
[    1.513199] sdhci: Copyright(c) Pierre Ossman
[    1.518961] sdhost: log_buf @ ba413000 (fa413000)
[    1.597012] mmc0: sdhost-bcm2835 loaded - DMA enabled (>1)
[    1.605873] mmc-bcm2835 3f300000.mmc: mmc_debug:0 mmc_debug2:0
[    1.612922] mmc-bcm2835 3f300000.mmc: DMA channel allocated
[    1.657080] sdhci-pltfm: SDHCI platform and OF driver helper
[    1.665559] NET: Registered protocol family 10
[    1.671957] NET: Registered protocol family 17
[    1.677081] Indeed it is in host mode hprt0 = 00021501
[    1.683833] bridge: automatic filtering via arp/ip/ip6tables has been deprecated. Update your scripts to load br_netfilter if you need this.
[    1.698826] 8021q: 802.1Q VLAN Support v1.8
[    1.704582] Registering SWP/SWPB emulation handler
[    1.711159] vc-sm: Videocore shared memory driver
[    1.717058] [vc_sm_connected_init]: start
[    1.722685] [vc_sm_connected_init]: end - returning 0
[    1.731419] 3f201000.uart: ttyAMA0 at MMIO 0x3f201000 (irq = 87, base_baud = 0) is a PL011 rev2
[    1.743688] Waiting for root device /dev/mmcblk0p2...
[    1.746545] mmc0: host does not support reading read-only switch, assuming write-enable
[    1.750003] mmc0: new high speed SDHC card at address aaaa
[    1.750496] mmcblk0: mmc0:aaaa SL08G 7.40 GiB
[    1.751722]  mmcblk0: p1 p2
[    1.770338] mmc1: queuing unknown CIS tuple 0x80 (2 bytes)
[    1.771869] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[    1.773397] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[    1.776143] mmc1: queuing unknown CIS tuple 0x80 (7 bytes)
[    1.808285] EXT4-fs (mmcblk0p2): mounted filesystem without journal. Opts: (null)
[    1.818239] VFS: Mounted root (ext4 filesystem) readonly on device 179:2.
[    1.826645] Freeing unused kernel memory: 220K (8053d000 - 80574000)
[    1.864584] mmc1: new high speed SDIO card at address 0001
[    1.867021] usb 1-1: new high-speed USB device number 2 using dwc_otg
[    1.871445] Indeed it is in host mode hprt0 = 00001101
[    1.963858] init: Console is alive
[    1.968757] init: - watchdog -
[    2.067262] usb 1-1: New USB device found, idVendor=0424, idProduct=9514
[    2.075311] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    2.084428] hub 1-1:1.0: USB hub found
[    2.089487] hub 1-1:1.0: 5 ports detected
[    2.104328] init: - preinit -
[    2.367020] usb 1-1.1: new high-speed USB device number 3 using dwc_otg
[    2.487219] usb 1-1.1: New USB device found, idVendor=0424, idProduct=ec00
[    2.495419] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    2.505539] random: procd urandom read with 71 bits of entropy available
[    2.514008] smsc95xx v1.0.4
[    2.579906] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-3f980000.usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:8b:76:f8
[    5.264248] procd: - early -
[    5.268535] procd: - watchdog -
[    5.860039] procd: - ubus -
[    5.915948] procd: - init -
Please press Enter to activate this console.
[    6.219126] ip6_tables: (C) 2000-2006 Netfilter Core Team
[    6.233785] hidraw: raw HID events driver (C) Jiri Kosina
[    6.254701] Loading modules backported from Linux version v4.4-rc5-1913-gc8fdf68
[    6.264765] Backport generated by backports.git backports-20151218-0-g2f58d9d
[    6.275056] ip_tables: (C) 2000-2006 Netfilter Core Team
[    6.286255] nf_conntrack version 0.5.0 (14877 buckets, 59508 max)
[    6.410156] usbcore: registered new interface driver usbhid
[    6.417184] usbhid: USB HID core driver
[    6.428830] xt_time: kernel timezone is -0000
[    6.448225] PPP generic driver version 2.4.2
[    6.454595] NET: Registered protocol family 24
[    6.556919] random: nonblocking pool is initialized
[    6.578878] brcmfmac: brcmf_c_preinit_dcmds: Firmware version = wl0: Dec 15 2015 18:10:45 version 7.45.41.23 (r606571) FWID 01-cc4eda9c
[    6.613642] brcmfmac: brcmf_cfg80211_reg_notifier: not a ISO3166 code (0x30 0x30)
[    6.627674] usbcore: registered new interface driver brcmfmac

Here is the output of mount:

root@OpenWrt:/# mount
/dev/root on / type ext4 (ro,relatime,block_validity,delalloc,barrier,user_xattr,acl)
proc on /proc type proc (rw,nosuid,nodev,noexec,noatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime)
tmpfs on /dev type tmpfs (rw,nosuid,relatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,mode=600)
debugfs on /sys/kernel/debug type debugfs (rw,noatime)

So what do I need to do to get this working?

Be so kind to Search before posting as this topic has been answered in numerous threads elsewhere in the forum.

LMGTFY

Thank you. I should have also included this:

root@OpenWrt:/# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                46.5M      7.9M     37.7M  17% /
tmpfs                   464.9M     36.0K    464.9M   0% /tmp
tmpfs                   512.0K         0    512.0K   0% /dev

I am familiar with the root being mounted as ro when there is no space left. However, that does not seem to be the case here.

I spent about 30 minutes searching and did not find anything that seemed to answer my question. I would love for it to be an easy fix that I just missed.

(Last edited by SharkAttack99 on 25 Jun 2016, 14:44)

So I'm not particularly familiar with the boot process, but it appears that the pivot root (re-mounting root as rw) is not occurring. Does this seem to be the case? And if so, how can I debug it?

It seems like the 80_mount_root file is not being called during boot up. How can I debug this?

During boot processing for CC and DD mount_root is called -

boot wrote:
  • ::sysinit:/etc/init.d/rcS S boot

  • /etc/rc.d/S10boot => /etc/init.d/boot

    • boot() {
          [ -f /proc/mounts ] || /sbin/mount_root
          ...

So what was the solution to the read only filesystem?
Having the same issue on an RPI 0 compile from latest trunk.

(Last edited by tcjew on 3 Jul 2016, 14:55)

Got pulled onto other stuff and haven't gotten back to it, so sorry, no solution.

I too have this problem on a Pi3. I can't run mount_root manually, seg fault. I'll do some digging and report back.

Acea

I also have this problem on the Pi3.

Are you also getting a seg fault on boot?

Segmentation fault
mkdir: can't create directory '/boot' : Read-only file system
mount: mounting /dev/mmcblk0p1 on /boot failed: No such file or directory

The / partition is mounted as ro requiring

root@mydevice:/# mount -o remount, rw /

to be able to get anything to work.  It sees in the past read-only filesystems have been caused by a lack of space but the Pi3 with any reasonably sized sd card has loads of space so that can't be the issue.

I can't see any other errors, other than I'm having some strange problems trying to get the Pi3 to operate in Routed AP mode once it starts

I also get a seg fault for mount_root:

root@mydevice:~# /sbin/mount_root
Segmentation fault
root@mydevice:~# 

looking at the code in

workspace/openwrt/build_dir/target-arm_cortex-a53+neon-vfpv4_musl-1.1.14_eabi/fstools-2016-04-30

it seems that mount_root can take three arguments, "ram", "stop" and "done"

Only 'done' causes the segmentation fault.

The only thing that the done() function seems to do is look at which filesystem type is being used and then calls a function fs_state_set().  Looks like a bug in there somewhere.

It is actually happening in the PREINIT code, which is in the start() method. There's a bug in the libfsutils ext4 that causes the segfault. The entire ext4 overlay system has been reverted in fsutils due to it causing issues (not sure if this is the issue), but OpenWrt still points to the old version in git. I've notified the author of the original patch of the error and maybe he can get it into fsutils and get the OpenWrt build back on track.

Here's the patch that needs to be applied to fsutils bb92c29fc4cd90d396fc79078eba75fcb01c92ae (2016-04-30) to make it work properly and not segfault, leaving the rootfs mounted ro:

--- fstools-2016-04-30/libfstools/ext4.c.orig   2016-08-04 16:50:14.332925781 -0400
+++ fstools-2016-04-30/libfstools/ext4.c        2016-08-04 16:52:10.781858490 -0400
@@ -129,8 +129,8 @@
                                return -1;
                        }
                }
+               fclose(fp);
        }
-       fclose(fp);
        return 0;
 }

I have no write acces on RPI-1 too.
But no Idea if it is the same problem.

The workarround is here:
https://forum.openwrt.org/viewtopic.php?id=65359

But note I will only works if the ext4 FS on the root-partition OK.
If you power off the RPI and there was a write process on the partition, them it can happen that the partition are damaged.

Inspect your partition on A Linux PC:

tune2fs -l /dev/sdb2

when it looks like:

...
Filesystem state:         not clean with errors
...

try this:

e2fsck /dev/sdb2

(answer with yes)

The discussion might have continued from here.