trying to recompile .img using make_ext4fs need help - Nexus 7 (2013) Q&A

Hello,
I compiled aosp for my nexus 7 2013 works fine, but i wanted to add apps and tweak things like bootanimation.zip and remove things like email app, i don't use it why waste space. I use the the follow to allow edits
simg2img system.img system.img.raw
mkdir system
sudo mount -t ext4 -o loop system.img.raw system/
I add my edits and than use this but get and error
[email protected]:~/Downloads/imagedisassemble$ sudo ./make_ext4fs -s -l 512M -a system mesystem.img system/
Creating filesystem with parameters:
Size: 536870912
Block size: 4096
Blocks per group: 32768
Inodes per group: 8192
Inode size: 256
Journal blocks: 2048
Label:
Blocks: 131072
Block groups: 4
Reserved block group size: 31
error: do_inode_allocate_extents: Failed to allocate 3 blocks
I have tried to change 512M to 600M it will finish without error, however when I flash with fastboot flash system system.img, I get stuck on the Google screen and have to force off with power and get into bootloader to try again.
Any help would be great
Thanks
Tony

Related

URGENT! Help Needed - phone may be bricked, not sure what to do

Hello everyone,
I have a Desire HD (Telus) rooted with Android Revolution 5.2.6 installed and 4ext recovery mod.
Overnight my phone locked up and then after popping the battery I could get maybe 30 seconds of use before it would crawl to a halt and lock up again.
I decided to try to wipe the phone and reinstall. Except all of the processes don't complete now. I'll either get (Error 1) or (Error 255) when trying to use the SuperWipe, install the ROM or use the "Wipe all partitions" option.
Right now it's in the 4ext recovery mod and since I've tried all of the wipe options is it safe to try to reboot (back into recovery) or have I wiped 4ext off as well? I have googled this and can't find an answer.
I've noticed that there is a new version of 4ext available (I have 4.1.3 RC2) but apparently the only way to update is via the app store - which obviously I can't do right now.
When trying to format system partition the screen goes blank for a few minutes and eventually returns to the main menu with no info other than a bunch of "E: Can't mount /cache/recovery" messages. The partition list shows system/data/cache as ext4 with only "iB" in the free column.
I'm not sure what to do. Can anyone offer some suggestions?
Here are some recovery log snips:
Code:
==============================================
| Wiping Script |
| This operation will remove all your data |
| You have 10 seconds to remove the battery |
| to cancel this procedure |
==============================================
unmount of /cache failed; no such volume
about to run program [/sbin/erase_image] with 2 args
1. Erasing & formatting EXT4 *CACHE* partitionCreating filesystem with parameters:
Size: 314572288
Block size: 4096
Blocks per group: 32768
Inodes per group: 6400
Inode size: 256
Journal blocks: 1200
Label:
Blocks: 76799
Block groups: 3
Reserved block group size: 23
Created filesystem with 11/19200 inodes and 2459/76799 blocks
(cache is unmounted already)
error: file_write: write: I/O error
E:Error in /sdcard/Android_Revolution_HD_Super_Wipe.zip
(Status 1)
Installation aborted.
MD5s are valid for the super wipe and the new rom:
Code:
Checking md5sum..
md5sum for this file:
89ad0a12c631e28d34d24ee3ea3d64c8
Checking md5sum..
md5sum for this file:
59531c9715527f5725cbd716dfae4549
Here's what happens when I try to flash the ROM:
Code:
===============================================
| Android Revolution HD |
Creating filesystem with parameters:
Size: 585104896
Block size: 4096
Blocks per group: 32768
Inodes per group: 7143
Inode size: 256
Journal blocks: 2232
Label:
Blocks: 142847
Block groups: 5
Reserved block group size: 39
Created filesystem with 11/35715 inodes and 4603/142847 blocks
| by mike1986 |
| Be patient - 1st boot may take a while |
===============================================
>>> Formatting partitions
error: file_write: write: I/O error
E:Error in /sdcard/Android_Revolution_HD-4G_5.2.6.zip
(Status 1)
Installation aborted.
W:failed to mount /dev/block/mmcblk0p27 (Invalid argument)
W:failed to mount /dev/block/mmcblk0p27 (Invalid argument)
E:Can't mount /cache/recovery/log
E:Can't open /cache/recovery/log
W:failed to mount /dev/block/mmcblk0p27 (Invalid argument)
W:failed to mount /dev/block/mmcblk0p27 (Invalid argument)
E:Can't mount /cache/recovery/last_log
E:Can't open /cache/recovery/last_log
W:failed to mount /dev/block/mmcblk0p27 (Invalid argument)
W:failed to mount /dev/block/mmcblk0p27 (Invalid argument)
W:Can't unlink /cache/recovery/command
-- Formatting boot...
Formatting /boot...
I:Formatting unknown device.
-- Formatting system...
Formatting /system...
Creating filesystem with parameters:
Size: 585104896
Block size: 4096
Blocks per group: 32768
Inodes per group: 7143
Inode size: 256
Journal blocks: 2232
Label:
Blocks: 142847
Block groups: 5
Reserved block group size: 39
Created filesystem with 11/35715 inodes and 4603/142847 blocks
error: file_write: write: I/O error
Hmm... This is the Desire forum. Maybe posting in the Desire HD forum they would be able to help you.
Please post in the right section.
SwiftKeyed from dGB using Transparent XDA App

