1000001101000 / Debian_on_Buffalo

Tools for Installing/Running Debian on Buffalo ARM based Linkstation/Terastation/Kurobox/Cloudstor devices.
330 stars 42 forks source link

TS-HTGL/R5: Boot from HDD, then run from memory stick, how? #72

Closed cdwijs closed 3 years ago

cdwijs commented 3 years ago

Hi There,

I have a Buffalo Terrastation Pro TS-HTGL/R5 TS-H4.0TGL/R5 BUF-TS-HTGLR5(A). I can use your installer just fine to install Debian 10.7 on it.

In order to save noise and heat, I would like to keep the hard drives in idle, until a file is requested from the network. To this end I would like to put the root filesystem on a thumb drive. Problem is that the debian installer does not allow partitions and mountpoints to be made on the thumb drive. After the NAS is booted completely, Debian can access the thumb drive without issue.

I guess both the installer initrd.buffalo / uImage.buffalo and the installed Debian initrd / uImage pair don't have the driver to access a USB thumb drive.

I've tried to generate an initrd.buffalo with most of the drivers, but that does not boot. I suspect it's too large (>7MB), as stated here: https://github.com/1000001101000/Deb...falo/issues/67

What driver must be included in the initrd to allow for root filesystem on a memory stick?

Here's what I've done:

cat /etc/initramfs-tools/conf.d/modules

MODULES=dep

nano /etc/initramfs-tools/conf.d/modules

cat /etc/initramfs-tools/conf.d/modules

MODULES=most

apt-get reinstall linux-image-4.12.13

Reading package lists... Done Building dependency tree
Reading state information... Done 0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded. Need to get 22.2 MB of archives. After this operation, 0 B of additional disk space will be used. Get:1 https://raw.githubusercontent.com/1000001101000/Debian_on_Buffalo/master/PPA buster/main armel linux-image-4.12.13 armel 4.12.13-4 [22.2 MB] Fetched 22.2 MB in 15s (1,495 kB/s)
(Reading database ... 27554 files and directories currently installed.) Preparing to unpack .../linux-image-4.12.13_4.12.13-4_armel.deb ... Unpacking linux-image-4.12.13 (4.12.13-4) over (4.12.13-4) ... Setting up linux-image-4.12.13 (4.12.13-4) ... update-initramfs: Generating /boot/initrd.img-4.12.13 I: The initramfs will attempt to resume from /dev/sda2 I: (UUID=a4ebb9fd-00ba-46ff-a448-165d6e21a7b8) I: Set the RESUME variable to override this. flash-kernel: deferring update (trigger activated) flash-kernel: deferring update (trigger activated) Processing triggers for flash-kernel (3.99) ... flash-kernel: installing version 4.12.13 Generating kernel u-boot image... done. Taking backup of uImage.buffalo. Installing new uImage.buffalo. Generating initramfs u-boot image... done. Taking backup of initrd.buffalo. Installing new initrd.buffalo.

ls -l /boot/

total 44140 -rw-r--r-- 1 root root 164677 Nov 3 15:19 config-4.12.13 drwxr-xr-x 2 root root 4096 Dec 28 08:56 hidden -rw-r--r-- 1 root root 15327846 Dec 28 10:07 initrd.buffalo -rw-r--r-- 1 root root 6551033 Dec 9 11:32 initrd.buffalo.bak -rw-r--r-- 1 root root 15327782 Dec 28 10:07 initrd.img-4.12.13 drwx------ 2 root root 16384 Dec 9 05:50 lost+found -rw-r--r-- 1 root root 1549426 Nov 3 15:19 System.map-4.12.13 -rw-r--r-- 1 root root 2055672 Dec 28 10:07 uImage.buffalo -rw-r--r-- 1 root root 2055672 Dec 9 11:32 uImage.buffalo.bak -rwxr-xr-x 1 root root 2055600 Nov 3 15:19 vmlinuz-4.12.13

file initrd.buffalo

initrd.buffalo: u-boot legacy uImage, ramdisk 4.12.13, Linux/ARM, RAMDisk Image (Not compressed), 15327782 bytes, Mon Dec 28 15:07:50 2020, Load Address: 0x00000000, Entry Point: 0x00000000, Header CRC: 0x730B771C, Data CRC: 0x7B7484E3

file initrd.buffalo.bak

initrd.buffalo.bak: u-boot legacy uImage, ramdisk 4.12.13, Linux/ARM, RAMDisk Image (Not compressed), 6550969 bytes, Wed Dec 9 16:32:05 2020, Load Address: 0x00000000, Entry Point: 0x00000000, Header CRC: 0xAF161477, Data CRC: 0x5B936D6E

mkimage -l initrd.buffalo

Image Name: ramdisk 4.12.13 Created: Mon Dec 28 16:07:50 2020 Image Type: ARM Linux RAMDisk Image (uncompressed) Data Size: 15327782 Bytes = 14968.54 KiB = 14.62 MiB Load Address: 00000000 Entry Point: 00000000

mkimage -l initrd.buffalo.bak

Image Name: ramdisk 4.12.13 Created: Wed Dec 9 17:32:05 2020 Image Type: ARM Linux RAMDisk Image (uncompressed) Data Size: 6550969 Bytes = 6397.43 KiB = 6.25 MiB Load Address: 00000000 Entry Point: 00000000

1000001101000 commented 3 years ago

