LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (https://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   Why using find and zip gives zip I/O error? (https://www.linuxquestions.org/questions/linux-desktop-74/why-using-find-and-zip-gives-zip-i-o-error-4175725381/)

anmac1789 05-24-2023 07:37 PM

Why using find and zip gives zip I/O error?
 
1 Attachment(s)
Hello, I am using a webdav server pro from the olive tree to mount my galaxy s8's internal storage. When I try to zip a folder using this command
Code:

find ."/sdcard/DCIM/Camera" -exec zip -0 -r "/home/ubuntu/Documents/test.zip" {} +
I receive an error saying

zip I/O error: Bad address
zip error: Output file write failure (write error on zip file)

please see the attachment

Why?

pan64 05-25-2023 12:20 AM

I guess it is a disk full or something similar. Or probably a permission issue.

lvm_ 05-25-2023 12:31 AM

This could be caused by insufficient space on /tmp, try issuing 'export TMPDIR=<directory with lots of space>' before running this command or use tar since you are storing anyway.

anmac1789 05-25-2023 12:42 AM

how do I change permission or change the storage space of /tmp ? is this done in terminal ?

TB0ne 05-25-2023 08:11 AM

Quote:

Originally Posted by anmac1789 (Post 6432711)
Hello, I am using a webdav server pro from the olive tree to mount my galaxy s8's internal storage. When I try to zip a folder using this command
Code:

find ."/sdcard/DCIM/Camera" -exec zip -0 -r "/home/ubuntu/Documents/test.zip" {} +
I receive an error saying

zip I/O error: Bad address
zip error: Output file write failure (write error on zip file)

please see the attachment Why?

Could also be that the device is mounted read-only, or a permissions issue (as noted by others). But I'd also examine the command-line you're using...the find command is only going to find you a folder called Camera...and if you know you want to zip EVERYTHING from that folder, why bother with a find (since you know the location)? Why not just type in
Code:

zip -r /home/ubuntu/Documents/test.zip /sdcard/DCIM/Camera/*

anmac1789 05-25-2023 08:43 AM

Quote:

Originally Posted by TB0ne (Post 6432816)
Could also be that the device is mounted read-only, or a permissions issue (as noted by others). But I'd also examine the command-line you're using...the find command is only going to find you a folder called Camera...and if you know you want to zip EVERYTHING from that folder, why bother with a find (since you know the location)? Why not just type in
Code:

zip -r /home/ubuntu/Documents/test.zip /sdcard/DCIM/Camera/*

Using zip also fails and gives me the same error hence this os why i want to know why it fails — for both find and zip
I can copy files to and from the android device when its mounted as a network webdav share because i already tested it with a small sample file. How can i change the permissions and for which file or folder specifically ? os it a global permissions issue on a vm ?

anmac1789 05-25-2023 09:31 AM

1 Attachment(s)
Quote:

Originally Posted by TB0ne (Post 6432816)
Could also be that the device is mounted read-only, or a permissions issue (as noted by others). But I'd also examine the command-line you're using...the find command is only going to find you a folder called Camera...and if you know you want to zip EVERYTHING from that folder, why bother with a find (since you know the location)? Why not just type in
Code:

zip -r /home/ubuntu/Documents/test.zip /sdcard/DCIM/Camera/*

I try to see how much the temporary folder is being used using this command
Code:

df -h /tmp
please see the attachment

pan64 05-25-2023 10:18 AM

you ought to run that df when the error occurred, which is impossible. You might try strace -o /tmp/strace.out -f zip .....
and check /tmp/strace.out to see what call caused that i/o error.

anmac1789 05-25-2023 12:25 PM

2 Attachment(s)
Quote:

Originally Posted by pan64 (Post 6432850)
you ought to run that df when the error occurred, which is impossible. You might try strace -o /tmp/strace.out -f zip .....
and check /tmp/strace.out to see what call caused that i/o error.

Here is the log


13477 execve("/usr/bin/zip", ["zip"], 0x7fff7709c8a8 /* 47 vars */) = 0
13477 brk(NULL) = 0x557535810000
13477 arch_prctl(0x3001 /* ARCH_??? */, 0x7fff4e0e0a20) = -1 EINVAL (Invalid argument)
13477 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd966b3c000
13477 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
13477 openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
13477 newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=61257, ...}, AT_EMPTY_PATH) = 0
13477 mmap(NULL, 61257, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fd966af2000
13477 close(3) = 0
13477 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libbz2.so.1.0", O_RDONLY|O_CLOEXEC) = 3
13477 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\0\0\0\0\0\0\0"..., 832) = 832
13477 newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=74848, ...}, AT_EMPTY_PATH) = 0
13477 mmap(NULL, 76840, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fd966ada000
13477 mmap(0x7fd966adc000, 53248, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7fd966adc000
13477 mmap(0x7fd966ae9000, 8192, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xf000) = 0x7fd966ae9000
13477 mmap(0x7fd966aeb000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x10000) = 0x7fd966aeb000
13477 close(3) = 0
13477 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
13477 read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P<\2\0\0\0\0\0"..., 832) = 832
13477 pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784
13477 newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=2072888, ...}, AT_EMPTY_PATH) = 0
13477 pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784
13477 mmap(NULL, 2117488, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fd966800000
13477 mmap(0x7fd966822000, 1540096, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x22000) = 0x7fd966822000
13477 mmap(0x7fd96699a000, 360448, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x19a000) = 0x7fd96699a000
13477 mmap(0x7fd9669f2000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1f1000) = 0x7fd9669f2000
13477 mmap(0x7fd9669f8000, 53104, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fd9669f8000
13477 close(3) = 0
13477 mmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd966b39000
13477 arch_prctl(ARCH_SET_FS, 0x7fd966b39740) = 0
13477 set_tid_address(0x7fd966b39a10) = 13477
13477 set_robust_list(0x7fd966b39a20, 24) = 0
13477 rseq(0x7fd966b3a060, 0x20, 0, 0x53053053) = 0
13477 mprotect(0x7fd9669f2000, 16384, PROT_READ) = 0
13477 mprotect(0x7fd966aeb000, 4096, PROT_READ) = 0
13477 mprotect(0x5575355f3000, 12288, PROT_READ) = 0
13477 mprotect(0x7fd966b35000, 8192, PROT_READ) = 0
13477 prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
13477 munmap(0x7fd966af2000, 61257) = 0
13477 getrandom("\x4f\xb1\x64\x17\x11\xda\x17\x08", 8, GRND_NONBLOCK) = 8
13477 brk(NULL) = 0x557535810000
13477 brk(0x557535831000) = 0x557535831000
13477 openat(AT_FDCWD, "/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
13477 newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=14588416, ...}, AT_EMPTY_PATH) = 0
13477 mmap(NULL, 14588416, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fd965a00000
13477 close(3) = 0
13477 openat(AT_FDCWD, "/etc/localtime", O_RDONLY|O_CLOEXEC) = 3
13477 newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=3494, ...}, AT_EMPTY_PATH) = 0
13477 newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=3494, ...}, AT_EMPTY_PATH) = 0
13477 read(3, "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5\0\0\0\5\0\0\0\0"..., 4096) = 3494
13477 lseek(3, -2225, SEEK_CUR) = 1269
13477 read(3, "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5\0\0\0\5\0\0\0\0"..., 4096) = 2225
13477 close(3) = 0
13477 ioctl(1, TCGETS, {c_iflag=ICRNL|IXON|IUTF8, c_oflag=NL0|CR0|TAB0|BS0|VT0|FF0|OPOST|ONLCR, c_cflag=B38400|CS8|CREAD, c_lflag=ISIG|ICANON|ECHO|ECHOE|ECHOK|IEXTEN|ECHOCTL|ECHOKE, ...}) = 0
13477 newfstatat(1, "", {st_mode=S_IFCHR|0620, st_rdev=makedev(0x88, 0), ...}, AT_EMPTY_PATH) = 0
13477 write(1, "Copyright (c) 1990-2008 Info-ZIP"..., 73) = 73
13477 write(1, "Zip 3.0 (July 5th 2008). Usage:\n", 32) = 32
13477 write(1, "zip [-options] [-b path] [-t mmd"..., 79) = 79
13477 write(1, " The default action is to add o"..., 75) = 75
13477 write(1, " can include the special name -"..., 61) = 61
13477 write(1, " If zipfile and list are omitte"..., 67) = 67
13477 write(1, " -f freshen: only changed fil"..., 75) = 75
13477 write(1, " -d delete entries in zipfile"..., 77) = 77
13477 write(1, " -r recurse into directories "..., 77) = 77
13477 write(1, " -0 store only "..., 79) = 79
13477 write(1, " -1 compress faster "..., 57) = 57
13477 write(1, " -q quiet operation "..., 78) = 78
13477 write(1, " -c add one-line comments "..., 61) = 61
13477 write(1, " -@ read names from stdin "..., 77) = 77
13477 write(1, " -x exclude the following nam"..., 74) = 74
13477 write(1, " -F fix zipfile (-FF try hard"..., 70) = 70
13477 write(1, " -A adjust self-extracting ex"..., 72) = 72
13477 write(1, " -T test zipfile integrity "..., 71) = 71
13477 write(1, " -y store symbolic links as t"..., 71) = 71
13477 write(1, " -e encrypt "..., 71) = 71
13477 write(1, " -h2 show more help\n", 22) = 22
13477 write(1, " \n", 3) = 3
13477 exit_group(0) = ?
13477 +++ exited with 0 +++


