Fedora 38 - I/O zipping error using find command

How do I run an adb shell?

wow…okay better explanation…okay so it seems like at one of the processes…zip was supposed to open to accept the next file…but it didn’t and then that’s when I get the I/O error that the zip can’t open in terminal ?

The reason your not suprised is because…there was nobody else who had a similar error as mine

AFAIK, the following should do on Stock Rom (manufactures firmware/android releases) too

  • you need package “android-tools” installed on your linux box
  • you need to switch “USB debugging” on
    this is usually in an hidden menu point on your phone.
    to make it visible:
    a) go into to your android phone setting into “About phone”
    b) scroll down to “Build number”
    c) tap 7 times on “Build number”
    d) go back to menu point “Systems” (maybe “Advanced” too, on my phone)
    there you’ll find a new menu point “Developer options”
    under that you’ll find “USB debugging”
    e) switch that on
    f) connect your phone with an USB cable
    g) open a terminal on the linux box
    h) key in “adb devices” (should return a number to signal: connection is there)
    i) key in “adb shell”
    you should moved to the directory tree of your phone now
    - out with “exit” or unplug usb cable -

developer options OFF:
first menue point to OFF in menue “developer options” !

ATTENTION:
you should be able to run all linux commands on the phone.
means: “rm -rf” too, what deletes all data on your phone…

more to read:

maybe for your task: => “adb pull”

When I choose the save location of the zip file to be on a 64 GB flash USB drive, I can see that a temporary file gets made but then just before it gets saved, zip I/O error: shows up. Could it be that there is a problem with temporary files or the original zip being saved ?

I think you said you have about 30GB of files to be moved.
Putting them on a 64 GB flash drive would work if you were just copying, but doing so while zipping means temporary files are also created at the same location and use some of the available space. If you have space on your pc then it seems easier to create the zip file on the pc then copy the zip file to the flash drive so the temp files do not interfere.

Ok so I set up adb now and my galaxy s8 is being detected. Should I run the original find and zip command first and then test out the 2nd command find 0_MyConfig/ | zip testfile -@ ??

update: when I use the 1st command it says
find: exec zip: Permission denied

update 2: when I use adb pull -a /sdcard/DCIM/Camera des/ination/path it says
/system/bin/sh: adb: not found

update 3: when using this command
find sdcard/DCIM/Camera/ | zip -0 testfile.zip -@ I get error /system/bin/sh: zip: not found

maybe I should mention that I am doing this on a linux virtual machine with virtualbox lol also I have about 105.4 GB available

That looks great. 105GB of space should easily allow one to create a zip file from about 30 GB of data.

yes, now that I have sufficient space, I ran the above 3 codes in my earlier post with 3 updates. I am not saying that the commands work. I am pointing out that the three commands 3 posts above still produce the same errors

even with alot of space it is still failing

  1. adb shell
  2. locate the correct path to your Camera directory via ls -l
  3. find <correct-path-to-Camera-here> | zip <name-of-archiv-here> -@
    => should create the archiv in the current directory ON THE PHONE

try (my guess):

  1. adb shell
  2. adb pull <correct-options-to-pull-a-directoy> <correct-path-to-Camera-directoy>
    => should create a copy of the above Camera directory in the current directory on your linux box, where you’re on the linux box *before* you executed “adb shell”

“adb shell” operates similar as a chroot command, means you’re afterwards on the phone:
command prompt has changed, ls -l shows the phone’s directory, …

do you get the help of the zip command ( 8 comments above) when you do

  1. adb shell
  2. key in just the command “zip”

if not:
then you do not have the command “zip” on your phone or similar.

I do not have a android device with stock rom here to test

Anyone, to test if “zip” is on stock rom, too ?

Alternative:

  • adb pull …
    or
  • MiXplorer and samba share
    or as sugested
  • shutdown the phone, pull the sdcard, …

hint:
the busbox (a small linux command set) behave different then a normal linux command set !
your parameter for your find command might not be there …

when I type adb devices I am given this message

98897a48334d553957 no permissions; see [http://developer.android.com/tools/device.html]

I am part of the wheel admin group

User azeem may run the following commands on fedora:
    (ALL) ALL

what should I do?

new development:

so I used fuse-zip to mount a zip file as a folder as a fuse file system. Then I set the active directory inside the fuse file system. Then I used this command

find "/run/user/1000/gvfs/dav:host=10.0.0.132,port=8080,ssl=false/sdcard/DCIM/Camera" -exec zip -0 -r . {} +

where . is /home/azeem/Documents/fuse/sdcard/DCIM

Then I received the following error messages

azeem@fedora DCIM]$ find “/run/user/1000/gvfs/dav:host=10.0.0.132,port=8080,ssl=false/sdcard/DCIM/Camera” -exec zip -0 -r . {} +
zip warning: missing end signature–probably not a zip file (did you
zip warning: remember to use binary mode when you transferred it?)
zip warning: (if you are trying to read a damaged archive try -F)

