Temat: LEDE i extroot na modemie LTE
Witam,
Posiadam router TP-LINK WDR3500 i modem Huawei E3372s HILINK. Chciałbym zrobić extroota na karcie włożonej do modemu. Wcześniej na wersji openwrt 12 AA wszystko działało bez problemu (korzystałem z opisu z forum), teraz na LEDE z oficjalnej strony i LEDE z luci stąd nie mogę sobie z tym poradzić.
Problem polega jak zawsze na przełączeniu modemu z cdrom do trybu modemu w którym pojawia się interfejs sieciowy. Korzystam z sposobu opisanego na tym forum z plikiem /sbin/block (wtajemniczeni wiedzą o co chodzi). Problem w tym że na tak wczesnym etapie bootowania LEDE usbmode się wysypuje (normalnie jako skrypt init.d i ręcznie usbmode działa i przełącza modem). Próbowałem także lsusb i dostaje ten sam błąd związany z biblioteką libusb, czyli:
random: usbmode: uninitialized urandom read (4 bytes read, 25 bits of entropy available)
Failed to initialize libusb: LIBUSB_ERROR_OTHER
Ciekawe jest to, że jeśli usunę ze skryptu /sbin/block wywołanie usbmode to modem cały czas jest w trybie cdrom, jeśli wywołanie jest to dostaje powyższy błąd ale modem zostaje przełączony tylko o dużo za późno po montowaniu extroota. Efekt taki że przy skonfigurowanym extroot w /etc/config/fstab modem zostaje rozłączony przez co extroot się wysypuje (błędy ext4, nie można wyświetlić zawartości żadnego katalogu, ogólnie masakra).
Podejrzewam, że jest to związane z brakiem zainicjalizowanej obsługi USB, nie ma katalogu /dev/bus i /dev/bus/usb (w źródłach libusb można się doszukać że pliki urządzeń z tego katalogu są otwierane). I na tym etapie mi przystawiło, nie wiem co odpowiada w procesie bootowania za tworzenie plików urządzeń w tym katalogu. Dziwna sprawa bo dostęp do karty pamięci poprzez /dev/sda już jest i extroot się robi tylko rozłączenie usb jest problemem.
Wstawiam przykładowy log z próbą wywołania usbmode ale bez włączonego extroota:
Starting kernel ...
[ 0.000000] Linux version 4.4.92 (buildbot@builds-02.infra.lede-project.org) (gcc version 5.4.0 (LEDE GCC 5.4.0 r3101-bce140e) ) #0 Tue Oct 17 14:59:45 2017
[ 0.000000] bootconsole [early0] enabled
[ 0.000000] CPU0 revision is: 0001974c (MIPS 74Kc)
[ 0.000000] SoC: Atheros AR9344 rev 2
[ 0.000000] Determined physical RAM map:
[ 0.000000] memory: 08000000 @ 00000000 (usable)
[ 0.000000] Initrd not found or empty - disabling initrd
[ 0.000000] No valid device tree found, continuing without
[ 0.000000] Zone ranges:
[ 0.000000] Normal [mem 0x0000000000000000-0x0000000007ffffff]
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x0000000000000000-0x0000000007ffffff]
[ 0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000007ffffff]
[ 0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[ 0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 32512
[ 0.000000] Kernel command line: board=TL-WDR3500 console=ttyS0,115200 rootfstype=squashfs,jffs2 noinitrd
[ 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] Writing ErrCtl register=00000000
[ 0.000000] Readback ErrCtl register=00000000
[ 0.000000] Memory: 125328K/131072K available (3076K kernel code, 160K rwdata, 412K rodata, 312K init, 205K bss, 5744K reserved, 0K cma-reserved)
[ 0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] NR_IRQS:51
[ 0.000000] Clocks: CPU:560.000MHz, DDR:450.000MHz, AHB:225.000MHz, Ref:40.000MHz
[ 0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 6825930166 ns
[ 0.000009] sched_clock: 32 bits at 280MHz, resolution 3ns, wraps every 7669584382ns
[ 0.008299] Calibrating delay loop... 278.93 BogoMIPS (lpj=1394688)
[ 0.081137] pid_max: default: 32768 minimum: 301
[ 0.086176] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.093227] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.102969] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.113482] futex hash table entries: 256 (order: -1, 3072 bytes)
[ 0.121051] NET: Registered protocol family 16
[ 0.127042] MIPS: machine is TP-LINK TL-WDR3500
[ 0.135137] registering PCI controller with io_map_base unset
[ 0.585791] Can't analyze schedule() prologue at 800670fc
[ 0.600176] PCI host bridge to bus 0000:00
[ 0.604595] pci_bus 0000:00: root bus resource [mem 0x10000000-0x13ffffff]
[ 0.611908] pci_bus 0000:00: root bus resource [io 0x0000]
[ 0.617852] pci_bus 0000:00: root bus resource [??? 0x00000000 flags 0x0]
[ 0.625071] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
[ 0.633585] pci 0000:00:00.0: invalid calibration data
[ 0.639483] pci 0000:00:00.0: BAR 0: assigned [mem 0x10000000-0x1001ffff 64bit]
[ 0.647321] pci 0000:00:00.0: BAR 6: assigned [mem 0x10020000-0x1002ffff pref]
[ 0.655016] pci 0000:00:00.0: using irq 40 for pin 1
[ 0.661040] clocksource: Switched to clocksource MIPS
[ 0.667445] NET: Registered protocol family 2
[ 0.673016] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.680441] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.687256] TCP: Hash tables configured (established 1024 bind 1024)
[ 0.694109] UDP hash table entries: 256 (order: 0, 4096 bytes)
[ 0.700335] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[ 0.707270] NET: Registered protocol family 1
[ 0.716247] Crashlog allocated RAM at address 0x3f00000
[ 0.736099] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[ 0.742350] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[ 0.755205] io scheduler noop registered
[ 0.759382] io scheduler deadline registered (default)
[ 0.765098] Serial: 8250/16550 driver, 16 ports, IRQ sharing enabled
[ 0.774644] console [ttyS0] disabled
[ 0.798530] serial8250.0: ttyS0 at MMIO 0x18020000 (irq = 11, base_baud = 2500000) is a 16550A
[ 0.807723] console [ttyS0] enabled
[ 0.807723] console [ttyS0] enabled
[ 0.815146] bootconsole [early0] disabled
[ 0.815146] bootconsole [early0] disabled
[ 0.828251] m25p80 spi0.0: found en25q64, expected m25p80
[ 0.833799] m25p80 spi0.0: en25q64 (8192 Kbytes)
[ 0.839550] 5 tp-link partitions found on MTD device spi0.0
[ 0.845253] Creating 5 MTD partitions on "spi0.0":
[ 0.850121] 0x000000000000-0x000000020000 : "u-boot"
[ 0.856558] 0x000000020000-0x0000001533c8 : "kernel"
[ 0.863204] 0x0000001533c8-0x0000007f0000 : "rootfs"
[ 0.869786] mtd: device 2 (rootfs) set to be root filesystem
[ 0.875613] 1 squashfs-split partitions found on MTD device rootfs
[ 0.881907] 0x000000390000-0x0000007f0000 : "rootfs_data"
[ 0.888953] 0x0000007f0000-0x000000800000 : "art"
[ 0.895390] 0x000000020000-0x0000007f0000 : "firmware"
[ 0.917705] libphy: ag71xx_mdio: probed
[ 1.512915] ag71xx-mdio.1: Found an AR934X built-in switch
[ 1.555184] eth0: Atheros AG71xx at 0xba000000, irq 5, mode:GMII
[ 2.153111] ag71xx ag71xx.0: connected to PHY at ag71xx-mdio.1:04 [uid=004dd042, driver=Generic PHY]
[ 2.163071] eth1: Atheros AG71xx at 0xb9000000, irq 4, mode:MII
[ 2.171006] NET: Registered protocol family 10
[ 2.179136] NET: Registered protocol family 17
[ 2.183769] bridge: automatic filtering via arp/ip/ip6tables has been deprecated. Update your scripts to load br_netfilter if you need this.
[ 2.196676] 8021q: 802.1Q VLAN Support v1.8
[ 2.206659] VFS: Mounted root (squashfs filesystem) readonly on device 31:2.
[ 2.215298] Freeing unused kernel memory: 312K
[ 3.230035] init: Console is alive
[ 3.233756] init: - watchdog -
[ 4.154098] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[ 4.238003] usbcore: registered new interface driver usbfs
[ 4.243715] usbcore: registered new interface driver hub
[ 4.249192] usbcore: registered new device driver usb
[ 4.259096] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 4.267179] ehci-platform: EHCI generic platform driver
[ 4.272637] ehci-platform ehci-platform: EHCI Host Controller
[ 4.278508] ehci-platform ehci-platform: new USB bus registered, assigned bus number 1
[ 4.288637] ehci-platform ehci-platform: irq 3, io mem 0x1b000000
[ 4.311083] ehci-platform ehci-platform: USB 2.0 started, EHCI 1.00
[ 4.318341] hub 1-0:1.0: USB hub found
[ 4.322531] hub 1-0:1.0: 1 port detected
[ 4.327306] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[ 4.345090] init: - preinit -
[ 4.986043] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[ 5.012162] random: procd: uninitialized urandom read (4 bytes read, 8 bits of entropy available)
Press the [f] key and hit [enter] to enter failsafe mode
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
[ 5.981061] usb 1-1: new high-speed USB device number 2 using ehci-platform
[ 8.179986] jffs2: notice: (388) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
[ 8.200859] mount_root: loading kmods from internal overlay
[ 8.449485] kmodloader: loading kernel modules from /tmp/overlay/upper/etc/modules-boot.d/*
[ 8.792312] SCSI subsystem initialized
[ 8.826340] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 8.834077] ohci-platform: OHCI generic platform driver
[ 8.851622] uhci_hcd: USB Universal Host Controller Interface driver
[ 8.878550] usb-storage 1-1:1.0: USB Mass Storage device detected
[ 8.885455] scsi host0: usb-storage 1-1:1.0
[ 8.890221] usbcore: registered new interface driver usb-storage
[ 8.897554] kmodloader: done loading kernel modules from /tmp/overlay/upper/etc/modules-boot.d/*
- USBMODE START -
/
modules:
crc16 992 1 ext4
crc32c_generic 1248 0
crypto_hash 8800 3 ext4,jbd2,crc32c_generic
ehci_hcd 32368 1 ehci_platform
ehci_platform 4384 0
ext4 316448 0
gpio_button_hotplug 6240 0
jbd2 46832 1 ext4
mbcache 4208 1 ext4
mii 3360 0
nls_base 4704 1 usbcore
ohci_hcd 22000 1 ohci_platform
ohci_platform 3616 0
scsi_mod 86192 2 usb_storage,sd_mod
sd_mod 24784 0
uhci_hcd 18416 0
usb_common 1952 1 usbcore
usb_storage 37120 0
usbcore 115664 6 usb_storage,uhci_hcd,ohci_platform,ohci_hcd,ehci_platform,ehci_hcd
/dev/bus/usb
ls: /dev/bus/usb/: No such file or directory
/dev/bus
ls: /dev/bus/: No such file or directory
/dev
crw------- 1 root root 5, 1 Jan 1 00:00 console
crw------- 1 root root 10, 63 Jan 1 00:00 cpu_dma_latency
crw------- 1 root root 1, 7 Jan 1 00:00 full
crw------- 1 root root 10, 183 Jan 1 00:00 hw_random
crw------- 1 root root 1, 11 Jan 1 00:00 kmsg
crw------- 1 root root 10, 60 Jan 1 00:00 memory_bandwidth
crw------- 1 root root 90, 0 Jan 1 00:00 mtd0
crw------- 1 root root 90, 1 Jan 1 00:00 mtd0ro
crw------- 1 root root 90, 2 Jan 1 00:00 mtd1
crw------- 1 root root 90, 3 Jan 1 00:00 mtd1ro
crw------- 1 root root 90, 4 Jan 1 00:00 mtd2
crw------- 1 root root 90, 5 Jan 1 00:00 mtd2ro
crw------- 1 root root 90, 6 Jan 1 00:00 mtd3
crw------- 1 root root 90, 7 Jan 1 00:00 mtd3ro
crw------- 1 root root 90, 8 Jan 1 00:00 mtd4
crw------- 1 root root 90, 9 Jan 1 00:00 mtd4ro
crw------- 1 root root 90, 10 Jan 1 00:00 mtd5
crw------- 1 root root 90, 11 Jan 1 00:00 mtd5ro
brw------- 1 root root 31, 0 Jan 1 00:00 mtdblock0
brw------- 1 root root 31, 1 Jan 1 00:00 mtdblock1
brw------- 1 root root 31, 2 Jan 1 00:00 mtdblock2
brw------- 1 root root 31, 3 Jan 1 00:00 mtdblock3
brw------- 1 root root 31, 4 Jan 1 00:00 mtdblock4
brw------- 1 root root 31, 5 Jan 1 00:00 mtdblock5
crw------- 1 root root 10, 62 Jan 1 00:00 network_latency
crw------- 1 root root 10, 61 Jan 1 00:00 network_throughput
crw------- 1 root root 1, 3 Jan 1 00:00 null
crw------- 1 root root 1, 4 Jan 1 00:00 port
crw------- 1 root root 5, 2 Jan 1 00:00 ptmx
drwxr-xr-x 2 root root 0 Jan 1 00:00 pts
crw------- 1 root root 1, 8 Jan 1 00:00 random
lrwxrwxrwx 1 root root 8 Jan 1 00:00 shm -> /tmp/shm
crw------- 1 root root 5, 0 Jan 1 00:00 tty
crw------- 1 root root 4, 64 Jan 1 00:00 ttyS0
crw------- 1 root root 4, 65 Jan 1 00:00 ttyS1
crw------- 1 root root 4, 74 Jan 1 00:00 ttyS10
crw------- 1 root root 4, 75 Jan 1 00:00 ttyS11
crw------- 1 root root 4, 76 Jan 1 00:00 ttyS12
crw------- 1 root root 4, 77 Jan 1 00:00 ttyS13
crw------- 1 root root 4, 78 Jan 1 00:00 ttyS14
crw------- 1 root root 4, 79 Jan 1 00:00 ttyS15
crw------- 1 root root 4, 66 Jan 1 00:00 ttyS2
crw------- 1 root root 4, 67 Jan 1 00:00 ttyS3
crw------- 1 root root 4, 68 Jan 1 00:00 ttyS4
crw------- 1 root root 4, 69 Jan 1 00:00 ttyS5
crw------- 1 root root 4, 70 Jan 1 00:00 ttyS6
crw------- 1 root root 4, 71 Jan 1 00:00 ttyS7
crw------- 1 root root 4, 72 Jan 1 00:00 ttyS8
crw------- 1 root root 4, 73 Jan 1 00:00 ttyS9
crw------- [ 9.330220] random: usbmode: uninitialized urandom read (4 bytes read, 25 bits of entropy available)
1 root root 1, 9 Jan 1 00:00 urandom
crw------- 1 root root 10, 130 Jan 1 00:00 watchdog
crw------- 1 root root 1, 5 Jan 1 00:00 zero
Failed to initialize libusb: LIBUSB_ERROR_OTHER
- USBMODE DONE -
[ 9.885032] scsi 0:0:0:0: CD-ROM HUAWEI Mass Storage 2.31 PQ: 0 ANSI: 2
[ 9.895284] scsi 0:0:0:1: Direct-Access HUAWEI TF CARD Storage 2.31 PQ: 0 ANSI: 2
[ 9.906579] sd 0:0:0:1: [sda] 2097152 512-byte logical blocks: (1.07 GB/1.00 GiB)
[ 9.914701] sd 0:0:0:1: [sda] Write Protect is off
[ 9.920070] sd 0:0:0:1: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[ 9.938073] sd 0:0:0:1: [sda] Attached SCSI removable disk
BEFORE EXEC
/dev/bus/usb 2
ls: /dev/bus/usb/: No such file or directory
/tmp/overlay/upper/usr/bin/lsusb: cannot open "/usr/share/usb.ids", No such file or directory
unable to initialize libusb: -99
[ 19.723238] block: attempting to load /tmp/jffs_cfg/upper/etc/config/fstab
[ 19.731953] block: extroot: not configured
[ 19.736971] mount_root: switching to jffs2 overlay
[ 19.748050] urandom-seed: Seeding with /etc/urandom.seed
[ 19.887633] procd: - early -
[ 19.890655] procd: - watchdog -
[ 20.429966] random: jshn: uninitialized urandom read (4 bytes read, 57 bits of entropy available)
[ 20.596425] procd: - watchdog -
[ 20.599885] procd: - ubus -
[ 20.724983] random: jshn: uninitialized urandom read (4 bytes read, 57 bits of entropy available)
[ 20.872763] random: ubusd: uninitialized urandom read (4 bytes read, 58 bits of entropy available)
[ 20.882535] random: ubusd: uninitialized urandom read (4 bytes read, 58 bits of entropy available)
[ 20.892150] random: ubusd: uninitialized urandom read (4 bytes read, 58 bits of entropy available)
[ 20.901339] random: ubusd: uninitialized urandom read (4 bytes read, 58 bits of entropy available)
[ 20.910832] random: ubusd: uninitialized urandom read (4 bytes read, 58 bits of entropy available)
[ 20.920050] random: ubusd: uninitialized urandom read (4 bytes read, 58 bits of entropy available)
[ 20.929894] procd: - init -
Please press Enter to activate this console.
[ 21.333031] kmodloader: loading kernel modules from /etc/modules.d/*
[ 21.344821] ip6_tables: (C) 2000-2006 Netfilter Core Team
[ 21.363984] Loading modules backported from Linux version wt-2017-01-31-0-ge882dff19e7f
[ 21.372165] Backport generated by backports.git backports-20160324-13-g24da7d3c
[ 21.382725] ip_tables: (C) 2000-2006 Netfilter Core Team
[ 21.397122] nf_conntrack version 0.5.0 (1963 buckets, 7852 max)
[ 21.446531] xt_time: kernel timezone is -0000
[ 21.453193] usbcore: registered new interface driver cdc_ether
[ 21.521504] PPP generic driver version 2.4.2
[ 21.528367] NET: Registered protocol family 24
[ 21.594453] ieee80211 phy0: Atheros AR9340 Rev:2 mem=0xb8100000, irq=47
[ 21.601405] PCI: Enabling device 0000:00:00.0 (0000 -> 0002)
[ 21.626916] ieee80211 phy1: Atheros AR9300 Rev:4 mem=0xb0000000, irq=40
[ 21.639502] kmodloader: done loading kernel modules from /etc/modules.d/*
USBMODE START jest wypisywane z skryptu /sbin/block, jest tam listowanie /dev, /dev/bus, /dev/bus/usb, wywołanie lsmod (jak widać potrzebne moduły są załadowane), lsusb, następnie po wypisaniu USBMODE DONE jest petla for z sprawdzaniem /dev/sda, i po wypisaniu BEFORE EXEC wywołuje oryginalny /sbin/block_/block. Czyli standardowy skrypt z tego forum tylko dodane pare rzeczy. Ciekawe jest to że cdrom i karta pojawiają się w trakcje wykonywania skryptu /sbin/block, pomiędzy wywołaniem usbmode i /sbin/block_/block
Jeszcze taka ciekawostka, nie wiem czy to ma znaczenie. Mam trzy partycje na karcie pamięci, na extroot, swap, i współdzielenie plików. W trybie cdrom widoczna jest tylko ta na extroot i pojawia się jako /dev/sda (uuid się zgadza, mogę zamontować). Po przełączeniu w tryb modemu nadal jest /dev/sda tylko to już jest cała karta a pojawia się /dev/sda1, /dev/sda2 i /dev/sda3.