please see the attachment. Even when using -type d switch, find still tried zipping a file instead of just the folder. Something seems broken. I've also added myself to the vboxsf users group. I'm not sure what the 992 means. Is there a higher level of permissions than 992 ?

df -h /tmp gives me:
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 99G 34G 61G 36% /

since I've increased virtualbox total hdd space from 50 GB to 100 GB

pan64 05-25-2023 11:49 PM

I can't find any error in that strace log.

anmac1789 05-26-2023 12:49 AM

Quote:

Originally Posted by pan64 (Post 6432960)
I can't find any error in that strace log.

Can you try from your end using your virtual machine and see if it works for you. I know there is something wrong but I dont have deep knowledge about linux. How can I diagnose when and where this error is occuring and how do I properly use strace for this instance? Maybe instead of a virtualisation it needs a proper linux install on a seperate hard drive to use the find command? Funny thing is, I installed linux mint on vmware and tried the same thing, I am still getting the same type of error

pan64 05-26-2023 01:28 AM

No, I can't reproduce it. But you need to execute the full command, like this:
Code:

strace -o /tmp/strace.out -f zip -r /home/ubuntu/Documents/test.zip /sdcard/DCIM/Camera/*
                            ============================================================  << this is the original zip command

And you need to check the file strace.out, and look for i/o error inside. Do not post the full file here, that will be huge.

anmac1789 05-26-2023 02:10 AM

Quote:

Originally Posted by pan64 (Post 6432969)
No, I can't reproduce it. But you need to execute the full command, like this:
Code:

strace -o /tmp/strace.out -f zip -r /home/ubuntu/Documents/test.zip /sdcard/DCIM/Camera/*
                            ============================================================  << this is the original zip command

And you need to check the file strace.out, and look for i/o error inside. Do not post the full file here, that will be huge.

Are you saying that you don't get any error or that you don't want to try it ? lol..

pan64 05-26-2023 02:17 AM

To be able to reproduce it I need to recreate your environment, and 1. I don't know it, 2. I have no virtualbox.
But anyway, it is quite obvious something is incorrect in your setup and I have no any chance to [re]produce the same situation without knowing it.

anmac1789 05-26-2023 02:35 AM

Quote:

Originally Posted by pan64 (Post 6432973)
To be able to reproduce it I need to recreate your environment, and 1. I don't know it, 2. I have no virtualbox.
But anyway, it is quite obvious something is incorrect in your setup and I have no any chance to [re]produce the same situation without knowing it.

Well for one thing, if you'd like to know my setup is done with ubuntu 23.04 on virtualbox with basic settings and using webdav server (https://play.google.com/store/apps/d...hl=en_US&gl=US) and then setting the home directory on the app to the root. Then on ubuntu vm --> other locations and using the ip address that's displayed on the app to set up a webdav connection. For me on the app it says

WebDAV server available on:
http://10.0.0.132:8080

Home directory: /
Password disabled

on ubuntu I connected the android phone with dav://10.0.0.132:8080 and opened the root folder with "open in terminal"

Another possibility is if you'd like to set up a microsoft teams meeting with me and see it that way which is alot faster.

Btw, which working directory am I supposed to be in to execute this command

strace -o /tmp/strace.out -f zip -r -0 /home/azeem/Documents/example.zip /sdcard/DCIM/Camera/*

Maybe this will help:

Code:

"b\224\202)\216\304z\34\240/\261\323\244ye\17\31\201\277]\221\206\244U\19k>Y\332\271\316"..., 16384) = 16384
5539  write(3, "\n\376\376\265\262P,5\1\226\243\266\211\263\236\246\216\315\321\307\215G\343\307\353c;M\312:-\210"..., 16384) = 16384
5539  read(4, "\341\235V\5aFi\332\256\356\245R\231DM\351hI\20\31\4\r\334\357\213\323\207\241\315\224M8"..., 16384) = 16384
5539  write(3, "\210\21\216\345\335\31\266\355\3e\4L6\26q%\2179\225\232\22\220<\262\330\323\264\241M4\34\205"..., 16384) = 16384
5539  read(4, "qJ\353\204\231\362Dp!\234\221S\357\21y\2235S\2012m\336\367\276us\334\2218(\6\270"..., 16384) = 16384
5539  write(3, "\310\263\215\303\340P\247\242\313)bX\335\324\2\23[\0230\t\301UOG\32\346CG\0\204\3K"..., 16384) = 16384
5539  read(4, "\0\0\0\30ftypmp42\0\0\0\0isommp42\1\257P<mdat"..., 16384) = 16384
5539  write(3, "\337\307\222@\310\f\252\224:)\21\233\343l\327\206w$\323\355I\35\t!l\6\260\267\331\257 \374"..., 16384) = 16384
5539  read(4, 0x556c57299e80, 16384)    = -1 EIO (Input/output error)
5539  write(3, "J\266\352Nm\264+;)\261\331+\266%M\205D\323eS#\304\6\0015\370.i}a\275\210"..., 16384) = 16384
5539  write(3, "J\266\352Nm\264+;)\261\331+\266%M\205D\323eS#\304\6\0015\370.i}a\275\210"..., 4294950912) = 66009
5539  write(3, 0x556c572ae000, 4294884903) = -1 EFAULT (Bad address)
5539  write(1, "\n", 1)                = 1
5539  write(1, "zip I/O error: Bad address", 26) = 26
5539  write(1, "\nzip error: Output file write fa"..., 64) = 64
5539  close(3)                          = 0
5539  unlink("/home/azeem/Documents/zietQlV3") = 0
5539  exit_group(14)                    = ?
5539  +++ exited with 14 +++

I am attaching a google drive link to the strace file https://drive.google.com/file/d/1VAH...ew?usp=sharing


All times are GMT -5. The time now is 12:23 AM.