I believe I omitted the USB drivers from the installer to keep the size below 7MB. That'll make moving things around a little more difficult but it looks like you have the right idea.

I've done something similar before though only on a temporary basis, here is how I would proceed (you may have already done some of this).

  1. Setup the device with RAID1 arrays for /boot, roofs and swap
  2. partition your USB drive to match the HDDs for those partitions
  3. add the USB drive to all 3 RAID arrays and wait for it to resync
  4. remove the HDDs from the rootfs and swap arrays (resize to "1" so they do not appear as degraded) You still want the HDDs part of /boot since it will still be booting from hdd, you only actually need to mount it when updating kernel/initramfs swap on usb isn't great but 128MB and no swap also isn't great, you may need to tune things to fit your needs in that regard)
    • keeping rootfs/etc as RAID1 gives you options to switch back in the future or switch usb drives...etc.
  5. run update-initramfs -u to get (still with modules=dep)
  6. reboot and hopefully have everything work as desired

if the usb modules still don't get into the initrd, determine the required modules by looking at the output of lsmod. Then add them to /etc/initramfs-tools/modules and generate a new initrd.

if the initramfs is larger than 6MB or so I'd switch to XZ compression to make it smaller: try creating /etc/initramfs-tools/conf.d/compress with: COMPRESS=xz XZ_OPT=-2e export XZ_OPT

cdwijs commented 3 years ago

Thanks. What gave you the information that there's a sizelimit of 7MB? Where can I find how much it is exactly, and can this be increased somehow?

1000001101000 commented 3 years ago

I have learned about most of the limitations through trial and error over the years. Most are related to the version/build of uboot these devices use for their bootloader. Buffalo hasn't published their uboot source for most devices which limits the available information to some degree.

Up until very recently I have avoided messing with uboot entirely on these devices because most models are difficult to get a working serial console and because I don't want any possibility of "bricking" devices by using any of my tools. I did make an exception recently for the ls400 since someone on the openwrt project had created a uboot image that fixed an ethernet problem that affected some of those devices.

Here are some of the limitations I'm aware of :

Once I figured out how to get the installer below 7MB by using XZ compression and some other tricks I haven't spent much more time looking into the whole initrd thing. Using the XZ settings listed above normal initrd's come out to like 3MB even with some additional drivers added which is good enough for most use cases.

cdwijs commented 3 years ago

Thanks. the compress trick got it down from 6.3MB to 4.6MB, and the NAS boots from it, but strangely the image does not look compressed. Next step: adding the USB drivers:

cat /etc/initramfs-tools/conf.d/compress

COMPRESS=xz XZ_OPT=-2e export XZ_OPT

cat /etc/initramfs-tools/conf.d/modules

MODULES=dep

apt-get reinstall linux-image-4.12.13

Reading package lists... Done Building dependency tree
Reading state information... Done 0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded. Need to get 0 B/22.2 MB of archives. After this operation, 0 B of additional disk space will be used. (Reading database ... 27775 files and directories currently installed.) Preparing to unpack .../linux-image-4.12.13_4.12.13-4_armel.deb ... Unpacking linux-image-4.12.13 (4.12.13-4) over (4.12.13-4) ... Setting up linux-image-4.12.13 (4.12.13-4) ... update-initramfs: Generating /boot/initrd.img-4.12.13 I: The initramfs will attempt to resume from /dev/sde2 I: (UUID=f41c8f77-14d3-4906-8acc-0c935040b0d4) I: Set the RESUME variable to override this. flash-kernel: deferring update (trigger activated) flash-kernel: deferring update (trigger activated) Processing triggers for flash-kernel (3.99) ... flash-kernel: installing version 4.12.13 Generating kernel u-boot image... done. Taking backup of uImage.buffalo. Installing new uImage.buffalo. Generating initramfs u-boot image... done. Taking backup of initrd.buffalo. Installing new initrd.buffalo.

mkimage -l /boot/initrd.buffalo

Image Name: ramdisk 4.12.13 Created: Sat Jan 2 03:58:40 2021 Image Type: ARM Linux RAMDisk Image (uncompressed) Data Size: 4809996 Bytes = 4697.26 KiB = 4.59 MiB Load Address: 00000000 Entry Point: 00000000

file /boot/initrd.buffalo

/boot/initrd.buffalo: u-boot legacy uImage, ramdisk 4.12.13, Linux/ARM, RAMDisk Image (Not compressed), 4809996 bytes, Sat Jan 2 08:58:40 2021, Load Address: 0x00000000, Entry Point: 0x00000000, Header CRC: 0x7FAB6BBC, Data CRC: 0xADF5BA00

cdwijs commented 3 years ago

I've added the USB drivers, and the memory stick is detected before the root filesystem is mounted. My hard drive is /dev/sda, my flash drive is /dev/sde. The flash drive is found before /dev/sda3 is mounted as /

Now I have two options: A) Figure out what in the initrd deceides where the root filesystem is. B) Add the USB drivers to this file, and install debian on my flash drive: https://github.com/1000001101000/Debian_on_Buffalo/raw/master/Buster/installer_images/armel_devices/initrd.buffalo

