0

This are my original partition tables of my device

Number  Start   End     Size    File system  Name        Flags
19      210MB   4370MB  4161MB  ext4         SYSTEM
20      4370MB  4633MB  262MB   ext4         CACHE
21      4633MB  4638MB  5243MB  ext4         HIDDEN

I tried to shrink size from system and cache partition and deleted hidden to make Vendor partitions. I followed parted commands to do

parted /dev/block/mmcblk0 
rm 19
rm 20
rm 21
mkpart SYSTEM ext4 210MiB 4000MiB 
mkpart CACHE ext4 4000MiB 4200MiB
mkpart VENDOR ext4 4200MiB 4638MiB
name 19 SYSTEM 
name 20 CACHE
name 21 VENDOR

I am trying to make this scriptable which can be flashed through recovery

#!/bin/bash
echo Applying resize operation
cd /sbin/
chmod u+x /parted
parted --script /dev/block/mmcblk0 \
    rm 19 \
    rm 20 \
    rm 21 \
    mkpart SYSTEM ext2 210MiB 4000MiB \
    mkpart CACHE ext2 4000MiB 4200MiB \
    mkpart VENDOR ext2 4200MiB 4638MiB \
    name 19 SYSTEM \
    name 20 CACHE \
    name 21 VENDOR \

but when I flashed I get an error in log

minzip: Extracted file "/sbin/parted"
minzip: Extracted file "/sbin/script.sh"
about to run program [/sbin/script.sh] with 1 args
run_program: execv failed: No such file or directory
run_program: child exited with status 1
0

Does /bin/bash exist in your recovery environment? The fact that the messages you're seeing refer to minzip and run_program indicate that the recovery environment might be quite strictly stripped-down: it might have a different, more compact shell like dash instead of bash.

It looks like your actual script is also adding parted to the system:

minzip: Extracted file "/sbin/parted"

But did you ensure that all the libraries required by parted are also present? You can use the ldd command to view the list of libraries an executable (or another library) depends on. For example, here's the list of dependencies from an x86_64 version of parted. Your actual list will probably be different, depending on options chosen when compiling parted, your system architecture and the pathname conventions of the Linux distribution you're using.

$ ldd /sbin/parted 
    linux-vdso.so.1 (0x00007ffff609a000)
    libparted.so.2 => /lib/x86_64-linux-gnu/libparted.so.2 (0x00007f9d17be2000)
    libreadline.so.7 => /lib/x86_64-linux-gnu/libreadline.so.7 (0x00007f9d17995000)
    libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007f9d1776b000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f9d173cc000)
    libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007f9d171c7000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f9d16fc3000)
    libdevmapper.so.1.02.1 => /lib/x86_64-linux-gnu/libdevmapper.so.1.02.1 (0x00007f9d16d6f000)
    libblkid.so.1 => /lib/x86_64-linux-gnu/libblkid.so.1 (0x00007f9d16b29000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f9d18048000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f9d16921000)
    libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007f9d166f9000)
    libudev.so.1 => /lib/x86_64-linux-gnu/libudev.so.1 (0x00007f9d1822e000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f9d164dc000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f9d161d8000)
    libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f9d15f65000)

Here, linux-vdso.so.1 is a virtual shared object provided by the kernel itself. But all the rest are libraries that must be present or else parted cannot be successfully loaded for execution.

If your environment did not already have parted installed, it's fairly likely it also did not have libparted.so.* installed. Missing that library would have caused the failure of the parted command.

The error message

run_program: execv failed: No such file or directory

is probably trying to tell you that either the command file itself, or one of the libraries it depends on, was not available. A proper shell might have displayed a more detailed error message, but here the message seems to be coming from run_program, which I suppose is the thing that is trying to start your script in the first place.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.