Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored. #113

Closed
yuroc0598 opened this issue Jun 21, 2019 · 11 comments

Comments

@yuroc0598
Copy link

Hi, I came across this issue when analyzing the firmware from Amcrest (things went well when I run firmadyne on other firmwares such as netgear). The libnvram.so couldn't be loaded. The firmware can be downloaded here. I use binwalk to extract the root file system: rootfs.squashfs.img.

Here is what I did:
1.
./sources/extractor/extractor.py -b amcrest -sql 127.0.0.1 -np -nk rootfs.squashfs.img images

Database Image ID: 1

/home/.../firmadyne/rootfs.squashfs.img

MD5: 88c6d45e196fce55e6d6990f24405815
Tag: 1
Temp: /tmp/tmpLuHfYr
Status: Kernel: True, Rootfs: False, Do_Kernel: False, Do_Rootfs: True
Recursing into archive ...

Squashfs filesystem, little endian, version 4.0, compression:xz, size: 1362284 bytes, 245 inodes, blocksize: 131072 bytes, created: 2017-06-29 16:17:33
Found Linux filesystem in /tmp/tmpLuHfYr/_rootfs.squashfs.img.extracted/squashfs-root!
Skipping: completed!
Cleaning up /tmp/tmpLuHfYr...


./scripts/getArch.sh ./images/1.tar.gz
./bin/busybox: armel

./scripts/tar2db.py -i 1 -f ./images/1.tar.gz
sudo ./scripts/makeImage.sh 1

Querying database for architecture... Password for user firmadyne:
armel
----Running----
----Copying Filesystem Tarball----
----Creating QEMU Image----
Formatting '/home/...firmadyne/scratch//1//image.raw', fmt=raw size=1073741824
----Creating Partition Table----

Welcome to fdisk (util-linux 2.31.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0xe7a413a5.

Command (m for help): Created a new DOS disklabel with disk identifier 0xf75b901b.

Command (m for help): Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): Partition number (1-4, default 1): First sector (2048-2097151, default 2048): Last sector, +sectors or +size{K,M,G,T,P} (2048-2097151, default 2097151):
Created a new partition 1 of type 'Linux' and of size 1023 MiB.

Command (m for help): The partition table has been altered.
Syncing disks.

----Mounting QEMU Image----
----Creating Filesystem----
mke2fs 1.44.1 (24-Mar-2018)
Discarding device blocks: done
Creating filesystem with 261888 4k blocks and 65536 inodes
Filesystem UUID: 794ec546-11fe-4363-94e7-22e00efc4750
Superblock backups stored on blocks:
32768, 98304, 163840, 229376

Allocating group tables: done
Writing inode tables: done
Writing superblocks and filesystem accounting information: done

----Making QEMU Image Mountpoint----
----Mounting QEMU Image Partition 1----
----Extracting Filesystem Tarball----
----Creating FIRMADYNE Directories----
----Patching Filesystem (chroot)----
Creating /etc/TZ!
Creating /etc/hosts!
Warning: Recreating device nodes!
Removing /etc/scripts/sys_resetbutton!
----Setting up FIRMADYNE----
----Unmounting QEMU Image----

./scripts/inferNetwork.sh 1

Querying database for architecture... Password for user firmadyne:
armel
Running firmware 1: terminating after 60 secs...
qemu-system-arm: terminating on signal 2 from pid 16070
Inferring network...
Interfaces: []
Done!

./scratch/1/run.sh

And the content of qemu-final-serial.log:

