nils-werner / raspi-overlayroot

Protect your SD card against wear and tear
MIT License
117 stars 21 forks source link

Not working on Raspberry Pi 3 Model B #12

Closed aut0 closed 4 years ago

aut0 commented 4 years ago

Hi,

I tried using this on a RPi3 Model B. Changing the kernel command line is slightly different when running the aarch64 image, but that was not a big deal. Sadly, it does not work. I get stuck at boot. Here is the boot log:

[    0.000000] Linux version 5.4.6-1-ARCH (builduser@leming) (gcc version 8.3.0 (GCC)) #1 SMP Mon Dec 23 09:59:08 MST 2019
[    0.000000] Machine model: Raspberry Pi 3 Model B
[    0.000000] efi: Getting EFI parameters from FDT:
[    0.000000] efi: UEFI not found.
[    0.000000] cma: Reserved 64 MiB at 0x0000000037400000
[    0.000000] percpu: Embedded 30 pages/cpu s85656 r8192 d29032 u122880
[    0.000000] Detected VIPT I-cache on CPU0
[    0.000000] CPU features: detected: ARM erratum 843419
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 238896
[    0.000000] Kernel command line: console=ttyS1,115200 console=tty0 root=PARTUUID=d63af3d9-02 rw rootwait smsc95xx.macaddr=b8:27:eb:4e:d5:59 overlayroot
[    0.000000] Dentry cache hash table entries: 131072 (order: 8, 1048576 bytes, linear)
[    0.000000] Inode-cache hash table entries: 65536 (order: 7, 524288 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 849920K/970752K available (14972K kernel code, 2738K rwdata, 7048K rodata, 1984K init, 826K bss, 55296K reserved, 65536K cma-reserved)
[    0.000000] random: get_random_u64 called from cache_random_seq_create+0x88/0x158 with crng_init=0
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] ftrace: allocating 51517 entries in 202 pages
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu:     RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=4.
[    0.000000]  Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4
[    0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[    0.000000] arch_timer: 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.000007] sched_clock: 56 bits at 19MHz, resolution 52ns, wraps every 4398046511078ns
[    0.000274] Console: colour dummy device 80x25
[    0.000652] printk: console [tty0] enabled
[    0.000711] Calibrating delay loop (skipped), value calculated using timer frequency.. 38.40 BogoMIPS (lpj=192000)
[    0.000745] pid_max: default: 32768 minimum: 301
[    0.001001] LSM: Security Framework initializing
[    0.001035] Yama: becoming mindful.
[    0.001155] Mount-cache hash table entries: 2048 (order: 2, 16384 bytes, linear)
[    0.001199] Mountpoint-cache hash table entries: 2048 (order: 2, 16384 bytes, linear)
[    0.001300] *** VALIDATE tmpfs ***
[    0.002044] *** VALIDATE proc ***
[    0.002397] *** VALIDATE cgroup1 ***
[    0.002419] *** VALIDATE cgroup2 ***
[    0.003545] ASID allocator initialised with 32768 entries
[    0.003689] rcu: Hierarchical SRCU implementation.
[    0.007359] EFI services will not be available.
[    0.007960] smp: Bringing up secondary CPUs ...
[    0.008623] Detected VIPT I-cache on CPU1
[    0.008694] CPU1: Booted secondary processor 0x0000000001 [0x410fd034]
[    0.009526] Detected VIPT I-cache on CPU2
[    0.009571] CPU2: Booted secondary processor 0x0000000002 [0x410fd034]
[    0.010396] Detected VIPT I-cache on CPU3
[    0.010439] CPU3: Booted secondary processor 0x0000000003 [0x410fd034]
[    0.010579] smp: Brought up 1 node, 4 CPUs
[    0.010674] SMP: Total of 4 processors activated.
[    0.010693] CPU features: detected: 32-bit EL0 Support
[    0.010712] CPU features: detected: CRC32 instructions
[    0.011295] CPU: All CPU(s) started at EL2
[    0.011334] alternatives: patching kernel code
[    0.013563] devtmpfs: initialized
[    0.021535] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.021591] futex hash table entries: 1024 (order: 4, 65536 bytes, linear)
[    0.025100] pinctrl core: initialized pinctrl subsystem
[    0.026421] DMI not present or invalid.
[    0.027014] NET: Registered protocol family 16
[    0.031651] DMA: preallocated 256 KiB pool for atomic allocations
[    0.031739] audit: initializing netlink subsys (disabled)
[    0.031972] audit: type=2000 audit(0.030:1): state=initialized audit_enabled=0 res=1
[    0.033302] cpuidle: using governor ladder
[    0.033344] cpuidle: using governor menu
[    0.033871] hw-breakpoint: found 6 breakpoint and 4 watchpoint registers.
[    0.034965] Serial: AMBA PL011 UART driver
[    0.060153] HugeTLB registered 1.00 GiB page size, pre-allocated 0 pages
[    0.060192] HugeTLB registered 32.0 MiB page size, pre-allocated 0 pages
[    0.060214] HugeTLB registered 2.00 MiB page size, pre-allocated 0 pages
[    0.060235] HugeTLB registered 64.0 KiB page size, pre-allocated 0 pages
[    2.237027] cryptd: max_cpu_qlen set to 1000
[    2.277252] ACPI: Interpreter disabled.
[    2.278270] iommu: Default domain type: Translated 
[    2.278695] vgaarb: loaded
[    2.279775] SCSI subsystem initialized
[    2.280413] usbcore: registered new interface driver usbfs
[    2.280487] usbcore: registered new interface driver hub
[    2.280601] usbcore: registered new device driver usb
[    2.281039] usb_phy_generic phy: phy supply vcc not found, using dummy regulator
[    2.281795] pps_core: LinuxPPS API ver. 1 registered
[    2.281815] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    2.281857] PTP clock support registered
[    2.282163] EDAC MC: Ver: 3.0.0
[    2.283272] Advanced Linux Sound Architecture Driver Initialized.
[    2.283978] NetLabel: Initializing
[    2.283996] NetLabel:  domain hash size = 128
[    2.284010] NetLabel:  protocols = UNLABELED CIPSOv4 CALIPSO
[    2.284107] NetLabel:  unlabeled traffic allowed by default
[    2.284679] clocksource: Switched to clocksource arch_sys_counter
[    3.640804] *** VALIDATE bpf ***
[    3.641162] VFS: Disk quotas dquot_6.6.0
[    3.641256] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[    3.641389] *** VALIDATE ramfs ***
[    3.641426] *** VALIDATE hugetlbfs ***
[    3.641853] simple-framebuffer 3eaf0000.framebuffer: framebuffer at 0x3eaf0000, 0x10a800 bytes, mapped to 0x(____ptrval____)
[    3.641890] simple-framebuffer 3eaf0000.framebuffer: format=a8r8g8b8, mode=656x416x32, linelength=2624
[    3.648925] Console: switching to colour frame buffer device 82x26
[    3.655131] simple-framebuffer 3eaf0000.framebuffer: fb0: simplefb registered!
[    3.658977] pnp: PnP ACPI: disabled
[    3.671140] thermal_sys: Registered thermal governor 'fair_share'
[    3.671145] thermal_sys: Registered thermal governor 'bang_bang'
[    3.674892] thermal_sys: Registered thermal governor 'step_wise'
[    3.678426] thermal_sys: Registered thermal governor 'user_space'
[    3.681829] thermal_sys: Registered thermal governor 'power_allocator'
[    3.685856] NET: Registered protocol family 2
[    3.693203] tcp_listen_portaddr_hash hash table entries: 512 (order: 1, 8192 bytes, linear)
[    3.700035] TCP established hash table entries: 8192 (order: 4, 65536 bytes, linear)
[    3.707208] TCP bind hash table entries: 8192 (order: 5, 131072 bytes, linear)
[    3.711162] TCP: Hash tables configured (established 8192 bind 8192)
[    3.715149] UDP hash table entries: 512 (order: 2, 16384 bytes, linear)
[    3.719087] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes, linear)
[    3.723236] NET: Registered protocol family 1
[    3.727784] RPC: Registered named UNIX socket transport module.
[    3.731510] RPC: Registered udp transport module.
[    3.735106] RPC: Registered tcp transport module.
[    3.738493] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    3.741856] PCI: CLS 0 bytes, default 64
[    3.745373] Trying to unpack rootfs image as initramfs...
[    4.308797] Freeing initrd memory: 7228K
[    4.313493] hw perfevents: enabled with armv8_cortex_a53 PMU driver, 7 counters available
[    4.320875] kvm [1]: IPA Size Limit: 40bits
[    4.326271] kvm [1]: Hyp mode initialized successfully
[    4.707727] Initialise system trusted keyrings
[    4.711656] workingset: timestamp_bits=46 max_order=18 bucket_order=0
[    4.723737] zbud: loaded
[    4.730501] NFS: Registering the id_resolver key type
[    4.734017] Key type id_resolver registered
[    4.737404] Key type id_legacy registered
[    4.740630] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    4.744184] SGI XFS with ACLs, security attributes, no debug enabled
[    4.783594] NET: Registered protocol family 38
[    4.786900] Key type asymmetric registered
[    4.790090] Asymmetric key parser 'x509' registered
[    4.793386] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 242)
[    4.800458] io scheduler mq-deadline registered
[    4.803902] io scheduler kyber registered
[    4.807537] io scheduler bfq registered
[    4.820391] IPMI message handler: version 39.2
[    4.837062] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[    4.842694] printk: console [ttyS1] disabled
[    4.845996] 3f215040.serial: ttyS1 at MMIO 0x0 (irq = 61, base_baud = 31250000) is a 16550
[    6.244858] printk: console [ttyS1] enabled
[    6.253869] msm_serial: driver initialized
[    6.262984] bcm2835-rng 3f104000.rng: hwrng registered
[    6.272668] cacheinfo: Unable to detect cache hierarchy for CPU 0
[    6.283271] bcm2835-power bcm2835-power: Broadcom BCM2835 power domains driver
[    6.298651] libphy: Fixed MDIO Bus: probed
[    6.308709] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    6.318861] ehci-pci: EHCI PCI platform driver
[    6.326826] ehci-platform: EHCI generic platform driver
[    6.335723] ehci-orion: EHCI orion driver
[    6.343275] tegra-ehci: Tegra EHCI driver
[    6.350734] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    6.360303] ohci-pci: OHCI PCI platform driver
[    6.368162] ohci-platform: OHCI generic platform driver
[    6.376919] uhci_hcd: USB Universal Host Controller Interface driver
[    6.387576] usbcore: registered new interface driver uas
[    6.396536] usbcore: registered new interface driver usb-storage
[    6.406068] usbcore: registered new interface driver ums-alauda
[    6.415384] usbcore: registered new interface driver ums-cypress
[    6.424623] usbcore: registered new interface driver ums-datafab
[    6.433691] usbcore: registered new interface driver ums_eneub6250
[    6.442858] usbcore: registered new interface driver ums-freecom
[    6.451788] usbcore: registered new interface driver ums-isd200
[    6.460520] usbcore: registered new interface driver ums-jumpshot
[    6.469309] usbcore: registered new interface driver ums-karma
[    6.477655] usbcore: registered new interface driver ums-onetouch
[    6.486132] usbcore: registered new interface driver ums-realtek
[    6.494341] usbcore: registered new interface driver ums-sddr09
[    6.502355] usbcore: registered new interface driver ums-sddr55
[    6.510265] usbcore: registered new interface driver ums-usbat
[    6.518077] usbcore: registered new interface driver usbserial_generic
[    6.526521] usbserial: USB Serial support registered for generic
[    6.536161] mousedev: PS/2 mouse device common for all mice
[    6.547738] device-mapper: uevent: version 1.0.3
[    6.554617] device-mapper: ioctl: 4.41.0-ioctl (2019-09-16) initialised: dm-devel@redhat.com
[    6.568243] sdhci: Secure Digital Host Controller Interface driver
[    6.576570] sdhci: Copyright(c) Pierre Ossman
[    6.583857] Synopsys Designware Multimedia Card Interface Driver
[    6.690173] sdhost-bcm2835 3f202000.mmc: loaded - DMA enabled (>1)
[    6.698973] sdhci-pltfm: SDHCI platform and OF driver helper
[    6.709412] ledtrig-cpu: registered to indicate activity on CPUs
[    6.719017] hidraw: raw HID events driver (C) Jiri Kosina
[    6.727420] usbcore: registered new interface driver usbhid
[    6.735905] usbhid: USB HID core driver
[    6.743885] bcm2835-mbox 3f00b880.mailbox: mailbox enabled
[    6.757047] drop_monitor: Initializing network drop monitor service
[    6.767321] Initializing XFRM netlink socket
[    6.776452] NET: Registered protocol family 10
[    6.834381] Segment Routing with IPv6
[    6.841711] mip6: Mobile IPv6
[    6.843688] mmc0: host does not support reading read-only switch, assuming write-enable
[    6.848153] NET: Registered protocol family 17
[    6.848463] Key type dns_resolver registered
[    6.866629] mmc0: new high speed SDHC card at address e624
[    6.872145] registered taskstats version 1
[    6.880329] mmcblk0: mmc0:e624 SU16G 14.8 GiB 
[    6.888275] Loading compiled-in X.509 certificates
[    6.888485] zswap: loaded using pool lzo/zbud
[    6.900725]  mmcblk0: p1 p2
[    6.903964] Key type ._fscrypt registered
[    6.932587] Key type .fscrypt registered
[    6.967872] Key type big_key registered
[    6.998438] Key type encrypted registered
[    7.011890] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 66, base_baud = 0) is a PL011 rev2
[    7.027118] serial serial0: tty port ttyAMA0 registered
[    7.043413] raspberrypi-firmware soc:firmware: Attached to firmware from 2019-12-11 15:14
[    7.059119] raspberrypi-clk raspberrypi-clk: CPU frequency range: min 600000000, max 1200000000
[    7.080422] vchiq: vchiq_init_state: slot_zero = (____ptrval____)
[    7.092899] dwc2 3f980000.usb: 3f980000.usb supply vusb_d not found, using dummy regulator
[    7.104918] dwc2 3f980000.usb: 3f980000.usb supply vusb_a not found, using dummy regulator
[    7.167506] dwc2 3f980000.usb: DWC OTG Controller
[    7.174312] dwc2 3f980000.usb: new USB bus registered, assigned bus number 1
[    7.183411] dwc2 3f980000.usb: irq 41, io mem 0x3f980000
[    7.190835] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.04
[    7.203132] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    7.212582] usb usb1: Product: DWC OTG Controller
[    7.219482] usb usb1: Manufacturer: Linux 5.4.6-1-ARCH dwc2_hsotg
[    7.227844] usb usb1: SerialNumber: 3f980000.usb
[    7.234982] hub 1-0:1.0: USB hub found
[    7.240846] hub 1-0:1.0: 1 port detected
[    7.249817] sdhci-iproc 3f300000.sdhci: allocated mmc-pwrseq
[    7.289410] mmc1: SDHCI controller on 3f300000.sdhci [3f300000.sdhci] using PIO
[    7.302019] hctosys: unable to open rtc device (rtc0)
[    7.309389] ALSA device list:
[    7.314289]   No soundcards found.
[    7.315296] mmc1: queuing unknown CIS tuple 0x80 (2 bytes)
[    7.328604] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[    7.333329] Freeing unused kernel memory: 1984K
[    7.337563] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[    7.342237] Run /init as init process
[    7.352334] mmc1: queuing unknown CIS tuple 0x80 (7 bytes)
[    7.416714] random: fast init done
[    7.461677] mmc1: new high speed SDIO card at address 0001
[    7.694759] usb 1-1: new high-speed USB device number 2 using dwc2
[    7.945035] usb 1-1: New USB device found, idVendor=0424, idProduct=9514, bcdDevice= 2.00
[    7.959444] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    7.970754] hub 1-1:1.0: USB hub found
[    7.977806] hub 1-1:1.0: 5 ports detected
[    8.314737] usb 1-1.1: new high-speed USB device number 3 using dwc2
[    8.381918] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[    8.465308] usb 1-1.1: New USB device found, idVendor=0424, idProduct=ec00, bcdDevice= 2.00
[    8.481117] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    8.794713] usb 1-1.5: new full-speed USB device number 4 using dwc2
[    8.938332] usb 1-1.5: config 1 interface 1 altsetting 0 endpoint 0x3 has wMaxPacketSize 0, skipping
[    8.955277] usb 1-1.5: config 1 interface 1 altsetting 0 endpoint 0x83 has wMaxPacketSize 0, skipping
[    8.975088] usb 1-1.5: New USB device found, idVendor=0a12, idProduct=0001, bcdDevice=88.91
[    8.991964] usb 1-1.5: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[    9.003744] usb 1-1.5: Product: CSR8510 A10
[    9.716144] random: crng init done

Normally, systemd would start now like so:

[    8.976814] usb 1-1.5: Product: CSR8510 A10
[    9.092550] systemd[1]: System time before build time, advancing clock.
[    9.143467] systemd[1]: systemd 244.1-1-arch 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)
[    9.184163] systemd[1]: Detected architecture arm64.

But nothing happens.

nils-werner commented 4 years ago

That log seems to not contain anything useful to debug this. Please post all additional error messages you are seeing.

aut0 commented 4 years ago

Sadly there are no additional debug messages. Have you tested this on RPi 3 before?

nils-werner commented 4 years ago

Yes I have.

aut0 commented 4 years ago

Did you use the Aarch64 Version of Arch Linux ARM? Asking because it uses a different boot process I think.

nils-werner commented 4 years ago

No I didn't. If you manage to fix it, a contribution would be very welcome :-)

benycze commented 4 years ago

Hi @aut0 , I have installed the raspi-overlayroot on aarch64, RPI 3 model B. To set it up, I did the following steps (some of them are not mentioned in the README.md on this site):

  1. Backup all files which will be modified in this process because you may make you raspi not bootable. To restore it, you can simply copy the backup over modified files and your raspi will boot again

  2. Install the overlayroot package, you can use the provided steps on this site or you can use the pikaur which downloads and installs it from the AUR repository. Maybe, it will be better to install it from AUR because there can be some changes (I wasn't investigating it because I am typically installing everything from the AUR because of future updates).

    pikaur -S raspberry-overlayroot-git
  3. After that, open the /etc/mkinitcpio.conf. Add the overlay module during boot into the MODULES section. Without that, you will not be able to boot because you cannot mount the overlayed root in early stage. Secondly, modify the HOOKS regarding the documentation on this site. In my case, all mentioned parts look like following:

MODULES=(overlay) 
HOOKS=(base udev autodetect modconf block filesystems keyboard fsck overlayroot)
  1. Use the mkinitcpio -P to update the ramdisk

  2. Edit the /boot/boot.txt file and add the overlayroot to bootargs. In my case, the line looks like following (you can modify the ro to rw and add just the overlayroot. The ro flag can be added after you successfully boot from the overlay) :

setenv bootargs console=ttyS1,115200 console=tty0 root=PARTUUID=${uuid} ro rootwait smsc95xx.macaddr="${usbethaddr} fsck.mode=force fsck.repair=preen overlayroot"
  1. Run the /boot/mkscr script to update the /boot/boot.scr file which is used by the raspi bootloader

  2. Fingers crossed ... reboot ... you should end in the login prompt

  3. If you successfully booted your raspi, edit the /boot/boot.txt , change the rw to ro flag and run the /boot/mkscr

  4. Tidy up you backup files.

These steps allows me to boot the @nils-werner overlayroot on RPI 3 Model B on Arch Linux AARCH64. I hope it help you to make some progress.

I can describe it more detailed and send a merge request to @nils-werner if it will work to you.

Best, Pavel

aut0 commented 4 years ago
  1. After that, open the /etc/mkinitcpio.conf. Add the overlay module during boot into the MODULES section. Without that, you will not be able to boot because you cannot mount the overlayed root in early stage. Secondly, modify the HOOKS regarding the documentation on this site. In my case, all mentioned parts look like following:

This is what I was missing. I forgot to edit the MODULES section. Must have overlooked it somehow. Thanks!!