E:Unable to unlock /dev/block/mmcblk0* for flashing: (null)

Search This thread

fermi6-626

Member
May 20, 2022
18
1
DEVICE: samsung galaxy f22 sm-e225f (2022)
ANDROID VERSION: 11
TWRP: UNOFFICAL TWRP 3.6.11
VBMETA: disabled
MAGISK INSTALLED before flashing TWRP and flashing using TWRP



I:eek:peration_start: 'Flashing'
Installing zip file '/external_sd/v4afx_v2.7.2.1.zip'
Unmounting System...
I:Update binary zip
Verifying package compatibility...
Package doesn't contain compatibility.zip entry
I:Extracting updater binary 'META-INF/com/google/android/update-binary'
I:Zip does not contain SELinux file_contexts file in its root.
- Mounting /system
mount: mounting /system on /system_root failed: Invalid argument
- Mounting /system_root
- Mounting /vendor
- Device is system-as-root
- Mounting /apex/com.android.apex.cts.shim
- Mounting /apex/com.android.art
- Mounting /apex/com.android.i18n
- Mounting /apex/com.android.runtime
- Mounting /apex/com.android.vndk.v30
- Mounting /apex/com.android.wifi
- Mounting /apex/com.android.adbd
- Mounting /apex/com.android.cellbroadcast
- Mounting /apex/com.android.conscrypt
- Mounting /apex/com.android.extservices
- Mounting /apex/com.android.ipsec
- Mounting /apex/com.android.media
- Mounting /apex/com.android.media.swcodec
- Mounting /apex/com.android.mediaprovider
- Mounting /apex/com.android.neuralnetworks
- Mounting /apex/com.android.os.statsd
- Mounting /apex/com.android.permission
- Mounting /apex/com.android.resolv
- Mounting /apex/com.android.sdkext
- Mounting /apex/com.android.tethering
- Mounting /apex/com.android.tzdata
Archive: /external_sd/v4afx_v2.7.2.1.zip
inflating: module.prop
***********************************************************
ViPER4Android FX
by ViPER520, ZhuHang, Pittvandewitt, MrWhite214, Zackptg5
***********************************************************
*******************
Powered by Magisk
*******************
Archive: /external_sd/v4afx_v2.7.2.1.zip
inflating: customize.sh
**************************************
* MMT Extended by Zackptg5 @ XDA *
**************************************

- Only uninstall is supported in recovery
Uninstalling!
- Unmounting partitions
I:Updater process ended with RC=0
I:Install took 10 second(s).
E:Unable to unlock /dev/block/mmcblk0p4 for flashing: (null)
E:Unable to unlock /dev/block/mmcblk0p6 for flashing: (null)
E:Unable to unlock /dev/block/mmcblk0p14 for flashing: (null)
E:Unable to unlock /dev/block/mmcblk0p13 for flashing: (null)
E:Unable to unlock /dev/block/mmcblk0p9 for flashing: (null)
E:Unable to unlock /dev/block/mmcblk0p18 for flashing: (null)
E:Unable to unlock /dev/block/mmcblk0p42 for flashing: (null)
E:Unable to unlock /dev/block/mmcblk0p15 for flashing: (null)
E:Unable to unlock /dev/block/mmcblk0p7 for flashing: (null)
E:Unable to unlock /dev/block/mmcblk0p5 for flashing: (null)
E:Unable to unlock /dev/block/mmcblk0p11 for flashing: (null)
E:Unable to unlock /dev/block/mmcblk0p8 for flashing: (null)
E:Unable to unlock /dev/block/mmcblk0p10 for flashing: (null)
E:Unable to unlock /dev/block/mmcblk0 for flashing: (null)
E:Unable to unlock /dev/block/mmcblk0boot0 for flashing: (null)
E:Unable to unlock /dev/block/mmcblk0p12 for flashing: (null)
Updating partition details...
I:checking for twrp app
I:Data backup size is 10663MB, free: 96262MB.
...done
I:Set page: 'flash_done'
I:eek:peration_end - status=0
I:Set page: 'clear_vars'

