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

Cannot make filesystem #67

Open
zhuanpan opened this issue Dec 6, 2017 · 7 comments
Open

Cannot make filesystem #67

zhuanpan opened this issue Dec 6, 2017 · 7 comments

Comments

@zhuanpan
Copy link

zhuanpan commented Dec 6, 2017

When inputting sudo ./scripts/makeImage.sh, the output is /dev/mapper/loop0p1 is mounted; will not make a filesystem here!. I have do it again using your FAQ,but it has no effect. Looking forward to your answer

@ddcc
Copy link
Collaborator

ddcc commented Dec 7, 2017

That's strange. Are you using a USB boot or live image? People have mentioned an incompatibility in the past with Kali.

@wangray
Copy link

wangray commented Dec 16, 2017

Hi,

I'm having issues along these lines as well. I am using an ESX vm. I have tried changing get_device to /dev/mapper/loop1p1, /dev/mapper/loop2p1, etc. but in all cases I get Unable to mount root fs on unknown-block(8,1).

Here's the contents of my /dev/mapper directory:

control  laredo--66--vg-root  laredo--66--vg-swap_1  loop10p1  loop11p1  loop2p1  loop8p1  loop9p1

and the output of makeImage.sh:

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

Welcome to fdisk (util-linux 2.27.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 0xbfe000f6.

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

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----
add map loop13p1 (252:8): 0 2095104 linear 7:13 2048
----Creating Filesystem----
mke2fs 1.42.13 (17-May-2015)
/dev/mapper/loop10p1 contains a ext2 file system
	last mounted on /home/raywang/firmadyne/scratch/1/image on Sat Dec 16 11:25:44 2017
Proceed anyway? (y,n) y
Discarding device blocks: done
Creating filesystem with 261888 4k blocks and 65536 inodes
Filesystem UUID: 64d557f6-00f6-486c-b05e-4c02f9254cb0
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)----
Warning: Recreating device nodes!
Removing /etc/scripts/sys_resetbutton!
----Setting up FIRMADYNE----
----Unmounting QEMU Image----
loop deleted : /dev/loop13

@ddcc
Copy link
Collaborator

ddcc commented Dec 16, 2017

What's the output of sudo dmsetup ls and losetup -a? Are you running Kali or a live boot image in the VM?

@V1ncent7
Copy link

I‘ve met the same question with U.
And there is not any interface when input sudo ./scripts/interNetwork.sh

Querying database for architecture... Password for user firmadyne:
mipsel
Running firmware 5: terminating after 60 secs...
main-loop: WARNING: I/O thread spun for 1000 iterations
qemu-system-mipsel: terminating on signal 2 from pid 78553
Inferring network...
Interfaces: []
Done!

I've checked the qemu.initial.serial.log and there isnt any '__inet_insert_ifa' as well.

@ddcc
Copy link
Collaborator

ddcc commented Apr 25, 2018

You should create a separate issue. Have you checked https://github.com/firmadyne/firmadyne#runsh-is-not-generated ?

@V1ncent7
Copy link

thank you,i've solved this problem.
But a new error happened.When i run ./run.sh, there is a Kernel panic --not syncing: No working init found. Try passing init= option to kernel.
And i've found the file in bin and sbin are just text/plain(unexecutable)rather than the symbloic link to busybox just like the example given by github. So i've just change them to symbolic link munaully.

Below is the output of run.sh