These messages show the USB stick is found before the root filesystem is mounted: [ 21.752980] usbcore: registered new interface driver usbfs [ 21.788739] usbcore: registered new interface driver hub [ 21.830863] usbcore: registered new device driver usb [ 21.891032] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver [ 21.934245] ehci-orion: EHCI orion driver [ 23.289357] usb-storage 1-1.1:1.0: USB Mass Storage device detected [ 23.296286] scsi host4: usb-storage 1-1.1:1.0 [ 23.306380] usbcore: registered new interface driver usb-storage [ 23.321324] usbcore: registered new interface driver uas [ 24.480029] sd 4:0:0:0: [sde] 30464000 512-byte logical blocks: (15.6 GB/14.5 GiB) [ 24.526640] sd 4:0:0:0: [sde] Write Protect is off [ 24.531471] sd 4:0:0:0: [sde] Mode Sense: 43 00 00 00 [ 24.544039] sd 4:0:0:0: [sde] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA [ 24.596973] sde: sde1 sde2 [ 24.628782] sd 4:0:0:0: [sde] Attached SCSI removable disk [ 26.977918] EXT4-fs (sda3): mounted filesystem with ordered data mode. Opts: (null) <= mounting of the root filesystem

cat /etc/initramfs-tools/modules

List of modules that you want to include in your initramfs.

They will be loaded at boot time in the order below.

#

Syntax: module_name [args ...]

#

You must run update-initramfs(8) to effect this change.

#

Examples:

#

raid1

sd_mod

uas usb_storage usbcore ehci_hcd ehci_orion usb_common nls_base scsi_mod

dmesg

[ 0.000000] Booting Linux on physical CPU 0x0 [ 0.000000] Linux version 4.12.13 (jeremy@earth) (gcc version 6.3.0 20170516 (Debian 6.3.0-18) ) #4 Tue Nov 3 14:18:55 CST 2020 [ 0.000000] CPU: Feroceon [41069260] revision 0 (ARMv5TEJ), cr=0005317f [ 0.000000] CPU: VIVT data cache, VIVT instruction cache [ 0.000000] Machine: Buffalo Terastation Pro II/Live [ 0.000000] Clearing invalid memory bank 0KB@0xffffffff [ 0.000000] Clearing invalid memory bank 0KB@0xffffffff [ 0.000000] Clearing invalid memory bank 0KB@0xffffffff [ 0.000000] Ignoring unrecognised tag 0x00000000 [ 0.000000] Ignoring unrecognised tag 0x00000000 [ 0.000000] Ignoring unrecognised tag 0x00000000 [ 0.000000] Ignoring unrecognised tag 0x41000403 [ 0.000000] Memory policy: Data cache writeback [ 0.000000] On node 0 totalpages: 32768 [ 0.000000] free_area_init_node: node 0, pgdat c0598e3c, node_mem_map c7ef9000 [ 0.000000] Normal zone: 256 pages used for memmap [ 0.000000] Normal zone: 0 pages reserved [ 0.000000] Normal zone: 32768 pages, LIFO batch:7 [ 0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=132768 [ 0.000000] pcpu-alloc: [0] 0 [ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 32512 [ 0.000000] Kernel command line: console=ttyS0,115200 root=/dev/sda2 rw initrd=0x00800040,15M panic=5 BOOTVER=1.19 [ 0.000000] PID hash table entries: 512 (order: -1, 2048 bytes) [ 0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes) [ 0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes) [ 0.000000] Memory: 108492K/131072K available (3802K kernel code, 336K rwdata, 1156K rodata, 320K init, 248K bss, 22580K reserved, 0K cma-reserved, 0K highmem) [ 0.000000] Virtual kernel memory layout: vector : 0xffff0000 - 0xffff1000 ( 4 kB) fixmap : 0xffc00000 - 0xfff00000 (3072 kB) vmalloc : 0xc8800000 - 0xff800000 ( 880 MB) lowmem : 0xc0000000 - 0xc8000000 ( 128 MB) pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB) modules : 0xbf000000 - 0xbfe00000 ( 14 MB) .text : 0xc0008000 - 0xc03beb90 (3803 kB) .init : 0xc0502000 - 0xc0552000 ( 320 kB) .data : 0xc0552000 - 0xc05a6180 ( 337 kB) .bss : 0xc05a9b7c - 0xc05e7ea8 ( 249 kB) [ 0.000000] ftrace: allocating 18101 entries in 36 pages [ 0.000000] NR_IRQS:16 nr_irqs:65 65 [ 0.000000] Switching to timer-based delay loop, resolution 6ns [ 0.000014] sched_clock: 32 bits at 166MHz, resolution 6ns, wraps every 12884901885ns [ 6.357017] clocksource: orion_clocksource: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 11467562657 ns [ 6.357772] Console: colour dummy device 80x30 [ 6.357814] Calibrating delay loop (skipped), value calculated using timer frequency.. 333.33 BogoMIPS (lpj=666666) [ 6.357848] pid_max: default: 32768 minimum: 301 [ 6.358113] Security Framework initialized [ 6.358138] Yama: disabled by default; enable with sysctl kernel.yama. [ 6.358374] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes) [ 6.358398] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes) [ 6.359666] CPU: Testing write buffer coherency: ok [ 6.360730] Setting up static identity map for 0x8200 - 0x823c [ 6.363933] devtmpfs: initialized [ 6.365537] VFP support v0.3: implementor 41 architecture 1 part 10 variant 9 rev 0 [ 6.365773] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns [ 6.365805] futex hash table entries: 256 (order: -1, 3072 bytes) [ 6.366241] pinctrl core: initialized pinctrl subsystem [ 6.367886] NET: Registered protocol family 16 [ 6.368534] DMA: preallocated 256 KiB pool for atomic coherent allocations [ 6.372508] cpuidle: using governor ladder [ 6.372531] cpuidle: using governor menu [ 6.372648] Orion ID: MV88F5281-D0. TCLK=166666667. [ 6.372715] Orion: Applying 5281 D0 WFI workaround. [ 6.372824] initial MPP regs: [ 6.372834] 44440000 [ 6.372842] 00000000 [ 6.372859] 00000000

[ 6.372900] final MPP regs: [ 6.372908] 44440000 [ 6.372916] 00000000 [ 6.372932] 00000000

[ 6.374389] PCI host bridge to bus 0000:00 [ 6.374429] pci_bus 0000:00: root bus resource [mem 0xe0000000-0xe7ffffff] [ 6.374460] pci_bus 0000:00: root bus resource [io 0x1000-0xffff] [ 6.374489] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff] [ 6.374549] pci 0000:00:00.0: [11ab:5281] type 00 class 0x058000 [ 6.374591] pci 0000:00:00.0: reg 0x10: [mem 0xf1000000-0xf10fffff 64bit pref] [ 6.374617] pci 0000:00:00.0: reg 0x18: [mem 0x00000000-0x07ffffff] [ 6.374969] PCI: bus0: Fast back to back transfers disabled [ 6.375004] pci_bus 0000:00: busn_res: [bus 00-ff] end is updated to 00 [ 6.375244] PCI host bridge to bus 0001:01 [ 6.375284] pci_bus 0001:01: root bus resource [mem 0xe8000000-0xefffffff] [ 6.375315] pci_bus 0001:01: root bus resource [io 0x10000-0x1ffff] [ 6.375344] pci_bus 0001:01: No busn resource found for root bus, will use [bus 01-ff] [ 6.375412] pci 0001:01:00.0: [11ab:5281] type 00 class 0x058000 [ 6.375459] pci 0001:01:00.0: reg 0x10: [mem 0x00000000-0x07ffffff 64bit pref] [ 6.375491] pci 0001:01:00.0: reg 0x18: [mem 0x10000000-0x1fffffff 64bit pref] [ 6.375523] pci 0001:01:00.0: reg 0x20: [mem 0xf1000000-0xf10fffff 64bit] [ 6.375552] pci 0001:01:00.0: reg 0x30: [mem 0xe0000000-0xe7ffffff pref] [ 6.375622] pci 0001:01:00.0: supports D1 D2 [ 6.375639] pci 0001:01:00.0: PME# supported from D0 D1 D2 D3hot [ 6.375925] pci 0001:01:07.0: [11ab:6042] type 00 class 0x010000 [ 6.375975] pci 0001:01:07.0: reg 0x10: [mem 0x40000000-0x400fffff 64bit] [ 6.376005] pci 0001:01:07.0: reg 0x18: [io 0xf0100000-0xf01000ff] [ 6.376360] PCI: bus1: Fast back to back transfers enabled [ 6.376396] pci_bus 0001:01: busn_res: [bus 01-ff] end is updated to 01 [ 6.376458] pci 0001:01:07.0: BAR 0: assigned [mem 0xe8000000-0xe80fffff 64bit] [ 6.376501] pci 0001:01:07.0: BAR 2: assigned [io 0x10000-0x100ff] [ 6.384543] clocksource: Switched to clocksource orion_clocksource [ 6.431604] VFS: Disk quotas dquot_6.6.0 [ 6.431727] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes) [ 6.446508] NET: Registered protocol family 2 [ 6.447899] TCP established hash table entries: 1024 (order: 0, 4096 bytes) [ 6.447946] TCP bind hash table entries: 1024 (order: 0, 4096 bytes) [ 6.447986] TCP: Hash tables configured (established 1024 bind 1024) [ 6.448121] UDP hash table entries: 256 (order: 0, 4096 bytes) [ 6.448172] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes) [ 6.448490] NET: Registered protocol family 1 [ 6.448647] PCI: CLS 32 bytes, default 32 [ 6.449057] Unpacking initramfs... [ 7.380576] random: fast init done [ 11.443967] Initramfs unpacking failed: junk in compressed archive [ 11.523243] Freeing initrd memory: 15364K [ 11.524281] audit: initializing netlink subsys (disabled) [ 11.525130] audit: type=2000 audit(5.164:1): state=initialized audit_enabled=0 res=1 [ 11.525212] workingset: timestamp_bits=30 max_order=15 bucket_order=0 [ 11.525389] zbud: loaded [ 20.143021] Key type asymmetric registered [ 20.143047] Asymmetric key parser 'x509' registered [ 20.143143] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251) [ 20.143424] io scheduler noop registered [ 20.143564] io scheduler cfq registered (default) [ 20.144846] Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled [ 20.146425] console [ttyS0] disabled [ 20.166609] serial8250.0: ttyS0 at MMIO 0xf1012000 (irq = 4, base_baud = 10416666) is a 16550A [ 20.731314] console [ttyS0] enabled [ 20.755690] serial8250.1: ttyS1 at MMIO 0xf1012100 (irq = 5, base_baud = 10416666) is a 16550A [ 20.765619] libphy: Fixed MDIO Bus: probed [ 20.770175] i2c /dev entries driver [ 20.777549] rtc-rs5c372 0-0032: rs5c372a found, 24hr [ 20.787183] rtc rtc0: invalid alarm value: 2021-1-2 45:84:0 [ 20.793074] rtc-rs5c372 0-0032: rtc core: registered rtc-rs5c372 as rtc0 [ 20.800320] ledtrig-cpu: registered to indicate activity on CPUs [ 20.807958] registered taskstats version 1 [ 20.812183] zswap: loaded using pool lzo/zbud [ 20.818768] rtc-rs5c372 0-0032: setting system clock to 2021-01-02 12:08:32 UTC (1609589312) [ 20.833319] Freeing unused kernel memory: 320K [ 20.837790] This architecture does not have kernel memory protection. [ 21.691155] SCSI subsystem initialized [ 21.752980] usbcore: registered new interface driver usbfs [ 21.788739] usbcore: registered new interface driver hub [ 21.803267] libata version 3.00 loaded. [ 21.810739] sata_mv 0001:01:07.0: version 1.28 [ 21.811132] sata_mv 0001:01:07.0: Gen-IIE 32 slots 4 ports SCSI mode IRQ via INTx [ 21.830863] usbcore: registered new device driver usb [ 21.891032] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver [ 21.934245] ehci-orion: EHCI orion driver [ 21.955424] scsi host0: sata_mv [ 21.962823] orion-ehci orion-ehci.0: EHCI Host Controller [ 21.988682] scsi host1: sata_mv [ 21.998937] orion-ehci orion-ehci.0: new USB bus registered, assigned bus number 1 [ 22.010647] scsi host2: sata_mv [ 22.031741] scsi host3: sata_mv [ 22.045682] ata1: SATA max UDMA/133 mmio m1048576@0xe8000000 port 0xe8022000 irq 44 [ 22.053381] ata2: SATA max UDMA/133 mmio m1048576@0xe8000000 port 0xe8024000 irq 44 [ 22.061049] ata3: SATA max UDMA/133 mmio m1048576@0xe8000000 port 0xe8026000 irq 44 [ 22.068713] ata4: SATA max UDMA/133 mmio m1048576@0xe8000000 port 0xe8028000 irq 44 [ 22.076955] orion-ehci orion-ehci.0: irq 18, io mem 0xf1050000 [ 22.120666] orion-ehci orion-ehci.0: USB 2.0 started, EHCI 1.00 [ 22.139204] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002 [ 22.146039] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1 [ 22.153275] usb usb1: Product: EHCI Host Controller [ 22.158181] usb usb1: Manufacturer: Linux 4.12.13 ehci_hcd [ 22.163692] usb usb1: SerialNumber: orion-ehci.0 [ 22.265988] hub 1-0:1.0: USB hub found [ 22.285956] hub 1-0:1.0: 1 port detected [ 22.556681] ata1: SATA link up 3.0 Gbps (SStatus 123 SControl 300) [ 22.604659] ata1.00: ATA-8: ST3160318AS, CC44, max UDMA/133 [ 22.610265] ata1.00: 312500000 sectors, multi 0: LBA48 NCQ (depth 31/32) [ 22.620590] usb 1-1: new high-speed USB device number 2 using orion-ehci [ 22.680679] ata1.00: configured for UDMA/133 [ 22.685874] scsi 0:0:0:0: Direct-Access ATA ST3160318AS CC44 PQ: 0 ANSI: 5 [ 22.773120] usb 1-1: New USB device found, idVendor=0409, idProduct=005a [ 22.779860] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0 [ 22.798154] hub 1-1:1.0: USB hub found [ 22.806662] hub 1-1:1.0: 4 ports detected [ 23.096594] usb 1-1.1: new high-speed USB device number 3 using orion-ehci [ 23.172609] ata2: SATA link up 3.0 Gbps (SStatus 123 SControl 300) [ 23.201086] ata2.00: ATA-8: SAMSUNG HD321KJ, CP100-10, max UDMA7 [ 23.207122] ata2.00: 625142448 sectors, multi 0: LBA48 NCQ (depth 31/32) [ 23.216650] ata2.00: configured for UDMA/133 [ 23.221706] scsi 1:0:0:0: Direct-Access ATA SAMSUNG HD321KJ 0-10 PQ: 0 ANSI: 5 [ 23.234491] usb 1-1.1: New USB device found, idVendor=0781, idProduct=5567 [ 23.241416] usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 23.248764] usb 1-1.1: Product: Cruzer Blade [ 23.253059] usb 1-1.1: Manufacturer: SanDisk [ 23.257352] usb 1-1.1: SerialNumber: 4C530003050719115581 [ 23.289357] usb-storage 1-1.1:1.0: USB Mass Storage device detected [ 23.296286] scsi host4: usb-storage 1-1.1:1.0 [ 23.306380] usbcore: registered new interface driver usb-storage [ 23.321324] usbcore: registered new interface driver uas [ 23.736609] ata3: SATA link up 3.0 Gbps (SStatus 123 SControl 300) [ 23.747563] ata3.00: ATA-7: Hitachi HDS721010KLA330, GKAOA70M, max UDMA/133 [ 23.754554] ata3.00: 1953525168 sectors, multi 0: LBA48 NCQ (depth 31/32) [ 23.768369] ata3.00: configured for UDMA/133 [ 23.773419] scsi 2:0:0:0: Direct-Access ATA Hitachi HDS72101 A70M PQ: 0 ANSI: 5 [ 24.256618] ata4: SATA link up 3.0 Gbps (SStatus 123 SControl 300) [ 24.267571] ata4.00: ATA-8: Hitachi HDT721010SLA360, ST6OA31B, max UDMA/133 [ 24.274553] ata4.00: 1953525168 sectors, multi 0: LBA48 NCQ (depth 31/32) [ 24.288370] ata4.00: configured for UDMA/133 [ 24.293382] scsi 3:0:0:0: Direct-Access ATA Hitachi HDT72101 A31B PQ: 0 ANSI: 5 [ 24.325946] scsi 4:0:0:0: Direct-Access SanDisk Cruzer Blade 1.00 PQ: 0 ANSI: 6 [ 24.412892] sd 0:0:0:0: [sda] 312500000 512-byte logical blocks: (160 GB/149 GiB) [ 24.435513] sd 1:0:0:0: [sdb] 625142448 512-byte logical blocks: (320 GB/298 GiB) [ 24.444205] sd 2:0:0:0: [sdc] 1953525168 512-byte logical blocks: (1.00 TB/932 GiB) [ 24.455429] sd 3:0:0:0: [sdd] 1953525168 512-byte logical blocks: (1.00 TB/932 GiB) [ 24.469364] sd 0:0:0:0: [sda] Write Protect is off [ 24.474245] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00 [ 24.475028] sd 1:0:0:0: [sdb] Write Protect is off [ 24.479901] sd 1:0:0:0: [sdb] Mode Sense: 00 3a 00 00 [ 24.480029] sd 4:0:0:0: [sde] 30464000 512-byte logical blocks: (15.6 GB/14.5 GiB) [ 24.488139] sd 2:0:0:0: [sdc] Write Protect is off [ 24.492981] sd 2:0:0:0: [sdc] Mode Sense: 00 3a 00 00 [ 24.493151] sd 3:0:0:0: [sdd] Write Protect is off [ 24.498016] sd 3:0:0:0: [sdd] Mode Sense: 00 3a 00 00 [ 24.498301] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA [ 24.507839] sd 1:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA [ 24.517459] sd 2:0:0:0: [sdc] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA [ 24.526640] sd 4:0:0:0: [sde] Write Protect is off [ 24.531471] sd 4:0:0:0: [sde] Mode Sense: 43 00 00 00 [ 24.531756] sd 3:0:0:0: [sdd] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA [ 24.544039] sd 4:0:0:0: [sde] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA [ 24.564398] sda: sda1 sda2 sda3 sda4 [ 24.591490] sd 0:0:0:0: [sda] Attached SCSI disk [ 24.596973] sde: sde1 sde2 [ 24.601737] sdc: sdc1 sdc4 < sdc5 sdc6 > [ 24.605915] sdd: sdd1 sdd4 < sdd5 sdd6 > [ 24.612764] sdb: [ 24.621990] sd 1:0:0:0: [sdb] Attached SCSI disk [ 24.628782] sd 4:0:0:0: [sde] Attached SCSI removable disk [ 24.646519] sd 3:0:0:0: [sdd] Attached SCSI disk [ 24.651324] sd 2:0:0:0: [sdc] Attached SCSI disk [ 24.941978] random: crng init done [ 26.977918] EXT4-fs (sda3): mounted filesystem with ordered data mode. Opts: (null) [ 28.525454] systemd[1]: Inserted module 'autofs4' [ 28.603507] NET: Registered protocol family 10 [ 28.609527] Segment Routing with IPv6 [ 28.637143] ip_tables: (C) 2000-2006 Netfilter Core Team [ 28.663320] cgroup: cgroup2: unknown option "nsdelegate" [ 28.729146] 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) [ 28.751345] systemd[1]: Detected architecture arm. [ 28.793537] systemd[1]: Set hostname to . [ 31.136373] 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. [ 31.153474] systemd[1]: Proceeding WITHOUT firewalling in effect! (This warning is only shown for the first loaded unit using IP firewalling.) [ 31.950288] systemd[1]: /lib/systemd/system/smbd.service:9: PIDFile= references path below legacy directory /var/run/, updating /var/run/samba/smbd.pid → /run/samba/smbd.pid; please update the unit file accordingly. [ 31.996741] systemd[1]: /lib/systemd/system/nmbd.service:9: PIDFile= references path below legacy directory /var/run/, updating /var/run/samba/nmbd.pid → /run/samba/nmbd.pid; please update the unit file accordingly. [ 32.060598] systemd[1]: /etc/systemd/system/micon_boot.service:5: Unknown lvalue 'Restart' in section 'Unit', ignoring [ 32.071454] systemd[1]: /etc/systemd/system/micon_boot.service:6: Unknown lvalue 'RestartSec' in section 'Unit', ignoring [ 32.354160] systemd[1]: Listening on initctl Compatibility Named Pipe. [ 33.396687] EXT4-fs (sda3): re-mounted. Opts: errors=remount-ro [ 33.758675] systemd[1]: Starting Apply Kernel Variables... [ 33.822556] systemd[1]: Condition check resulted in FUSE Control File System being skipped. [ 33.866072] systemd[1]: Condition check resulted in Kernel Configuration File System being skipped. [ 34.388863] systemd[1]: Started Load/Save Random Seed. [ 34.484909] systemd[1]: Started Create System Users. [ 34.533298] systemd[1]: Started Apply Kernel Variables. [ 34.586807] systemd[1]: Starting Create Static Device Nodes in /dev... [ 35.208908] systemd[1]: Started Create Static Device Nodes in /dev. [ 35.246105] systemd[1]: Reached target Local File Systems (Pre). [ 35.302576] systemd[1]: Starting udev Kernel Device Manager... [ 35.850490] systemd-journald[168]: Received request to flush runtime journal from PID 1 [ 36.646449] mv643xx_eth: MV-643xx 10/100/1000 ethernet driver version 1.4 [ 36.653461] sd 0:0:0:0: Attached scsi generic sg0 type 0 [ 36.691819] sd 1:0:0:0: Attached scsi generic sg1 type 0 [ 36.697577] libphy: PHY orion-mdio-mii:00 not found [ 36.702655] libphy: PHY orion-mdio-mii:01 not found [ 36.707564] libphy: PHY orion-mdio-mii:02 not found [ 36.712478] libphy: PHY orion-mdio-mii:03 not found [ 36.717382] libphy: PHY orion-mdio-mii:04 not found [ 36.722288] libphy: PHY orion-mdio-mii:05 not found [ 36.727185] libphy: PHY orion-mdio-mii:06 not found [ 36.732083] libphy: PHY orion-mdio-mii:07 not found [ 36.736984] libphy: PHY orion-mdio-mii:08 not found [ 36.741881] libphy: PHY orion-mdio-mii:09 not found [ 36.746780] libphy: PHY orion-mdio-mii:0a not found [ 36.751680] libphy: PHY orion-mdio-mii:0b not found [ 36.756579] libphy: PHY orion-mdio-mii:0c not found [ 36.761477] libphy: PHY orion-mdio-mii:0d not found [ 36.766376] libphy: PHY orion-mdio-mii:0e not found [ 36.771274] libphy: PHY orion-mdio-mii:0f not found [ 36.776174] libphy: PHY orion-mdio-mii:10 not found [ 36.781073] libphy: PHY orion-mdio-mii:11 not found [ 36.785972] libphy: PHY orion-mdio-mii:12 not found [ 36.790870] libphy: PHY orion-mdio-mii:13 not found [ 36.795769] libphy: PHY orion-mdio-mii:14 not found [ 36.800668] libphy: PHY orion-mdio-mii:15 not found [ 36.805567] libphy: PHY orion-mdio-mii:16 not found [ 36.810467] libphy: PHY orion-mdio-mii:17 not found [ 36.815365] libphy: PHY orion-mdio-mii:18 not found [ 36.820263] libphy: PHY orion-mdio-mii:19 not found [ 36.825169] libphy: PHY orion-mdio-mii:1a not found [ 36.830070] libphy: PHY orion-mdio-mii:1b not found [ 36.834968] libphy: PHY orion-mdio-mii:1c not found [ 36.839868] libphy: PHY orion-mdio-mii:1d not found [ 36.844767] libphy: PHY orion-mdio-mii:1e not found [ 36.849666] libphy: PHY orion-mdio-mii:1f not found [ 36.880297] sd 2:0:0:0: Attached scsi generic sg2 type 0 [ 36.916983] sd 3:0:0:0: Attached scsi generic sg3 type 0 [ 36.957118] sd 4:0:0:0: Attached scsi generic sg4 type 0 [ 38.331226] libphy: orion_mdio_bus: probed [ 38.366753] mv643xx_eth_port mv643xx_eth_port.0 eth0: port 0 with MAC address 00:16:01:a5:a7:d6 [ 38.416868] physmap platform flash device: 00040000 at f4000000 [ 39.206564] Found: SST 39LF020 [ 39.213899] physmap-flash.0: Found 1 x8 devices at 0x0 in 8-bit bank [ 39.562311] raid6: int32x1 gen() 31 MB/s [ 39.633302] raid6: int32x1 xor() 39 MB/s [ 39.705257] raid6: int32x2 gen() 47 MB/s [ 39.776959] raid6: int32x2 xor() 53 MB/s [ 39.848854] raid6: int32x4 gen() 54 MB/s [ 39.920763] raid6: int32x4 xor() 47 MB/s [ 39.993431] raid6: int32x8 gen() 59 MB/s [ 40.065193] raid6: int32x8 xor() 44 MB/s [ 40.069500] raid6: using algorithm int32x8 gen() 59 MB/s [ 40.074839] raid6: .... xor() 44 MB/s, rmw enabled [ 40.079651] raid6: using intx1 recovery algorithm [ 40.116376] xor: measuring software checksum speed [ 40.160569] arm4regs : 428.000 MB/sec [ 40.204559] 8regs : 352.000 MB/sec [ 40.248564] 32regs : 427.000 MB/sec [ 40.252770] xor: using function: arm4regs (428.000 MB/sec) [ 40.318160] number of JEDEC chips: 1 [ 41.019826] Btrfs loaded, crc32c=crc32c-generic [ 41.051280] BTRFS: device label SLAVE_NAS devid 1 transid 5257 /dev/sdd6 [ 41.210306] BTRFS: device fsid 7e08214e-3da1-4d58-9858-b8fa09098465 devid 1 transid 104 /dev/sda4 [ 42.420385] BTRFS: device label SLAVE_NAS devid 2 transid 5257 /dev/sdc6 [ 46.276366] EXT4-fs (sda1): mounting ext3 file system using the ext4 subsystem [ 46.325151] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null) [ 47.410880] mv643xx_eth_port mv643xx_eth_port.0 eth0: link down [ 47.428766] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready [ 47.632727] NET: Registered protocol family 17 [ 50.989573] mv643xx_eth_port mv643xx_eth_port.0 eth0: link up, 1000 Mb/s, full duplex, flow control enabled [ 50.999402] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready [ 70.952595] usb 1-1.1: reset high-speed USB device number 3 using orion-ehci [ 71.722579] Adding 1048572k swap on /dev/sde2. Priority:-1 extents:1 across:1048572k FS

1000001101000 commented 3 years ago

One thing to note is that the initrd will set the rootfs based on what you have in your /etc/fstab.

could you post the output of lsblk?

cdwijs commented 3 years ago

Thanks, I have first regenerated initrd, and only afterwards edited my /etc/fstab. I should have regenerated initrd after editing /etc/fstab.

After doing the below steps again, and a reboot it works! I now have a NAS that runs from a memory stick :-)

Thanks for all your help, I doubt if I would have succeeded without your knowledge and encouragement.

I want to boot from /dev/sde1

lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 149G 0 disk ├─sda1 8:1 0 512M 0 part /boot ├─sda2 8:2 0 1G 0 part ├─sda3 8:3 0 10G 0 part / └─sda4 8:4 0 137.5G 0 part sdb 8:16 0 298.1G 0 disk sdc 8:32 0 931.5G 0 disk ├─sdc1 8:33 0 30G 0 part ├─sdc4 8:36 0 1K 0 part ├─sdc5 8:37 0 1K 0 part └─sdc6 8:38 0 901.5G 0 part sdd 8:48 0 931.5G 0 disk ├─sdd1 8:49 0 30G 0 part ├─sdd4 8:52 0 1K 0 part ├─sdd5 8:53 0 1K 0 part └─sdd6 8:54 0 901.5G 0 part sde 8:64 1 14.5G 0 disk ├─sde1 8:65 1 5G 0 part └─sde2 8:66 1 1G 0 part [SWAP] mtdblock0 31:0 0 256K 0 disk

ls -l /dev/disk/by-uuid/

total 0 lrwxrwxrwx 1 root root 10 Jan 2 07:09 24a727b4-771b-4e81-8822-a6d241623136 -> ../../sde1

mount /dev/sde1 /mnt/sde1

rsync -aAXv / /mnt/sde1/ --exclude={/boot/,/dev/,/proc/,/sys/,/tmp/,/var/tmp/,/run/,/mnt/,/media/,/lost+found,/home/cedric/,/swapfile,/storage/,/opt/,/root/}

umount /dev/sde1

cat /etc/fstab

/etc/fstab: static file system information.

UUID=24a727b4-771b-4e81-8822-a6d241623136 / ext4 errors=remount-ro 0 1 UUID=2bb94806-50be-46b4-a036-c82ec89bc765 /boot ext3 defaults 0 2 UUID=f41c8f77-14d3-4906-8acc-0c935040b0d4 none swap sw 0 0

69

apt-get reinstall linux-image-4.12.13

Reading package lists... Done Building dependency tree
Reading state information... Done 0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded. Need to get 0 B/22.2 MB of archives. After this operation, 0 B of additional disk space will be used. (Reading database ... 27775 files and directories currently installed.) Preparing to unpack .../linux-image-4.12.13_4.12.13-4_armel.deb ... Unpacking linux-image-4.12.13 (4.12.13-4) over (4.12.13-4) ... Setting up linux-image-4.12.13 (4.12.13-4) ... update-initramfs: Generating /boot/initrd.img-4.12.13 I: The initramfs will attempt to resume from /dev/sde2 I: (UUID=f41c8f77-14d3-4906-8acc-0c935040b0d4) I: Set the RESUME variable to override this. flash-kernel: deferring update (trigger activated) flash-kernel: deferring update (trigger activated) Processing triggers for flash-kernel (3.99) ... flash-kernel: installing version 4.12.13 Generating kernel u-boot image... done. Taking backup of uImage.buffalo. Installing new uImage.buffalo. Generating initramfs u-boot image... done. Taking backup of initrd.buffalo. Installing new initrd.buffalo.

The UUID from my memory stick is now correct in initrd.buffalo:

tail -c+65 < /boot/initrd.buffalo > ~/out

pax -J -r < ~/out

cat conf/param.conf

ROOT="/dev/disk/by-uuid/24a727b4-771b-4e81-8822-a6d241623136"

/sbin/reboot

df -h

Filesystem Size Used Avail Use% Mounted on udev 53M 0 53M 0% /dev tmpfs 26M 1.7M 25M 7% /run /dev/sde1 4.9G 935M 3.7G 20% / <YESSSS!!!!! tmpfs 61M 0 61M 0% /dev/shm tmpfs 5.0M 0 5.0M 0% /run/lock tmpfs 61M 0 61M 0% /sys/fs/cgroup /dev/sda1 492M 61M 406M 13% /boot tmpfs 13M 0 13M 0% /run/user/1000

1000001101000 commented 3 years ago

Great!