PDA

View Full Version : Can't mount the .img file



tboss
2014-07-01, 00:08
Hi !
I'm actually trying to run Kali on my SGS4, mainly to access metasploit.
I've found this script which allows me to boot into debian or ubuntu :

##########################################
#Ubuntu boot script for Android #
#Built by Zachary Powell (zacthespack) #
#But changed by Aou for SGS4 #
# (version1) #
##########################################
export mnt=/data/local/ubmnt
DIR=`dirname $0`
echo "Making mount points and mounting to them..."
mkdir $mnt
busybox mount -o loop,noatime -t ext4 /storage/extSdCard/debian/debian.img $mnt
busybox mount -t devpts devpts $mnt/dev/pts
busybox mount -t proc proc $mnt/proc
busybox mount -t sysfs sysfs $mnt/sys
echo "Connecting to /sdcard..."
busybox mount -o bind /sdcard $mnt/sdcard
echo "Putting in some settings..."
busybox sysctl -w net.ipv4.ip_forward=1
echo "nameserver 8.8.8.8" > $mnt/etc/resolv.conf
echo "nameserver 8.8.4.4" >> $mnt/etc/resolv.conf
echo "127.0.0.1 localhost" > $mnt/etc/hosts
echo "ubuntu is configured with SSH and VNC servers that can be accessed from the IP:"
ifconfig wlan0|grep "inet addr"
echo "(You will see an error about wlan0 if your WiFi is disabled. Safe to ignore.)"
echo "----------------- OKAY, starting Ubuntu! -----------------"
busybox chroot $mnt /root/init.sh
echo "----------------- Ubuntu has exited! -----------------"
echo "Cleaning up - unmounting everything and removing what we made..."
busybox umount -l $mnt/dev/pts
busybox umount -l $mnt/sys
busybox umount -l $mnt/proc
busybox umount -l $mnt/sdcard
busybox umount -l $mnt
rmdir $mnt
echo "Welcome back to your android."

I can confirm it worked, also allowing me to boot a small ubuntu version stored on a FAT32 filesystem.
But I wanted to get metasploit working. So I found another image of Kali ARMEL, and tried to have it working, but had an error (shown after).
I thought the image was corrupted, and downloaded the official Kali image on a second partition ext4 I created on my external SD. I mounted it (/storage/sdcard1).
It is seen by the filesystem and I can browse through the partition using Terminal Emulator, but not through ES Explorer or Root Explorer.
I then used the script that worked once again, and got the same error I had with the previous image :
http://img4.hostingpics.net/thumbs/mini_659291Screenshot20140701015448.png (http://www.hostingpics.net/viewer.php?id=659291Screenshot20140701015448.png)
The mount: mounting /dev/loop0 on /data/local/ubmnt failed: Invalid argument happens when trying to execute the command mount -o loop,noatime -t ext4 /storage/extSdCard/debian/debian.img /data/local/ubmnt (through busybox)
Then I tried to execute the same command on my local Kali Linux on my computer, and had a more detailed error :
mount: wrong fs type, bad option, bad superblock on /dev/loop0,

root@kali:~# mount -o loop,noatime -t ext4 /mnt/Kali/kali.img /mnt/kali-arm
mount: wrong fs type, bad option, bad superblock on /dev/loop0,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so

I tried the given command :

root@kali:~# dmesg | tail
[ 12.782019] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
[ 13.145594] Netfilter messages via NETLINK v0.30.
[ 17.192900] postgres (2569): /proc/2569/oom_adj is deprecated, please use /proc/2569/oom_score_adj instead.
[ 26.295989] vboxsf: Successfully loaded version 4.3.12 (interface 0x00010004)
[ 123.356493] EXT4-fs (loop0): VFS: Can't find ext4 filesystem
[ 135.244912] EXT4-fs (loop0): VFS: Can't find ext4 filesystem
[ 138.770831] EXT4-fs (loop0): VFS: Can't find ext4 filesystem
[ 315.450227] EXT4-fs (loop0): VFS: Can't find ext4 filesystem
[ 1852.532332] EXT4-fs (loop0): VFS: Can't find ext4 filesystem
[ 1869.972661] EXT4-fs (loop0): VFS: Can't find ext4 filesystem
It adds a new line "Can't find ext4 filesystem" at every attempt, and this even if I run mount with -t ext3 or -t ext2.
And again, what is very strange it that it allowed me to mount ubuntu !
Any idea, anyone?
Thanks in advance !