Scripteable partitions using parted












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









share|improve this question





























    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









    share|improve this question



























      0












      0








      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









      share|improve this question
















      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






      gparted parted






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 26 at 10:01









      Thomas

      3,91961327




      3,91961327










      asked Jan 26 at 9:55









      prashant padaduneprashant padadune

      11




      11






















          1 Answer
          1






          active

          oldest

          votes


















          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.






          share|improve this answer























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "106"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f496844%2fscripteable-partitions-using-parted%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            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.






            share|improve this answer




























              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.






              share|improve this answer


























                0












                0








                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.






                share|improve this answer













                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.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jan 26 at 10:58









                telcoMtelcoM

                16.8k12346




                16.8k12346






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Unix & Linux Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f496844%2fscripteable-partitions-using-parted%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    How to make a Squid Proxy server?

                    Is this a new Fibonacci Identity?

                    19世紀