[Q][XS] CWM format error on /system on LT26i

I'm using CWM on my XPERIA LT26i running fw 6.1.A.2.55 with a rooted OS.
If I get the following error in CWM, does that normally mean my internal memory is failing/about to fail???
CWM Recovery for 2012 Xperia v02
by kenjidct
Checking MD5 sums...
Restoring system...
E:format_volume: make_extf4fs failed on /dev/block/mmcblk0p12
Error while formatting /system!
E:Error in /cache/recovery/log
(I/O error)
/cache/recovery/log
Formatting /system...
Creating filesystem with parameters:
Size: 1073741824
Block size: 4096
Blocks per group: 32768
Inodes per group: 8192
Inode size: 256
Journal blocks: 4096
Label:
Blocks: 262144
Block groups: 8
Reserved block group size: 63
Created filesystem with 11/65536 inodes and 8536/262144 blocks
warning: wipe_block_device: Discard failed
error: file_write: write: I/O error
E:format_volume: make_extf4fs failed on /dev/block/mmcblk0p12
Error formatting /system!
I can "doggedly" recover from this error my just keep formatting the /system partition and eventually it completes successfully.
I don't seem to get any operational errors when using my phone and my OS appears to be stable.
This only occurs when attempting to restore a previous backup and the restore fails on the /system partition when attempting to format it.
Manually formatting the /system partition also fails..but can successfully complete after a few attempts. (fingers crossed)
I have seen this 'type' of error reported in the XPERIA U/P/Sola forum too.
Is it possible (I have root access) to run fdisk on the /system partition and if so.. what do I need to do to do that.
And what are the risks?
Thanks for any advice.
[UPDATE]
Additional information that may alleviate my panic ... a bit. Found this in "Advanced Stock ICS Kernel for Xperia S" ROM
Build 14 :
New MMC driver (from codeaurora) : it fixes issue while formatting partitions in CWM
Wifi module built from source (in the ramdisk)
Updated recovery
Disable again hardware clock

[Q] Can't restore CWM backup, error restoring /system

Howdy all,
I recently tried to switch to CM 10.2 M1. It's not working out for me for two reasons:
Poor mobile data performance - requires frequent reboots to maintain data connection
openPDroid is not playing nice with it
So, I'm trying to restore my 10.1.3 backup. I have done a factory wipe from CWM and formatted /system (though I may have tried just restoring previous to that, I don't recall). When I try to restore the backup, the boot.img is restored successfully, it starts /system, and after some seconds it gives the following message and stops the restore process:
Code:
Error restoring /system!
The relevant excerpt of /cache/recovery/log is below. Fortunately I finally got ADB sort-of working again (won't connect from fastboot but does from CWM).
I suspect one of two things:
Somehow the size of the /system partition has changed, but I don't know why, how to verify it (what should it be?), and how to safely change it.
The backup is corrupt. I don't know how to check this. The log indicates md5s are okay for system.ext4.dup, but I don't see any indication in the logs that md5s of all of the blobs are okay or even checked.
Has anyone seen something similar or have any advice?
Thanks!!
VZW toro
CWM 6.0.1.0 used to create the backup and to attempt the restore
Using Linux, which has not always played nice with this phone (MTP not supported, udev hell), which is probably the adb issue during fastboot
Code:
I:Checking for extendedcommand...
I:Skipping execution of extendedcommand, file not found...
I:using /data/media for /sdcard.
I:using /data/media for /sdcard/clockworkmod/backup/2013-11-02.14.40.11/.
Checking MD5 sums...
boot.img: OK
cache.ext4.dup: OK
data.ext4.dup: OK
recovery.img: OK
system.ext4.dup: OK
Erasing boot before restore...
I:Formatting unknown device.
Restoring boot image...
couldn't find default
Found new backup image: /sdcard/clockworkmod/backup/2013-11-02.14.40.11//system.ext4.dup
Restoring system...
Creating filesystem with parameters:
Size: 685768704
Block size: 4096
Blocks per group: 32768
Inodes per group: 6976
Inode size: 256
Journal blocks: 2616
Label:
Blocks: 167424
Block groups: 6
Reserved block group size: 47
Created filesystem with 11/41856 inodes and 5443/167424 blocks
Unable to copy file ./app/Apollo.apk
system
lost+found
addon.d
50-cm.sh
blacklist
70-gapps.sh
71-gapps-faceunlock.sh
app
Apollo.apk
Error while restoring /system!

Corrupt data partition, no network, bootloops

I'm posting this in the hope that it will help someone else. The problems I've had are different enough from other threads that this story could provide some clues for someone else. I am also using a mac, so I'm using Heimdall instead of Odin.
I have an sph-l900, galaxy note 2, on Credo Mobile which is on the Sprint network - obviously.
1. My phone started acting strangely and at some point no longer had a carrier. Red X next to the signal meter.
2. Under Status, IMEI and everything else was unknown.
Everything I read said to reset the phone to a stock rom.
Since I had TWRP, I just tried flashing the usual way from the external sdcard. What I noticed is that I was getting an error on wipe,
'can not mount /data' - this is the big clue I didn't see for a while. It's the cause of bootloops after a flash from TWRP and the cause
of the lost network.
This meant that no matter what I did, When I flashed from TWRP I got a bootloop because the Dahlvik cache was not wiped.
I had to resort to putting the phone in odin mode, and use heimdall to flash all the images.
I made a shell command out of this:
heimdall flash --RECOVERY recovery.img --CACHE cache.img --HIDDEN hidden.img --SYSTEM system.img --TOMBSTONES tombstones.img --RADIO modem.bin --BOOT boot.img --PARAM param.bin --TZSW tz.img --BOOTLOADER sboot.bin --no-reboot --verbose
You can use 'heimdall print-pit' to find out what your partition names are. They are probably uppercase like mine.
Finally I'm booting, but still no carrier. I put TWRP back and tried to mount /data. Still no good.
This means that this rom is where I'm stuck until I can get /data mounting again.
Then I added --repartition --pit T0LTE.pit to my heimdall command. This failed every time. Although repartition was clearly what I needed.
Finally, I removed the --repartition, got it working without /data so I could connect using ADB shell to try repairing /data.
1. cd /etc
2. df to see the file systems. /data is clearly missing.
/etc # df
Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 916024 136 915888 0% /dev
tmpfs 916024 20 916004 0% /tmp
tmpfs 916024 0 916024 0% /storage
tmpfs 916024 0 916024 0% /mnt/secure
tmpfs 916024 0 916024 0% /mnt/fuse
/dev/block/mmcblk0p12
1290112 40712 1249400 3% /cache
3. cat fstab or vold.fstab on older systems -- shows the mountpoints. So I could determine that /data was /dev/block/mmcblk0p16
/etc # cat fstab
/dev/block/mmcblk0p12 /cache ext4 rw
/dev/block/mmcblk0p16 /data ext4 rw
/dev/block/mmcblk0p13 /system ext4 rw
/dev/block/mmcblk0p14 /preload ext4 rw
4. Try to run file system check.
/etc # /sbin/e2fsck /dev/block/mmcblk0p16
e2fsck 1.41.14 (22-Dec-2010)
/sbin/e2fsck: Superblock invalid, trying backup blocks...
/sbin/e2fsck: Bad magic number in super-block while trying to open /dev/block/mmcblk0p16
The superblock could not be read or does not describe a correct ext2
filesystem. If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
4. Get info about the file system. with make file system.
/etc # /sbin/mke2fs -n /dev/block/mmcblk0p16
mke2fs 1.41.14 (22-Dec-2010)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
5136 inodes, 20480 blocks
1024 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=20971520
3 block groups
8192 blocks per group, 8192 fragments per group
1712 inodes per group
Superblock backups stored on blocks:
8193
5. Try file system check with the superblock backup.
/etc # /sbin/e2fsck -b 8193 /dev/block/mmcblk0p16
e2fsck 1.41.14 (22-Dec-2010)
/sbin/e2fsck: Invalid argument while trying to open /dev/block/mmcblk0p16
The superblock could not be read or does not describe a correct ext2
filesystem. If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
6. I have no choice but to try to restore the superblocks. mke2fs with -S will try to do that. I added the block size and groups
from the previous report, but I don't think they were necessary.
etc # mke2fs -b 1024 -g 8192 -S /dev/block/mmcblk0p16
mke2fs 1.41.14 (22-Dec-2010)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
5136 inodes, 20480 blocks
1024 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=20971520
3 block groups
8192 blocks per group, 8192 fragments per group
1712 inodes per group
Superblock backups stored on blocks:
8193
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 37 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
7. Run file system check again to repair any damage. Answer y to any questions.
/etc # /sbin/e2fsck /dev/block/mmcblk0p16
e2fsck 1.41.14 (22-Dec-2010)
/dev/block/mmcblk0p16 contains a file system with errors, check forced.
Resize inode not valid. Recreate<y>? y
yes
Pass 1: Checking inodes, blocks, and sizes
Root inode is not a directory. Clear<y>? yes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Root inode not allocated. Allocate<y>? y
yes
/lost+found not found. Create<y>? yes
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Block bitmap differences: +(1--298) +(8193--8489) +(16385--16600)
Fix<y>? y
yes
Free blocks count wrong for group #0 (7893, counted=7892).
Fix<y>? yes
Free blocks count wrong (19667, counted=19666).
Fix<y>? y
yes
Inode bitmap differences: +1 +(3--10)
Fix<y>? yes
Free inodes count wrong for group #0 (1711, counted=1701).
Fix<y>? y
yes
Directories count wrong for group #0 (1, counted=2).
Fix<y>? yes
Free inodes count wrong (5135, counted=5125).
Fix<y>? y
yes
/dev/block/mmcblk0p16: ***** FILE SYSTEM WAS MODIFIED *****
/dev/block/mmcblk0p16: 11/5136 files (0.0% non-contiguous), 814/20480 blocks
8. Mount data and check to see everything is ok.
/etc # mount /data
/etc # df
Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 916024 136 915888 0% /dev
tmpfs 916024 20 916004 0% /tmp
tmpfs 916024 0 916024 0% /storage
tmpfs 916024 0 916024 0% /mnt/secure
tmpfs 916024 0 916024 0% /mnt/fuse
/dev/block/mmcblk0p12
1290112 40712 1249400 3% /cache
/dev/block/mmcblk0p16
19827 161 18642 1% /data
9. Exit, reboot to Odin mode, Reflash the ROM with heimdall/odin just like before. - leave off the --repartition --pit...
10. Reboot.
I now have an almost working phone. It actually has a network connection. It would be safe at this point to call your phone service
tech support and have them walk you through setting up your phone again.
I do not know what it takes for other phones, but with the note 2, I removed the battery while it was booted up to force an network update.
This gave me a new PRL and set my phone number along with everything else. I now had a working phone,
but for some reason no data service.
11. Turn off wifi, update profile. I get session in progress error.
12. Remove battery while booted, wifi off.
13. Reboot. update profile again. data network established.
That's pretty much it. In a nutshell, I had a corrupt filesystem on /data. The initial indicator of this was no carrier signal with an X on it.
This also caused bootloops when reflashing from TWRP/CWM.
Restoring the /data filesystem and flashing a stock rom restored the carrier and allowed a PRL and Profile update to get the phone working again.
Don't turn on wifi right away, let the phone update the PRL and Profile, and get everything working first.

Stuck in the bootloop after flashing data.img on Pixel C device.

Hi,
I am stuck in the bootloop after flashing data.img on Pixel C device.
I have done the following steps and have serached around in 100s of forums before posting this. Please bear with me.
My bootloader is unlocked and I have flashed my boot partition with dragon-boot-encryptable-rooted-01092016-1.img so that the data is not encrypted by default.
I have a freshly booted up (new setup) device with default apps installed. I installed one app so that the /data partition contains something. I am firing all commands as root on Ubuntu 14
I then flashboot into TWRP recovery so that I can access root shell through adb. This is not flashing the TWRP recovery, just booting into it.
#adb reboot bootloader
#fastboot boot twrp-3.0.0-0-dragon-ryu-02112016-1.img
#adb shell
~ # whoami
root
~ # df
Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 1420244 20 1420224 0% /dev
tmpfs 1420244 20 1420224 0% /tmp
/dev/block/mmcblk0p6 396744 452 388100 0% /cache
/dev/block/mmcblk0p7 55453060 304032 55132644 1% /data
/dev/block/mmcblk0p7 55453060 304032 55132644 1% /sdcard
Now, I am interested only in taking image backup of my /data partition which is at /dev/block/mmcblk0p7. I confirmed this by:
/dev/block/platform/700b0600.sdhci/by-name # ls -l
...
lrwxrwxrwx 1 root root 20 Oct 16 07:38 UDA -> /dev/block/mmcblk0p7
...
Now, I fire the make_ext4fs command to create the image.
~#umount /sdcard (optional)
~ # make_ext4fs -s -l 55453060K -a data mydata.img /data
SELinux: Loaded file_contexts contexts from /file_contexts.
Creating filesystem with parameters:
Size: 56783933440
Block size: 4096
Blocks per group: 32768
Inodes per group: 8176
Inode size: 256
Journal blocks: 32768
Label:
Blocks: 13863265
Block groups: 424
Reserved block group size: 1024
Created filesystem with 11/3466624 inodes and 263660/13863265 blocks
mydata.img is created. I do an adb pull on my Ubuntu and fetch the mydata.img and /file_contexts
#adb pull /file_contexts
#adb pull /mydata.img
# du *
20 file_contexts
140888 mydata.img
Now, I convert the mydata.img into raw image file with simg2img.
#./simg2img mydata.img mydata.img.raw
#ls -lrt
-rw-r--r-- 1 root root 17261 Oct 16 13:17 file_contexts
-rw-r--r-- 1 root root 144267780 Oct 16 13:18 mydata.img
-rw-r--r-- 1 root root 56783933440 Oct 16 13:21 mydata.img.raw
Now, I create a directory and mount my raw image into that directory.
#mkdir phonedata
#mount -t ext4 mydata.img.raw phonedata/
I navigate into phonedata and verify the contents. I can see that the app I installed in avaialable under /data/data.
Then, I re-create the image from phonedata mount using make_ext4fs, or I can use the mydata.img fetch by adb pull too.
If I re-create the image, I give file_contexts(fetched) as the -S option to make_ext4fs. One doubt here, if I am re-creating the sparse image, what value should be passed to -l paramtere now?
I got to fastboot and fire these commands.
#fastboot format userdata
#fastboot format data
#fastboot format cache
#fastboot flash data mydata.img { I am confused between data and userdata, which is the correct one. This is mydata.img from adb pull }
#fastboot flash vendor vendor.img { I read in one forum that vendor should be flashed again on a nexus device }
#fastboot reboot
All things take smoothly. When the tab reboot, it shows Google logo, then android flash animation, then it shows 'Android is starting', and then goes back to flash animation. That is, it's stuck in bootloop.
Kindly let me know if there is something with these steps. Or is there is any alternate way to do the same thing. My problem statement is, I need a flashable data.img. I can create TWRP backup and recovery fine, but that's not my requirement.
Thanks!
Edit 1:
I should add, at this point, if I hard boot to fastboot and do a fastboot format userdata followed by fastboot reboot, I am able to boot to device and perform new device setup.
I can also flash system,boot,vendor,recovery and cache.img and perform new device setup normally. This should mean my fastboot/adb are working fine.
Ummmmm
Did you try with smaller sparse image size ?
make_ext4fs -s -l 30000M -a data mydata.img /data
The sparse will grow until max partition size.
Did you play with "img2simg" as well ? (not simg2img)
img2simg mydata.img.raw mydata.img

Categories

Resources