New development: Hello again guys, it seems like I can add files without -0 but then I get a message saying

zip warning:  file size changed while zipping ./sdcard/DCIM/Camera/20220617_211845.mp4
 (deflated 0%)

The files that did get zipped all are under 50 MB in the .zip file after being compressed. There are a total of 163 .mp4 files on my galaxy s8 and after archiving into .zip all 163 video files were compressed and compressed under 50 MB. Similar thing is happening with image files. A total of 1,349 images were added to the .zip file but alot of them received the zip warning as above. The original image file size when zipped ranges from 55.5 KiB to 8.6 MiB. Compressed size ranges from 55.2 KiB to 8.6 MiB also. So it seems to me that there is a 9 MB or 10 MB limit for images? Did anyone know about these file size limitations using find and zip together ?

update: correction, a image does not need to be over 10 MB to be compressed below 9 MB or 10 MB. I found files for which are 3.8 MB and it receives a zip warning: file size changed while zipping. So I’m assuming it is the same for video files as well they do not need to be over a certain file size limit for it to be compressed and added. I’m still not sure why for these types of files they are not being added with -0

However, when extracting those files for which the file size has changed, the video files/images or whatever it may be, the content cannot be opened/played basically rendering them useless. So the problem it seems to revolve around compression with -0 (storing files uncompressed). Any suggestions or ideas what to do about this?

I have serious doubts about your command above. I assume as
/home/azeem/Documents/fuse/sdcard/DCIM is mounted on some zipfile,
“zip -0 -r .” means do a recursive zip onto a folder, which gives the error beneath instead of saying: you cannot use a folder as zip file.

I’ve never used this fuse-zip, but I assume you can use this folder with a zip file as backend as any other file, and you do not need to use zip at all but can copy with standard tools like cp or rsync. I’ll try it.

Further: I’ve appended DAV config to a Fedora38 apache server and succesfully created some 1.5 Gbyte of music files with my patched zip from a gvfs share.
So I trust this gvfs system more which means that the source of the original problems move to the DAV server on the phone.

Edit: installed fusezip


mkdir fusezip
zip  fusetest.zip /etc/profile  #some arbitrary file to create a zip
fuse-zip fusetest.zip fusezip
cd /run/user/1000/gvfs/dav\:host\=lap1\,ssl\=false\,user\=hj\,prefix\=%2Fwebdav/
rsync -rvt * /home/hj/fusezip

fusermount -u fusezip 

It’s a funny command, but effectively you can copy all files to some location on the harddisk and create the zip afterwards, because fusezip collects the files somewhere and updates the zip upon “fusermount -u”. With the copy on a defined place on disk you can easily continue after crash with rsync.
And I do not see quickly an option to disable unnecessary compression.

Ive yet to try this on the whole folder but effectively some files which open and play on android somehow cant open and play on linux. For example there were 3 files when i was copying the DCIM/Camera folder which had no thumbnail. I used the cp -p command on a fuse filesystem folder mount. When i opened that same file within android there was nothing wrong with it. Somehow it seems copying to a fuse filesystem worked okay (there are still lots kf files which zip says file size changed) but when copying from source webdav to a local folder still changes the copied file and their size.

read the readme under the given link.

  • Developer option should be ON
  • in Developer options “USB debugging” should be on, too

with both on I get (on box named “obelix” with logged in user “ron”):

[ron@obelix ~]$ adb devices
List of devices attached
R31D90PTZQX	unauthorized

and a popup on the phone waiting to “Allow USB Debugging”

that allowed and after typing “adb shell”

jflte:/ $ 

I’m on the phone, cause command prompt has changed from “[ron@obelix ~]$” to “jflte:/ $”

Hint:
as said I’m running custom rom’s on the phone, so it might not work on stock rom.
Don’t know; can’t test here

1 Like

Okay so that worked now i am in the root folder within my android. I can see all the files in sdcard/DCIM/Camera except hidden files and folders. How can I show that using ls?

I am within the adb shell but i cant use -exec it says

find: exec zip: permission denied

ls -al

as said busybox find command and linux find command might have different options.

if I got it right: you would like to copy the content of the DCIM folder to your PC ?

adb pull might help (?!)
“adb pull” works similar as “cp a b”, no need to use find

I currently don’t know if the pull command is executed on the phone or on the pc.
for the last case you need the correct path to DCIM folder

to find it on the phone:

  • adb shell
  • and then via mount, ls -l, etc., commands

Attention:
pull copies the folder content to the pc, exactly into that directory where have been before you type adb shell. so it might be wise to create a extra folder on the pc and move into it.

you need to find out the correct option(s) [ “-r” or “-R”, etc] for the pull command to copy directories and maybe there subdirectories

I am in the adb shell but when I use a similar command like yours I get /system/bin/sh: zip: not found

find /storage/7F2E-373F/Android/ | zip archive.zip

I am in a 128 GB sandisk micro sd card