TRIED:
mount -o rw /dev/block/mmcblk0p42
mount -o rw /dev/block/mmcblk0p14
mount -o rw /dev/block/mmcblk0boot0
ERROR: mount: '/dev/block/mmcblk014' not in fstab
factory reset
wiping data, internal storage, cache, dalvik_cache

[ EDIT: I flashed self-modified nethunter kernel twrp-only flashable zip. And the errors are the same. The flashing shows successful, then those errors pop up. Device boots up normally, and kernel shows "4.14.186-nethunter". I am worried if the flashing didn't correctly succeed. ]
 

Attachments

  • SmartSelect_20220520-142523_Settings.jpg
    SmartSelect_20220520-142523_Settings.jpg
    46.6 KB · Views: 124
Last edited:

fermi6-626

Member
May 20, 2022
18
1
README.md
Code:
## Flash in Magisk Manager ONLY
It was an example. I flashed self-modified nethunter kernel twrp-only flashable zip. and the errors are the same. the flashing shows successful, then those errors pop up. device boots up normally, and kernel shows "4.14.186-nethunter". i am worried if the flashing didn't correctly succeed.
 

alecxs

Forum Moderator
Staff member
Feb 17, 2016
5,091
8
5,304
gitlab.com
Last edited:
  • Like
Reactions: Donponce94

fermi6-626

Member
May 20, 2022
18
1
So what's the question here? You don't know what the error means?
Code:
LOGERR("Unable to unlock %s for flashing: %s\n", block_device.c_str());

Does your device have mmcblk0 emmc flash memory at all, sure it's not your MicroSD Card?

MediaTek Helio G80 (MT6769V/CU) looks like support both eMMC 5.1 and UFS 2.1
https://www.gsmarena.com/compare.php3?&idPhone1=10996&idPhone2=10948&idPhone3=10429
the question is the flashing shows successful when there are errors. what does the error mean and did my kernel install correctly?
 

alecxs

Forum Moderator
Staff member
Feb 17, 2016
5,091
8
5,304
gitlab.com
you are the creator of that flashable zip, only you can know what you're doing.

all I can see from the incomplete log you provided you're trying to install v4afx_v2.7.2.1.zip from TWRP regardless it must flashed from Magisk. you said this is just example, so I am not spending time in analyzing v4afx_v2.7.2.1.zip and figuring out what it does.

if you get similar error about Unable to unlock mmcblk0 for flashing for each and every flashable zip, it's probably not an issue with the zip itself.

the error means some operation was unable to unlock partition for flashing. it's lacking context, so you should provide recovery.log at least
 
  • Like
Reactions: fermi6-626

fermi6-626

Member
May 20, 2022
18
1
you are the creator of that flashable zip, only you can know what you're doing.

all I can see from the incomplete log you provided you're trying to install v4afx_v2.7.2.1.zip from TWRP regardless it must flashed from Magisk. you said this is just example, so I am not spending time in analyzing v4afx_v2.7.2.1.zip and figuring out what it does.

if you get similar error about Unable to unlock mmcblk0 for flashing for each and every flashable zip, it's probably not an issue with the zip itself.

the error means some operation was unable to unlock partition for flashing. it's lacking context, so you should provide recovery.log at least
twrp log and dmesg log
 
Last edited:
  • Like
Reactions: alecxs

alecxs

Forum Moderator
Staff member
Feb 17, 2016
5,091
8
5,304
gitlab.com
regarding kernel:

that one failed, probably because (1) device is dynamic partitions read-only, or (2) script is not handling /system_root/system correctly
Code:
- Target Image: /dev/block/mmcblk0p36
- Copying firmware to /system/etc/firmware

that part succeed, unrelated to the below error messages
Code:
- Flashed new bootimage
- Boot image patching complete

This looks like a bug in TWRP, please claim it to TWRP maintainer, or just ignore it
Code:
E:Unable to unlock /dev/block/mmcblk0p42 for flashing: (null)
 
  • Like
Reactions: fermi6-626

fermi6-626

Member
May 20, 2022
18
1
regarding kernel:

that one failed, probably because (1) device is dynamic partitions read-only, or (2) script is not handling /system_root/system correctly
Code:
- Target Image: /dev/block/mmcblk0p36
- Copying firmware to /system/etc/firmware

that part succeed, unrelated to the below error messages
Code:
- Flashed new bootimage
- Boot image patching complete

This looks like a bug in TWRP, please claim it to TWRP maintainer, or just ignore it
Code:
E:Unable to unlock /dev/block/mmcblk0p42 for flashing: (null)
Code:
---Magisk Logs---
24.3 (24300)

05-23 09:38:42.264   602   602 I : Magisk 24.3(24300) daemon started
05-23 09:38:42.265   602   602 I : * Device API level: 30
05-23 09:38:42.275   602   604 I : ** post-fs-data mode running
05-23 09:38:42.275   602   604 E : unlock mmcblk0p42 failed with 13: Permission denied
05-23 09:38:42.276   602   604 E : unlock mmcblk0p11 failed with 13: Permission denied
05-23 09:38:42.276   602   604 E : unlock mmcblk0p4 failed with 13: Permission denied
05-23 09:38:42.277   602   604 E : unlock mmcblk0p18 failed with 13: Permission denied
05-23 09:38:42.277   602   604 E : unlock mmcblk0p6 failed with 13: Permission denied
05-23 09:38:42.278   602   604 E : unlock mmcblk0boot0 failed with 13: Permission denied
05-23 09:38:42.278   602   604 E : unlock mmcblk0p15 failed with 13: Permission denied
05-23 09:38:42.279   602   604 E : unlock mmcblk0p5 failed with 13: Permission denied
05-23 09:38:42.279   602   604 E : unlock mmcblk0p7 failed with 13: Permission denied
05-23 09:38:42.279   602   604 E : unlock mmcblk0p14 failed with 13: Permission denied
05-23 09:38:42.279   602   604 E : unlock mmcblk0p10 failed with 13: Permission denied
05-23 09:38:42.280   602   604 E : unlock mmcblk0p8 failed with 13: Permission denied
05-23 09:38:42.280   602   604 E : unlock mmcblk0p13 failed with 13: Permission denied
05-23 09:38:42.286   602   604 E : unlock mmcblk0 failed with 13: Permission denied
05-23 09:38:42.292   602   604 E : unlock mmcblk0p12 failed with 13: Permission denied
05-23 09:38:42.292   602   604 E : unlock mmcblk0p9 failed with 13: Permission denied
05-23 09:38:42.297   602   604 I : * Mounting mirrors
05-23 09:38:42.297   602   604 I : link: /dev/hmrL/.magisk/mirror/metadata
05-23 09:38:42.297   602   604 I : mount: /dev/hmrL/.magisk/mirror/vendor
05-23 09:38:42.297   602   604 I : mount: /dev/hmrL/.magisk/mirror/product
05-23 09:38:42.297   602   604 I : link: /dev/hmrL/.magisk/mirror/cache
05-23 09:38:42.297   602   604 I : mount: /dev/hmrL/.magisk/mirror/data
05-23 09:38:42.297   602   604 I : link: /dev/hmrL/.magisk/mirror/system
05-23 09:38:42.297   602   604 I : mount: /dev/hmrL/.magisk/mirror/system_root
05-23 09:38:42.297   602   604 I : link: /dev/hmrL/.magisk/mirror/system_ext
05-23 09:38:42.297   602   604 I : * Initializing Magisk environment
05-23 09:38:42.350   602   604 I : * Running post-fs-data.d scripts
05-23 09:38:42.353   602   604 I : * Running module post-fs-data scripts
05-23 09:38:42.353   602   604 I : * Loading modules
05-23 15:23:43.917   602   604 I : ** late_start service mode running
05-23 15:23:43.917   602   604 I : * Running service.d scripts
05-23 15:23:43.917   602   604 I : * Running module service scripts
05-23 15:24:05.509   602   604 I : ** boot_complete triggered

---Manager Logs---
24.3 (24300)
 

fermi6-626

Member
May 20, 2022
18
1
regarding kernel:

that one failed, probably because (1) device is dynamic partitions read-only, or (2) script is not handling /system_root/system correctly
Code:
- Target Image: /dev/block/mmcblk0p36
- Copying firmware to /system/etc/firmware

that part succeed, unrelated to the below error messages
Code:
- Flashed new bootimage
- Boot image patching complete

This looks like a bug in TWRP, please claim it to TWRP maintainer, or just ignore it
Code:
E:Unable to unlock /dev/block/mmcblk0p42 for flashing: (null)
During flahing of magisk.zip in twrp it showed same errors but magisk is installed successfully. If it's a bug in twrp, do i need to worry about it?

twrp maintainer is not responding
 

fermi6-626

Member
May 20, 2022
18
1
this is the kernel i've managed to flash successfully but with errors demonstrated above, which is completely out of my comprehension. Can you check it for errors? any help will be greatly appreciated.
 

Attachments

  • kernel-nethunter-20220520_012915-sm-e225f-eleven.zip
    26 MB · Views: 55

alecxs

Forum Moderator
Staff member
Feb 17, 2016
5,091
8
5,304
gitlab.com
that error is in Magisk for same partitions as in TWRP, therefore it's not a bug in TWRP. maybe it's not even an error at all, can be ignored
Code:
E : unlock mmcblk0p42 failed with 13: Permission denied
E : unlock mmcblk0p11 failed with 13: Permission denied
E : unlock mmcblk0p4 failed with 13: Permission denied
E : unlock mmcblk0p18 failed with 13: Permission denied
E : unlock mmcblk0p6 failed with 13: Permission denied
E : unlock mmcblk0boot0 failed with 13: Permission denied
E : unlock mmcblk0p15 failed with 13: Permission denied
E : unlock mmcblk0p5 failed with 13: Permission denied
E : unlock mmcblk0p7 failed with 13: Permission denied
E : unlock mmcblk0p14 failed with 13: Permission denied
E : unlock mmcblk0p10 failed with 13: Permission denied
E : unlock mmcblk0p8 failed with 13: Permission denied
E : unlock mmcblk0p13 failed with 13: Permission denied
E : unlock mmcblk0 failed with 13: Permission denied
E : unlock mmcblk0p12 failed with 13: Permission denied
E : unlock mmcblk0p9 failed with 13: Permission denied
 
  • Love
Reactions: fermi6-626

alecxs

Forum Moderator
Staff member
Feb 17, 2016
5,091
8
5,304
gitlab.com
this is the kernel i've managed to flash successfully but with errors demonstrated above, which is completely out of my comprehension. Can you check it for errors? any help will be greatly appreciated.
regarding /system/etc/firmware
you are using anykernel wrong, I think it should be $SYSTEM/etc/firmware at least (not sure about the read-only ext4-dedup/logical partitions, though)

maybe @osm0sis will help you out

edit: unrelated to anykernel
 
Last edited:
  • Love
Reactions: fermi6-626

fermi6-626

Member
May 20, 2022
18
1
regarding /system/etc/firmware
you are using anykernel wrong, I think it should be $SYSTEM/etc/firmware at least (not sure about the read-only ext4-dedup/logical partitions, though)

maybe @osm0sis will help you out
Because I don't know how to use it. I left it the way it was modified by nethunter-kernel-builder. May be it is a samsung device's problem? If so how do I mount them as read/write? Or mount symlinks etc, like magisk did?

Sorry for asking stupid question, but I saw that the /system/etc/firmware from the zip is being copied to $SYSTEM/etc/firmware to the phone which was given variable as /system. Isn't that what you mean?

There are another errors:
Code:
cp: can't create '/system/etc/firmware/*': No space left on device
cp: can't create '/system_root/init.nethunter.rc': Read-only file system
grep: /system_root/init.rc: No such file or directory
sed: /system_root/init.rc: No such file or directory
chown: /tmp/nethunter/boot-patcher/ramdisk/*: No such file or directory
find: /tmp/nethunter/boot-patcher/ramdisk/*: No such file or directory

Thanks for the help!
 
Last edited:

alecxs

Forum Moderator
Staff member
Feb 17, 2016
5,091
8
5,304
gitlab.com
in case there exist /system symlink, bind mount might fail. you could rename it by adding setup_mountpoint above this line (it probably would also work if set SYSTEM=/system_root/system, not quite sure what's intended for that variable)
Code:
setup_mountpoint /system;
$BB mount -o bind /system_root$system /system;

for rw access you need TWRP with dynamic partitions support. or re-create super.img with this script
 
Last edited:
  • Like
Reactions: fermi6-626

fermi6-626

Member
May 20, 2022
18
1
in case there exist /system symlink, bind mount might fail. you could rename it by adding setup_mountpoint above this line (it probably would also work if set SYSTEM=/system_root/system, not quite sure what's intended for that variable)
Code:
setup_mountpoint /system;
$BB mount -o bind /system_root$system /system;

for rw access you need TWRP with dynamic partitions support. or re-create super.img with this script
There are 3 update-binary files. Not sure which one to edit. and I checked all three but didn't find that exact line.

update-binary files

But i found these lines. Should i edit like this?:
Code:
if is_mounted /system_root; then
  mount_apex;
  if [ -f /system_root/build.prop ]; then
    $BB mount -o bind /system_root /system;
  else
    setup_mountpoint /system;
    $BB mount -o bind /system_root/system /system;
  fi;
fi;

Thanks!
 
Last edited:

alecxs

Forum Moderator
Staff member
Feb 17, 2016
5,091
8
5,304
gitlab.com
No clue what this warning means
Code:
[  140.819754] (0)[460:recovery]Start 0x6000 of disk mmcblk0 not write group aligned
[  140.819794] (0)[460:recovery]End 0x6000 of disk mmcblk0 not write group aligned
[  140.820304] (0)[460:recovery]0x140000 ~ 0x144000 of mmcblk0 is partially write protected

might be related to that
Code:
[  140.467184] (1)[278:teegris rpmb]TZDEV ERR tzdev_teec_connect(60): Failed to connect to root_task socket after 20 retries
[  140.467211] (1)[278:teegris rpmb]TZDEV ERR TEEC_InitializeContext(208): Failed to connect to root task, context = 0000000000000000 ret = -111

my guess these are only QSEE related partitions somehow protected by kernel. you can check partition names by resolving the by-name symlinks.

Code:
ls -l $(find /dev/block -name by-name)/*
 
  • Like
Reactions: fermi6-626

fermi6-626

Member
May 20, 2022
18
1
No clue what this warning means
Code:
[  140.819754] (0)[460:recovery]Start 0x6000 of disk mmcblk0 not write group aligned
[  140.819794] (0)[460:recovery]End 0x6000 of disk mmcblk0 not write group aligned
[  140.820304] (0)[460:recovery]0x140000 ~ 0x144000 of mmcblk0 is partially write protected

might be related to that
Code:
[  140.467184] (1)[278:teegris rpmb]TZDEV ERR tzdev_teec_connect(60): Failed to connect to root_task socket after 20 retries
[  140.467211] (1)[278:teegris rpmb]TZDEV ERR TEEC_InitializeContext(208): Failed to connect to root task, context = 0000000000000000 ret = -111

my guess these are only QSEE related partitions somehow protected by kernel. you can check partition names by resolving the by-name symlinks.

Code:
ls -l $(find /dev/block -name by-name)/*
Thanks @aIecxs, i think these errors aren't in the way of flashing, because i flashed magisk successfully(working!) despite of the same errors. My main concern is getting the problem you stated fixed, that is, /system/etc/firmware isn't getting copied, /system_root being Read-only file system

Code:
cp: can't create directory '/system_root/sbin': Read-only file system
find: ak_patches/: No such file or directory

Please look at my latest recovery.log. It maybe different and provide hints.

Thanks!
 
Last edited:

fermi6-626

Member
May 20, 2022
18
1
Regardless how the flashing went, The kernel seems to be installed. Because I checked that the Stock kernel doesn't support either NFS Client or nfs-kernel-server, and HID interfaces. Another noticeable change was, before flashing my kernel, I could not set my SELinux to permissive(I did not modify this intentionally, I followed a documentation.)

After i installed the kernel, Both of them are working without problems. SELinux is now modifiable.

After each reboot, I get notification:
Android System
There's an internal problem with your device. Contact your manufacturer for details.
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    So what's the question here? You don't know what the error means?
    Code:
    LOGERR("Unable to unlock %s for flashing: %s\n", block_device.c_str());

    Does your device have mmcblk0 emmc flash memory at all, sure it's not your MicroSD Card?

    MediaTek Helio G80 (MT6769V/CU) looks like support both eMMC 5.1 and UFS 2.1
    https://www.gsmarena.com/compare.php3?&idPhone1=10996&idPhone2=10948&idPhone3=10429
    1
    you are the creator of that flashable zip, only you can know what you're doing.

    all I can see from the incomplete log you provided you're trying to install v4afx_v2.7.2.1.zip from TWRP regardless it must flashed from Magisk. you said this is just example, so I am not spending time in analyzing v4afx_v2.7.2.1.zip and figuring out what it does.

    if you get similar error about Unable to unlock mmcblk0 for flashing for each and every flashable zip, it's probably not an issue with the zip itself.

    the error means some operation was unable to unlock partition for flashing. it's lacking context, so you should provide recovery.log at least
    1
    you are the creator of that flashable zip, only you can know what you're doing.

    all I can see from the incomplete log you provided you're trying to install v4afx_v2.7.2.1.zip from TWRP regardless it must flashed from Magisk. you said this is just example, so I am not spending time in analyzing v4afx_v2.7.2.1.zip and figuring out what it does.

    if you get similar error about Unable to unlock mmcblk0 for flashing for each and every flashable zip, it's probably not an issue with the zip itself.

    the error means some operation was unable to unlock partition for flashing. it's lacking context, so you should provide recovery.log at least
    twrp log and dmesg log
    1
    regarding kernel:

    that one failed, probably because (1) device is dynamic partitions read-only, or (2) script is not handling /system_root/system correctly
    Code:
    - Target Image: /dev/block/mmcblk0p36
    - Copying firmware to /system/etc/firmware

    that part succeed, unrelated to the below error messages
    Code:
    - Flashed new bootimage
    - Boot image patching complete

    This looks like a bug in TWRP, please claim it to TWRP maintainer, or just ignore it
    Code:
    E:Unable to unlock /dev/block/mmcblk0p42 for flashing: (null)
    1
    that error is in Magisk for same partitions as in TWRP, therefore it's not a bug in TWRP. maybe it's not even an error at all, can be ignored
    Code:
    E : unlock mmcblk0p42 failed with 13: Permission denied
    E : unlock mmcblk0p11 failed with 13: Permission denied
    E : unlock mmcblk0p4 failed with 13: Permission denied
    E : unlock mmcblk0p18 failed with 13: Permission denied
    E : unlock mmcblk0p6 failed with 13: Permission denied
    E : unlock mmcblk0boot0 failed with 13: Permission denied
    E : unlock mmcblk0p15 failed with 13: Permission denied
    E : unlock mmcblk0p5 failed with 13: Permission denied
    E : unlock mmcblk0p7 failed with 13: Permission denied
    E : unlock mmcblk0p14 failed with 13: Permission denied
    E : unlock mmcblk0p10 failed with 13: Permission denied
    E : unlock mmcblk0p8 failed with 13: Permission denied
    E : unlock mmcblk0p13 failed with 13: Permission denied
    E : unlock mmcblk0 failed with 13: Permission denied
    E : unlock mmcblk0p12 failed with 13: Permission denied
    E : unlock mmcblk0p9 failed with 13: Permission denied