Starting firmware emulation... use Ctrl-a + x to exit
tee: /home/vince/firmadyne//scratch//9//qemu.final.serial.log: Permission denied
[ 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.000084] sched_clock: 56 bits at 62MHz, resolution 16ns, wraps every 4398046511096ns
[ 0.000217] Switching to timer-based delay loop, resolution 16ns
[ 0.002050] Console: colour dummy device 80x30
[ 0.002319] Calibrating delay loop (skipped), value calculated using timer frequency.. 125.00 BogoMIPS (lpj=625000)
[ 0.002389] pid_max: default: 32768 minimum: 301
[ 0.002968] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.002991] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.007405] CPU: Testing write buffer coherency: ok
[ 0.012607] Setting up static identity map for 0x40008240 - 0x40008298
[ 0.023245] VFP support v0.3: implementor 41 architecture 4 part 30 variant f rev 0
[ 0.029200] clocksource jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.036586] NET: Registered protocol family 16
[ 0.038472] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.041189] cpuidle: using governor ladder
[ 0.041334] cpuidle: using governor menu
[ 0.055025] Serial: AMBA PL011 UART driver
[ 0.056403] 9000000.pl011: ttyS0 at MMIO 0x9000000 (irq = 53, base_baud = 0) is a PL011 rev1
[ 0.082732] console [ttyS0] enabled
[ 0.105413] vgaarb: loaded
[ 0.106815] SCSI subsystem initialized
[ 0.107883] usbcore: registered new interface driver usbfs
[ 0.108906] usbcore: registered new interface driver hub
[ 0.109830] usbcore: registered new device driver usb
[ 0.117006] cfg80211: Calling CRDA to update world regulatory domain
[ 0.119848] Switched to clocksource arch_sys_counter
[ 0.136615] NET: Registered protocol family 2
[ 0.142018] TCP established hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.142742] TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.143658] TCP: Hash tables configured (established 2048 bind 2048)
[ 0.144577] UDP hash table entries: 256 (order: 0, 4096 bytes)
[ 0.145304] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[ 0.146983] NET: Registered protocol family 1
[ 0.147643] PCI: CLS 0 bytes, default 64
[ 0.155982] NetWinder Floating Point Emulator V0.97 (extended precision)
[ 0.158296] futex hash table entries: 256 (order: -1, 3072 bytes)
[ 0.163370] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[ 0.164745] jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
[ 0.165836] romfs: ROMFS MTD (C) 2007 Red Hat, Inc.
[ 0.173189] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 253)
[ 0.173718] io scheduler noop registered
[ 0.174054] io scheduler cfq registered (default)
[ 0.174495] firmadyne: devfs: 1, execute: 1, procfs: 1, syscall: 0
[ 0.175383] ------------[ cut here ]------------
[ 0.175563] WARNING: CPU: 0 PID: 1 at /home/vagrant/firmadyne-kernel/kernel-v4.1/fs/sysfs/dir.c:31 sysfs_warn_dup+0x50/0x6c()
[ 0.175837] sysfs: cannot create duplicate filename '/class/gpio'
[ 0.176016] Modules linked in:
[ 0.176267] CPU: 0 PID: 1 Comm: swapper Not tainted 4.1.17+ #1
[ 0.176414] Hardware name: Generic DT based system
[ 0.176912] [] (unwind_backtrace) from [] (show_stack+0x10/0x14)
[ 0.177181] [] (show_stack) from [] (warn_slowpath_common+0x80/0xa8)
[ 0.177524] [] (warn_slowpath_common) from [] (warn_slowpath_fmt+0x2c/0x3c)
[ 0.177967] [] (warn_slowpath_fmt) from [] (sysfs_warn_dup+0x50/0x6c)
[ 0.178311] [] (sysfs_warn_dup) from [] (sysfs_create_dir_ns+0x74/0x84)
[ 0.178655] [] (sysfs_create_dir_ns) from [] (kobject_add_internal+0xb8/0x2ac)
[ 0.179047] [] (kobject_add_internal) from [] (kset_register+0x1c/0x44)
[ 0.179392] [] (kset_register) from [] (__class_register+0xa8/0x198)
[ 0.179951] [] (__class_register) from [] (__class_create+0x40/0x70)
[ 0.180304] [] (__class_create) from [] (register_devfs_stubs+0x314/0xbb4)
[ 0.180737] [] (register_devfs_stubs) from [] (init_module+0x28/0xa4)
[ 0.181091] [] (init_module) from [] (do_one_initcall+0x104/0x1b4)
[ 0.181435] [] (do_one_initcall) from [] (kernel_init_freeable+0xf0/0x1b0)
[ 0.181829] [] (kernel_init_freeable) from [] (kernel_init+0x8/0xe4)
[ 0.182364] [] (kernel_init) from [] (ret_from_fork+0x14/0x2c)
[ 0.182780] ---[ end trace ca703b223cd32af4 ]---
[ 0.183057] ------------[ cut here ]------------
[ 0.183328] WARNING: CPU: 0 PID: 1 at /home/vagrant/firmadyne-kernel/kernel-v4.1/lib/kobject.c:240 kobject_add_internal+0x240/0x2ac()
[ 0.183867] kobject_add_internal failed for gpio with -EEXIST, don't try to register things with the same name in the same directory.
[ 0.184348] Modules linked in:
[ 0.184656] CPU: 0 PID: 1 Comm: swapper Tainted: G W 4.1.17+ #1
[ 0.184990] Hardware name: Generic DT based system
[ 0.185273] [] (unwind_backtrace) from [] (show_stack+0x10/0x14)
[ 0.185578] [] (show_stack) from [] (warn_slowpath_common+0x80/0xa8)
[ 0.186366] [] (warn_slowpath_common) from [] (warn_slowpath_fmt+0x2c/0x3c)
[ 0.187598] [] (warn_slowpath_fmt) from [] (kobject_add_internal+0x240/0x2ac)
[ 0.187712] [] (kobject_add_internal) from [] (kset_register+0x1c/0x44)
[ 0.187799] [] (kset_register) from [] (__class_register+0xa8/0x198)
[ 0.187883] [] (__class_register) from [] (__class_create+0x40/0x70)
[ 0.187968] [] (__class_create) from [] (register_devfs_stubs+0x314/0xbb4)
[ 0.188058] [] (register_devfs_stubs) from [] (init_module+0x28/0xa4)
[ 0.188143] [] (init_module) from [] (do_one_initcall+0x104/0x1b4)
[ 0.188294] [] (do_one_initcall) from [] (kernel_init_freeable+0xf0/0x1b0)
[ 0.188382] [] (kernel_init_freeable) from [] (kernel_init+0x8/0xe4)
[ 0.188463] [] (kernel_init) from [] (ret_from_fork+0x14/0x2c)
[ 0.188563] ---[ end trace ca703b223cd32af5 ]---
[ 0.188652] firmadyne: Cannot create device class: gpio!
[ 0.190378] firmadyne: Cannot register character device: watchdog, 0xa, 0x82!
[ 0.190492] firmadyne: Cannot register character device: wdt, 0xfd, 0x0!
[ 0.257778] PCI host bridge /pcie@10000000 ranges:
[ 0.258250] IO 0x3eff0000..0x3effffff -> 0x00000000
[ 0.258661] MEM 0x10000000..0x3efeffff -> 0x10000000
[ 0.258859] MEM 0x8000000000..0xffffffffff -> 0x8000000000
[ 0.259761] pci-host-generic 3f000000.pcie: resource collision: [mem 0x00000000-0xffffffff] conflicts with /pl011@9000000 [mem 0x09000000-0x09000fff]
[ 0.261381] pci-host-generic: probe of 3f000000.pcie failed with error -16
[ 0.270153] Non-volatile memory driver v1.3
[ 0.290253] brd: module loaded
[ 0.299379] loop: module loaded
[ 0.309713] vda: vda1
[ 0.317011] 0.flash: Found 2 x16 devices at 0x0 in 32-bit bank. Manufacturer ID 0x000000 Chip ID 0x000000
[ 0.317784] Intel/Sharp Extended Query Table at 0x0031
[ 0.318886] Using buffer write method
[ 0.323663] erase region 0: offset=0x0,size=0x80000,blocks=128
[ 0.331007] 0.flash: Found 2 x16 devices at 0x0 in 32-bit bank. Manufacturer ID 0x000000 Chip ID 0x000000
[ 0.332824] Intel/Sharp Extended Query Table at 0x0031
[ 0.334205] Using buffer write method
[ 0.334697] erase region 0: offset=0x0,size=0x80000,blocks=128
[ 0.335490] Concatenating MTD devices:
[ 0.335991] (0): "0.flash"
[ 0.336332] (1): "0.flash"
[ 0.336680] into device "0.flash"
[ 0.344359] [nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[ 0.345457] [nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[ 0.346503] [nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[ 0.347657] [nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[ 0.348731] [nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[ 0.350899] [nandsim] warning: read_byte: unexpected data output cycle, state is STATE_READY return 0x0
[ 0.352455] nand: device found, Manufacturer ID: 0x98, Chip ID: 0x39
[ 0.353449] nand: Toshiba NAND 128MiB 1,8V 8-bit
[ 0.356746] nand: 128 MiB, SLC, erase size: 16 KiB, page size: 512, OOB size: 16
[ 0.360520] flash size: 128 MiB
[ 0.361058] page size: 512 bytes
[ 0.361483] OOB area size: 16 bytes
[ 0.361883] sector size: 16 KiB
[ 0.362382] pages number: 262144
[ 0.362838] pages per sector: 32
[ 0.363564] bus width: 8
[ 0.364044] bits in sector size: 14
[ 0.364591] bits in page size: 9
[ 0.365118] bits in OOB size: 4
[ 0.365818] flash size with OOB: 135168 KiB
[ 0.366500] page address bytes: 4
[ 0.367003] sector address bytes: 3
[ 0.367427] options: 0x42
[ 0.370852] Scanning device for bad blocks
[ 0.478681] firmadyne: do_execve: /firmadyne/console
[ 0.478828] OFFSETS: offset of pid: 0x190 offset of comm: 0x270
[ 0.479146] Creating 11 MTD partitions on "NAND 128MiB 1,8V 8-bit":
[ 0.479421] 0x000000000000-0x000000100000 : "NAND simulator partition 0"
[ 0.481140] 0x000000100000-0x000000200000 : "NAND simulator partition 1"
[ 0.482189] 0x000000200000-0x000000300000 : "NAND simulator partition 2"
[ 0.483165] 0x000000300000-0x000000400000 : "NAND simulator partition 3"
[ 0.484149] 0x000000400000-0x000000500000 : "NAND simulator partition 4"
[ 0.485119] 0x000000500000-0x000000600000 : "NAND simulator partition 5"
[ 0.486178] 0x000000600000-0x000000700000 : "NAND simulator partition 6"
[ 0.487589] 0x000000700000-0x000000800000 : "NAND simulator partition 7"
[ 0.488634] 0x000000800000-0x000000900000 : "NAND simulator partition 8"
[ 0.489748] 0x000000900000-0x000000a00000 : "NAND simulator partition 9"
[ 0.491000] 0x000000a00000-0x000008000000 : "NAND simulator partition 10"
[ 0.495897] tun: Universal TUN/TAP device driver, 1.6
[ 0.496013] tun: (C) 1999-2004 Max Krasnyansky maxk@qualcomm.com
[ 0.507872] PPP generic driver version 2.4.2
[ 0.508598] PPP BSD Compression module registered
[ 0.508772] PPP Deflate Compression module registered
[ 0.508909] PPP MPPE Compression module registered
[ 0.509039] NET: Registered protocol family 24
[ 0.509371] PPTP driver version 0.8.5
[ 0.511062] usbcore: registered new interface driver usb-storage
[ 0.513250] rtc-pl031 9010000.pl031: rtc core: registered pl031 as rtc0
[ 0.513790] hidraw: raw HID events driver (C) Jiri Kosina
[ 0.514359] usbcore: registered new interface driver usbhid
[ 0.514485] usbhid: USB HID core driver
[ 0.514781] Netfilter messages via NETLINK v0.30.
[ 0.515359] nf_conntrack version 0.5.0 (3958 buckets, 15832 max)
[ 0.516652] ctnetlink v0.93: registering with nfnetlink.
[ 0.517560] ipip: IPv4 over IPv4 tunneling driver
[ 0.518935] gre: GRE over IPv4 demultiplexor driver
[ 0.519034] ip_gre: GRE over IPv4 tunneling driver
[ 0.522393] ip_tables: (C) 2000-2006 Netfilter Core Team
[ 0.523708] arp_tables: (C) 2002 David S. Miller
[ 0.524399] Initializing XFRM netlink socket
[ 0.524723] NET: Registered protocol family 10
[ 0.529220] ip6_tables: (C) 2000-2006 Netfilter Core Team
[ 0.530286] sit: IPv6 over IPv4 tunneling driver
[ 0.533480] NET: Registered protocol family 17
[ 0.534046] bridge: automatic filtering via arp/ip/ip6tables has been deprecated. Update your scripts to load br_netfilter if you need this.
[ 0.534573] Bridge firewalling registered
[ 0.534766] Ebtables v2.0 registered
[ 0.536050] 8021q: 802.1Q VLAN Support v1.8
[ 0.536734] Registering SWP/SWPB emulation handler
[ 0.539426] rtc-pl031 9010000.pl031: setting system clock to 2018-04-27 04:57:33 UTC (1524805053)
[ 0.551240] EXT4-fs (vda1): couldn't mount as ext3 due to feature incompatibilities
[ 0.552471] EXT4-fs (vda1): mounting ext2 file system using the ext4 subsystem
[ 0.567478] EXT4-fs (vda1): warning: mounting unchecked fs, running e2fsck is recommended
[ 0.572447] EXT4-fs (vda1): mounted filesystem without journal. Opts: (null)
[ 0.573097] VFS: Mounted root (ext2 filesystem) on device 254:1.
[ 0.578340] Freeing unused kernel memory: 180K (c05c7000 - c05f4000)
[ 0.591566] Kernel panic - not syncing: No working init found. Try passing init= option to kernel. See Linux Documentation/init.txt for guidance.
[ 0.591753] CPU: 0 PID: 1 Comm: swapper Tainted: G W 4.1.17+ #1
[ 0.591872] Hardware name: Generic DT based system
[ 0.592039] [] (unwind_backtrace) from [] (show_stack+0x10/0x14)
[ 0.592165] [] (show_stack) from [] (panic+0x70/0x1c8)
[ 0.592242] [] (panic) from [] (kernel_init+0xb8/0xe4)
[ 0.592401] [] (kernel_init) from [] (ret_from_fork+0x14/0x2c)
[ 0.592626] ---[ end Kernel panic - not syncing: No working init found. Try passing init= option to kernel. See Linux Documentation/init.txt for guidance.

@ddcc
Copy link
Collaborator

ddcc commented Apr 29, 2018

Somehow, the init binaries is missing or not executable. You'll need to check /sbin/init, and if it doesn't exist, find the proper name of the init binary for this firmware and move it there.

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

4 participants