[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.1.17+ (vagrant@vagrant-ubuntu-trusty-64) (gcc version 5.3.0 (GCC) ) #1 Thu Feb 18 01:05:21 UTC 2016
[ 0.000000] CPU: ARMv7 Processor [412fc0f1] revision 1 (ARMv7), cr=10c5387d
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, PIPT instruction cache
[ 0.000000] Machine model: linux,dummy-virt
[ 0.000000] debug: ignoring loglevel setting.
[ 0.000000] Memory policy: Data cache writeback
[ 0.000000] On node 0 totalpages: 65536
[ 0.000000] free_area_init_node: node 0, pgdat c061dfe8, node_mem_map cfdf9000
[ 0.000000] Normal zone: 512 pages used for memmap
[ 0.000000] Normal zone: 0 pages reserved
[ 0.000000] Normal zone: 65536 pages, LIFO batch:15
[ 0.000000] psci: probing for conduit method from DT.
[ 0.000000] psci: PSCIv0.2 detected in firmware.
[ 0.000000] psci: Using standard PSCI v0.2 function IDs
[ 0.000000] CPU: All CPU(s) started in SVC mode.
[ 0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[ 0.000000] pcpu-alloc: [0] 0
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 65024
[ 0.000000] Kernel command line: root=/dev/vda1 console=ttyS0 nandsim.parts=64,64,64,64,64,64,64,64,64,64 rdinit=/firmadyne/preInit.sh rw debug ignore_loglevel print-fatal-signals=1 user_debug=31 firmadyne.syscall=0
[ 0.000000] PID hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
[ 0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
[ 0.000000] Memory: 253340K/262144K available (4297K kernel code, 170K rwdata, 1584K rodata, 180K init, 148K bss, 8804K reserved, 0K 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 : 0xd0800000 - 0xff000000 ( 744 MB)
[ 0.000000] lowmem : 0xc0000000 - 0xd0000000 ( 256 MB)
[ 0.000000] modules : 0xbf000000 - 0xc0000000 ( 16 MB)
[ 0.000000] .text : 0xc0008000 - 0xc05c67bc (5882 kB)
[ 0.000000] .init : 0xc05c7000 - 0xc05f4000 ( 180 kB)
[ 0.000000] .data : 0xc05f4000 - 0xc061e840 ( 171 kB)
[ 0.000000] .bss : 0xc0621000 - 0xc06462d4 ( 149 kB)
[ 0.000000] NR_IRQS:16 nr_irqs:16 16
[ 0.000000] Architected cp15 timer(s) running at 62.50MHz (virt).
[ 0.000000] clocksource arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x1cd42e208c, max_idle_ns: 881590405314 ns
[ 0.000093] sched_clock: 56 bits at 62MHz, resolution 16ns, wraps every 4398046511096ns
[ 0.000175] Switching to timer-based delay loop, resolution 16ns
[ 0.001741] Console: colour dummy device 80x30
[ 0.001915] Calibrating delay loop (skipped), value calculated using timer frequency.. 125.00 BogoMIPS (lpj=625000)
[ 0.001995] pid_max: default: 32768 minimum: 301
[ 0.002505] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.002543] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.006062] CPU: Testing write buffer coherency: ok
[ 0.010381] Setting up static identity map for 0x40008240 - 0x40008298
[ 0.021879] VFP support v0.3: implementor 41 architecture 4 part 30 variant f rev 0
[ 0.026823] clocksource jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.032900] NET: Registered protocol family 16
[ 0.034691] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.036900] cpuidle: using governor ladder
[ 0.036988] cpuidle: using governor menu
[ 0.049877] Serial: AMBA PL011 UART driver
[ 0.050954] 9000000.pl011: ttyS0 at MMIO 0x9000000 (irq = 54, base_baud = 0) is a PL011 rev1
[ 0.055659] console [ttyS0] enabled
[ 0.071253] vgaarb: loaded
[ 0.072178] SCSI subsystem initialized
[ 0.073012] usbcore: registered new interface driver usbfs
[ 0.073458] usbcore: registered new interface driver hub
[ 0.073740] usbcore: registered new device driver usb
[ 0.079006] cfg80211: Calling CRDA to update world regulatory domain
[ 0.080634] Switched to clocksource arch_sys_counter
[ 0.093602] NET: Registered protocol family 2
[ 0.096909] TCP established hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.097108] TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.097462] TCP: Hash tables configured (established 2048 bind 2048)
[ 0.097901] UDP hash table entries: 256 (order: 0, 4096 bytes)
[ 0.098123] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[ 0.099094] NET: Registered protocol family 1
[ 0.099405] PCI: CLS 0 bytes, default 64
[ 0.103747] NetWinder Floating Point Emulator V0.97 (extended precision)
[ 0.105307] futex hash table entries: 256 (order: -1, 3072 bytes)
[ 0.108787] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[ 0.109408] jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
[ 0.109885] romfs: ROMFS MTD (C) 2007 Red Hat, Inc.
[ 0.119314] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 253)
[ 0.119519] io scheduler noop registered
[ 0.119780] io scheduler cfq registered (default)
[ 0.120243] firmadyne: devfs: 1, execute: 1, procfs: 1, syscall: 0
[ 0.121550] ------------[ cut here ]------------
[ 0.121717] WARNING: CPU: 0 PID: 1 at /home/vagrant/firmadyne-kernel/kernel-v4.1/fs/sysfs/dir.c:31 sysfs_warn_dup+0x50/0x6c()
[ 0.121899] sysfs: cannot create duplicate filename '/class/gpio'
[ 0.122069] Modules linked in:
[ 0.122464] CPU: 0 PID: 1 Comm: swapper Not tainted 4.1.17+ #1
[ 0.122567] Hardware name: Generic DT based system
[ 0.123010] [] (unwind_backtrace) from [] (show_stack+0x10/0x14)
[ 0.123259] [] (show_stack) from [] (warn_slowpath_common+0x80/0xa8)
[ 0.123437] [] (warn_slowpath_common) from [] (warn_slowpath_fmt+0x2c/0x3c)
[ 0.123652] [] (warn_slowpath_fmt) from [] (sysfs_warn_dup+0x50/0x6c)
[ 0.123830] [] (sysfs_warn_dup) from [] (sysfs_create_dir_ns+0x74/0x84)
[ 0.124047] [] (sysfs_create_dir_ns) from [] (kobject_add_internal+0xb8/0x2ac)
[ 0.124303] [] (kobject_add_internal) from [] (kset_register+0x1c/0x44)
[ 0.124535] [] (kset_register) from [] (__class_register+0xa8/0x198)
[ 0.124695] [] (__class_register) from [] (__class_create+0x40/0x70)
[ 0.124932] [] (__class_create) from [] (register_devfs_stubs+0x314/0xbb4)
[ 0.125159] [] (register_devfs_stubs) from [] (init_module+0x28/0xa4)
[ 0.125441] [] (init_module) from [] (do_one_initcall+0x104/0x1b4)
[ 0.125659] [] (do_one_initcall) from [] (kernel_init_freeable+0xf0/0x1b0)
[ 0.125875] [] (kernel_init_freeable) from [] (kernel_init+0x8/0xe4)
[ 0.126120] [] (kernel_init) from [] (ret_from_fork+0x14/0x2c)
[ 0.126376] ---[ end trace 4133dadd79166df6 ]---
[ 0.126553] ------------[ cut here ]------------
[ 0.126632] WARNING: CPU: 0 PID: 1 at /home/vagrant/firmadyne-kernel/kernel-v4.1/lib/kobject.c:240 kobject_add_internal+0x240/0x2ac()
[ 0.126825] kobject_add_internal failed for gpio with -EEXIST, don't try to register things with the same name in the same directory.
[ 0.127008] Modules linked in:
[ 0.127145] CPU: 0 PID: 1 Comm: swapper Tainted: G W 4.1.17+ #1
[ 0.127289] Hardware name: Generic DT based system
[ 0.127372] [] (unwind_backtrace) from [] (show_stack+0x10/0x14)
[ 0.127475] [] (show_stack) from [] (warn_slowpath_common+0x80/0xa8)
[ 0.127636] [] (warn_slowpath_common) from [] (warn_slowpath_fmt+0x2c/0x3c)
[ 0.127780] [] (warn_slowpath_fmt) from [] (kobject_add_internal+0x240/0x2ac)
[ 0.127895] [] (kobject_add_internal) from [] (kset_register+0x1c/0x44)
[ 0.128008] [] (kset_register) from [] (__class_register+0xa8/0x198)
[ 0.128112] [] (__class_register) from [] (__class_create+0x40/0x70)
[ 0.128235] [] (__class_create) from [] (register_devfs_stubs+0x314/0xbb4)
[ 0.128339] [] (register_devfs_stubs) from [] (init_module+0x28/0xa4)
[ 0.128443] [] (init_module) from [] (do_one_initcall+0x104/0x1b4)
[ 0.128546] [] (do_one_initcall) from [] (kernel_init_freeable+0xf0/0x1b0)
[ 0.128684] [] (kernel_init_freeable) from [] (kernel_init+0x8/0xe4)
[ 0.128822] [] (kernel_init) from [] (ret_from_fork+0x14/0x2c)
[ 0.129028] ---[ end trace 4133dadd79166df7 ]---
[ 0.129150] firmadyne: Cannot create device class: gpio!
[ 0.130317] firmadyne: Cannot register character device: watchdog, 0xa, 0x82!
[ 0.130434] firmadyne: Cannot register character device: wdt, 0xfd, 0x0!
[ 0.184498] PCI host bridge /pcie@10000000 ranges:
[ 0.184791] IO 0x3eff0000..0x3effffff -> 0x00000000
[ 0.184995] MEM 0x10000000..0x3efeffff -> 0x10000000
[ 0.185078] MEM 0x8000000000..0xffffffffff -> 0x8000000000
[ 0.185443] pci-host-generic 3f000000.pcie: resource collision: [mem 0x00000000-0xffffffff] conflicts with /pl011@9000000 [mem 0x09000000-0x09000fff]
[ 0.185796] pci-host-generic: probe of 3f000000.pcie failed with error -16
[ 0.193289] Non-volatile memory driver v1.3
[ 0.208052] brd: module loaded
[ 0.214834] loop: module loaded
[ 0.221899] vda: vda1
[ 0.228167] 0.flash: Found 2 x16 devices at 0x0 in 32-bit bank. Manufacturer ID 0x000000 Chip ID 0x000000
[ 0.228506] Intel/Sharp Extended Query Table at 0x0031
[ 0.229493] Using buffer write method
[ 0.229716] erase region 0: offset=0x0,size=0x80000,blocks=128
[ 0.232590] 0.flash: Found 2 x16 devices at 0x0 in 32-bit bank. Manufacturer ID 0x000000 Chip ID 0x000000
[ 0.232704] Intel/Sharp Extended Query Table at 0x0031
[ 0.233389] Using buffer write method
[ 0.233453] erase region 0: offset=0x0,size=0x80000,blocks=128
[ 0.233550] Concatenating MTD devices:
[ 0.233613] (0): "0.flash"
[ 0.233661] (1): "0.flash"
[ 0.233709] into device "0.flash"
[ 0.242035] [nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[ 0.242149] [nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[ 0.242244] [nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[ 0.242346] [nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[ 0.242448] [nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[ 0.242547] [nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[ 0.242775] nand: device found, Manufacturer ID: 0x98, Chip ID: 0x39
[ 0.242864] nand: Toshiba NAND 128MiB 1,8V 8-bit
[ 0.242937] nand: 128 MiB, SLC, erase size: 16 KiB, page size: 512, OOB size: 16
[ 0.243422] flash size: 128 MiB
[ 0.243479] page size: 512 bytes
[ 0.243628] OOB area size: 16 bytes
[ 0.243722] sector size: 16 KiB
[ 0.243883] pages number: 262144
[ 0.243962] pages per sector: 32
[ 0.244011] bus width: 8
[ 0.244057] bits in sector size: 14
[ 0.244104] bits in page size: 9
[ 0.244152] bits in OOB size: 4
[ 0.244199] flash size with OOB: 135168 KiB
[ 0.244259] page address bytes: 4
[ 0.244304] sector address bytes: 3
[ 0.244350] options: 0x42
[ 0.246702] Scanning device for bad blocks
[ 0.736419] firmadyne: do_execve: /firmadyne/console
[ 0.736536] OFFSETS: offset of pid: 0x190 offset of comm: 0x270
[ 0.737076] Creating 11 MTD partitions on "NAND 128MiB 1,8V 8-bit":
[ 0.737375] 0x000000000000-0x000000100000 : "NAND simulator partition 0"
[ 0.738780] 0x000000100000-0x000000200000 : "NAND simulator partition 1"
[ 0.739872] 0x000000200000-0x000000300000 : "NAND simulator partition 2"
[ 0.741300] 0x000000300000-0x000000400000 : "NAND simulator partition 3"
[ 0.742351] 0x000000400000-0x000000500000 : "NAND simulator partition 4"
[ 0.743400] 0x000000500000-0x000000600000 : "NAND simulator partition 5"
[ 0.744537] 0x000000600000-0x000000700000 : "NAND simulator partition 6"
[ 0.745916] 0x000000700000-0x000000800000 : "NAND simulator partition 7"
[ 0.746985] 0x000000800000-0x000000900000 : "NAND simulator partition 8"
[ 0.748150] 0x000000900000-0x000000a00000 : "NAND simulator partition 9"
[ 0.749173] 0x000000a00000-0x000008000000 : "NAND simulator partition 10"
[ 0.754586] tun: Universal TUN/TAP device driver, 1.6
[ 0.754648] tun: (C) 1999-2004 Max Krasnyansky maxk@qualcomm.com
[ 0.764292] PPP generic driver version 2.4.2
[ 0.764809] PPP BSD Compression module registered
[ 0.765012] PPP Deflate Compression module registered
[ 0.765172] PPP MPPE Compression module registered
[ 0.765373] NET: Registered protocol family 24
[ 0.765663] PPTP driver version 0.8.5
[ 0.766836] usbcore: registered new interface driver usb-storage
[ 0.768900] rtc-pl031 9010000.pl031: rtc core: registered pl031 as rtc0
[ 0.769495] hidraw: raw HID events driver (C) Jiri Kosina
[ 0.769902] usbcore: registered new interface driver usbhid
[ 0.769994] usbhid: USB HID core driver
[ 0.770386] Netfilter messages via NETLINK v0.30.
[ 0.771393] nf_conntrack version 0.5.0 (3958 buckets, 15832 max)
[ 0.772372] ctnetlink v0.93: registering with nfnetlink.
[ 0.773317] ipip: IPv4 over IPv4 tunneling driver
[ 0.774630] gre: GRE over IPv4 demultiplexor driver
[ 0.774714] ip_gre: GRE over IPv4 tunneling driver
[ 0.777607] ip_tables: (C) 2000-2006 Netfilter Core Team
[ 0.778533] arp_tables: (C) 2002 David S. Miller
[ 0.779459] Initializing XFRM netlink socket
[ 0.779871] NET: Registered protocol family 10
[ 0.784390] ip6_tables: (C) 2000-2006 Netfilter Core Team
[ 0.785317] sit: IPv6 over IPv4 tunneling driver
[ 0.787966] NET: Registered protocol family 17
[ 0.788358] bridge: automatic filtering via arp/ip/ip6tables has been deprecated. Update your scripts to load br_netfilter if you need this.
[ 0.788588] Bridge firewalling registered
[ 0.788699] Ebtables v2.0 registered
[ 0.789397] 8021q: 802.1Q VLAN Support v1.8
[ 0.789872] Registering SWP/SWPB emulation handler
[ 0.792222] rtc-pl031 9010000.pl031: setting system clock to 2019-06-21 21:23:07 UTC (1561152187)
[ 0.798710] EXT4-fs (vda1): couldn't mount as ext3 due to feature incompatibilities
[ 0.800490] EXT4-fs (vda1): mounting ext2 file system using the ext4 subsystem
[ 0.810046] EXT4-fs (vda1): warning: mounting unchecked fs, running e2fsck is recommended
[ 0.813163] EXT4-fs (vda1): mounted filesystem without journal. Opts: (null)
[ 0.813803] VFS: Mounted root (ext2 filesystem) on device 254:1.
[ 0.818683] Freeing unused kernel memory: 180K (c05c7000 - c05f4000)
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
[ 0.902341] firmadyne: sys_reboot[PID: 1 (init)]: magic1:fee1dead, magic2:28121969, cmd:0
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
mount: mounting devpts on /dev/pts failed: No such file or directory
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
mount: mounting /dev/mtdblock6 on /mnt/web/ failed: No such file or directory
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
mount: mounting /dev/mtdblock10 on /mnt/pd/ failed: No such file or directory
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
mount: mounting /dev/mtdblock11 on /mnt/custom/ failed: No such file or directory
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
mount: mounting /dev/mtdblock7 on /usr/ failed: No such file or directory
/etc/init.d/rcS: line 18: mnt_jffs2: not found
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
mount: mounting /dev/mtdblock14 on /mnt/user/ failed: No such file or directory
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
cat: can't open '/proc/dahua/bootpara': No such file or directory
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
dh_keyboard:
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
[: 1: unknown operand
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
ERROR: ld.so: object '/firmadyne/libnvram.so' from LD_PRELOAD cannot be preloaded (internal error): ignored.
/etc/init.d/rcS: line 39: /usr/etc/imod: not found

can't open /dev/myttyS0: No such file or directory

process '/etc/init.d/appauto' (pid 99) exited. Scheduling for restart.

can't open /dev/myttyS0: No such file or directory
[ 3.234366] cfg80211: Calling CRDA to update world regulatory domain

process '/etc/init.d/appauto' (pid 100) exited. Scheduling for restart.

can't open /dev/myttyS0: No such file or directory

process '/etc/init.d/appauto' (pid 101) exited. Scheduling for restart.

can't open /dev/myttyS0: No such file or directory

process '/etc/init.d/appauto' (pid 102) exited. Scheduling for restart.

can't open /dev/myttyS0: No such file or directory
[ 6.382013] cfg80211: Calling CRDA to update world regulatory domain

process '/etc/init.d/appauto' (pid 103) exited. Scheduling for restart.

can't open /dev/myttyS0: No such file or directory

process '/etc/init.d/appauto' (pid 104) exited. Scheduling for restart.

can't open /dev/myttyS0: No such file or directory

process '/etc/init.d/appauto' (pid 105) exited. Scheduling for restart.

can't open /dev/myttyS0: No such file or directory
[ 9.533262] cfg80211: Calling CRDA to update world regulatory domain

process '/etc/init.d/appauto' (pid 106) exited. Scheduling for restart.

can't open /dev/myttyS0: No such file or directory

process '/etc/init.d/appauto' (pid 107) exited. Scheduling for restart.

can't open /dev/myttyS0: No such file or directory

process '/etc/init.d/appauto' (pid 108) exited. Scheduling for restart.

can't open /dev/myttyS0: No such file or directory
[ 12.683266] cfg80211: Calling CRDA to update world regulatory domain

process '/etc/init.d/appauto' (pid 109) exited. Scheduling for restart.

can't open /dev/myttyS0: No such file or directory

process '/etc/init.d/appauto' (pid 110) exited. Scheduling for restart.

can't open /dev/myttyS0: No such file or directory

process '/etc/init.d/appauto' (pid 111) exited. Scheduling for restart.

can't open /dev/myttyS0: No such file or directory

process '/etc/init.d/appauto' (pid 112) exited. Scheduling for restart.

can't open /dev/myttyS0: No such file or directory
[ 15.832155] cfg80211: Calling CRDA to update world regulatory domain

process '/etc/init.d/appauto' (pid 113) exited. Scheduling for restart.

can't open /dev/myttyS0: No such file or directory

process '/etc/init.d/appauto' (pid 114) exited. Scheduling for restart.

can't open /dev/myttyS0: No such file or directory

process '/etc/init.d/appauto' (pid 115) exited. Scheduling for restart.

can't open /dev/myttyS0: No such file or directory
[ 18.982022] cfg80211: Calling CRDA to update world regulatory domain
QEMU: Terminated

@ddcc
Copy link
Collaborator

ddcc commented Jun 21, 2019

Have you tried using the mount script to mount the firmware image, and verify that the libnvram.so is where it should be, and that it has a matching hash?

@yuroc0598
Copy link
Author

Thanks for the quick reply! I checked the image and firmadyne is at / . And the files in /firmadyne are as follows:
console
libnvram
libnvram.override
libnvram.so
preInit.sh
ttyS1

I think the file is there. But I don't know how to verify the hash that you mentioned. Could you please instruct me how to do it? Thanks a lot!

@ddcc
Copy link
Collaborator

ddcc commented Jun 21, 2019

Execute md5sum <input path/libnvram.so> and check that it matches md5sum <firmadyne path/binaries/libnvram.so.armel>

@yuroc0598
Copy link
Author

Thanks. The hash of libnvram.so.armel and "/firmadyne/libnvram.so" (in the qemu image) are the same.

@ddcc
Copy link
Collaborator

ddcc commented Jun 23, 2019

Hmm, might be specific to that firmware then. This would probably require manual debugging to figure out the cause.

@yuroc0598
Copy link
Author

Thank you for your reply! Could you please share some approaches to debug this? I've tried using qemu -s -S ... and gdb-multiarch (by "target remote :1234"), but it seems that no debugging symbols can be found. And I don't know where to insert the breakpoint for the error.

@ddcc
Copy link
Collaborator

ddcc commented Jun 24, 2019

Since the environment variable for LD_PRELOAD is supposed to be set by the kernel, you'll need to figure out why the dynamic linker (ld-linux) is emitting an error and not handling this correctly. Since there probably aren't debugging symbols included, you'll need to look at the disassembly, although having a decompiler like IDA will help. Alternatively, since the dynamic linker is probably open source, if you can figure out the approximate version, you could just rebuild it with debugging symbols using a cross-compile toolchain.

@yuroc0598
Copy link
Author

Cool, thanks! I'll give it a try.

@yuroc0598
Copy link
Author

Hi Dominic, the LD_PRELOAD issue was solved by compiling kernel and libnvram.so using the armhf toolchain. Because the ld.so in the firmware file system was compiled by armhf toolchain. Thanks for all the hints and help! I really appreciate it! Though there are other errors, I think this thread can be closed now.

@ddcc
Copy link
Collaborator

ddcc commented Jun 26, 2019

Ah, that makes sense. Which armhf toolchain did you use?

@yuroc0598
Copy link
Author

It's "arm-linux-gnueabihf-", directly installed by apt on Ubuntu 18.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants