Gerardo Exequiel Pozzi
2010-Sep-13 02:26 UTC
[syslinux] isohybrid: seek error - 6: Invalid argument
Hello Recently while playing with bigger iso images (>2G) looks like isohybrid from syslinux-4.02 fails. Sometimes tunning heads/sectors (-h/-s) works, because no padding is needed depending of size of the image. Some debug info provided, if more info is needed please just ask. # isohybrid -v pandereta-2010.09.13-i686.iso catalogue offset: 326 ve[0]: 1, cs: 1 ve[1]: 0, cs: 1 ve[2]: 25927, cs: 25928 ve[3]: 24946, cs: 50874 ve[4]: 25714, cs: 76588 ve[5]: 8303, cs: 84891 ve[6]: 30789, cs: 115680 ve[7]: 29029, cs: 144709 ve[8]: 26997, cs: 171706 ve[9]: 27749, cs: 199455 ve[10]: 20512, cs: 219967 ve[11]: 31343, cs: 251310 ve[12]: 27002, cs: 278312 ve[13]: 32, cs: 278344 ve[14]: 5731, cs: 284075 ve[15]: 43605, cs: 327680 de_boot: 136 de_media: 0 de_seg: 0 de_sys: 0 de_mbz1: 0 de_count: 4 de_lba: 327 de_mbz2: 0 imgsize: 2265417728, padding: 555008 isohybrid: Warning: more than 1024 cylinders: 2161 isohybrid: Not all BIOSes will be able to boot this device id: 281396446 sizeof(MBR): 512 bytes ... 0432 1c 05 00 00 00 00 00 00 de c4 c5 10 00 00 80 00 |................| 0448 01 00 17 3f e0 ff 00 00 00 00 00 88 43 00 00 00 |...?........C...| ... isohybrid: pandereta-2010.09.13-i686.iso: seek error - 6: Invalid argument # strace -e trace=desc isohybrid pandereta-2010.09.13-i686.iso open("/etc/ld.so.cache", O_RDONLY) = 3 fstat64(3, {st_mode=S_IFREG|0644, st_size=22221, ...}) = 0 close(3) = 0 open("/lib/libc.so.6", O_RDONLY) = 3 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\320m\1\0004\0\0\0"..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0755, st_size=1347988, ...}) = 0 close(3) = 0 open("pandereta-2010.09.13-i686.iso", O_RDWR|O_LARGEFILE) = 3 fstat64(3, {st_mode=S_IFREG|0644, st_size=2265417728, ...}) = 0 _llseek(3, 32768, [32768], SEEK_SET) = 0 read(3, "\1CD001\1\0LINUX "..., 2048) = 2048 read(3, "\0CD001\1EL TORITO SPECIFICATION\0\0"..., 4096) = 4096 _llseek(3, 667648, [667648], SEEK_SET) = 0 read(3, "\1\0\0\0Gerardo Exequiel Pozzi \0c\26U\252"..., 4096) = 4096 _llseek(3, 671744, [671744], SEEK_SET) = 0 write(2, "isohybrid: ", 11isohybrid: ) = 11 write(2, "Warning: more than 1024 cylinder"..., 39Warning: more than 1024 cylinders: 2161) = 39 write(2, "\n", 1 ) = 1 write(2, "isohybrid: ", 11isohybrid: ) = 11 write(2, "Not all BIOSes will be able to b"..., 47Not all BIOSes will be able to boot this device) = 47 write(2, "\n", 1 ) = 1 _llseek(3, 0, [0], SEEK_SET) = 0 read(3, "\3721\355\216\325\274\0|\373\374f1\333f1\311fSfQ\6W\216\335\216\305R\276\0|\277\0"..., 4096) = 4096 _llseek(3, 4096, [4096], SEEK_SET) = 0 _llseek(3, -4096, [0], SEEK_CUR) = 0 write(3, "\3721\355\216\325\274\0|\373\374f1\333f1\311fSfQ\6W\216\335\216\305R\276\0|\277\0"..., 512) = 512 _llseek(3, 18446744071680000000, 0xbfff6b50, SEEK_SET) = -1 EINVAL (Invalid argument) write(2, "isohybrid: ", 11isohybrid: ) = 11 write(2, "pandereta-2010.09.13-i686.iso: s"..., 45pandereta-2010.09.13-i686.iso: seek error - 6) = 45 write(2, ": ", 2: ) = 2 write(2, "Invalid argument\n", 17Invalid argument ) = 17 -- Gerardo Exequiel Pozzi \cos^2\alpha + \sin^2\alpha = 1
Hello Gerardo, --- On Mon, 13/9/10, Gerardo Exequiel Pozzi <vmlinuz386 at yahoo.com.ar>> Recently while playing with bigger iso images (>2G) > looks like isohybrid from syslinux-4.02 fails. Sometimes > tunning heads/sectors (-h/-s) works, because no padding is > needed depending of size of the image. > > isohybrid: pandereta-2010.09.13-i686.iso: seek error - 6: > Invalid argumentThanks for the update. The error seems to come while seeking(fseek(3)) to fix the file pointer at the end of the file, just before adding required padding to the iso. --- if (fseek(fp, isostat.st_size, SEEK_SET)) err(1, "%s: seek error - 6", argv[0]); memset(buf, 0, padding); if (fwrite(buf, sizeof(char), padding, fp) != (size_t)padding) err(1, "%s: write error - 2", argv[0]); --- Strange, that it should happen. I guess, may be, HPA could be better able to explain why it should happen for 2G files. Can I have the iso file? Thank you. --- Regards -Prasad PS: Please don't send me html/attachment/Fwd mails
H. Peter Anvin
2010-Sep-13 06:39 UTC
[syslinux] isohybrid: seek error - 6: Invalid argument
Most likely it was compiled without -D_FILE_OFFSET_BITS=64. -hpa On 09/12/2010 10:25 PM, P J P wrote:> Hello Gerardo, > > --- On Mon, 13/9/10, Gerardo Exequiel Pozzi<vmlinuz386 at yahoo.com.ar> >> Recently while playing with bigger iso images (>2G) >> looks like isohybrid from syslinux-4.02 fails. Sometimes >> tunning heads/sectors (-h/-s) works, because no padding is >> needed depending of size of the image. >> >> isohybrid: pandereta-2010.09.13-i686.iso: seek error - 6: >> Invalid argument > > Thanks for the update. The error seems to come while seeking(fseek(3)) to fix the file pointer at the end of the file, just before adding required padding to the iso. > > --- > if (fseek(fp, isostat.st_size, SEEK_SET)) > err(1, "%s: seek error - 6", argv[0]); > > memset(buf, 0, padding); > if (fwrite(buf, sizeof(char), padding, fp) != (size_t)padding) > err(1, "%s: write error - 2", argv[0]); > --- > > Strange, that it should happen. I guess, may be, HPA could be better able to explain why it should happen for 2G files. > > Can I have the iso file? > > Thank you. > --- > Regards > -Prasad > PS: Please don't send me html/attachment/Fwd mails > > >
H. Peter Anvin
2010-Sep-13 06:40 UTC
[syslinux] isohybrid: seek error - 6: Invalid argument
By the way, using seek + write for this is pretty broken. A much better option is to use ftruncate(). -hpa On 09/12/2010 10:25 PM, P J P wrote:> Hello Gerardo, > > --- On Mon, 13/9/10, Gerardo Exequiel Pozzi<vmlinuz386 at yahoo.com.ar> >> Recently while playing with bigger iso images (>2G) >> looks like isohybrid from syslinux-4.02 fails. Sometimes >> tunning heads/sectors (-h/-s) works, because no padding is >> needed depending of size of the image. >> >> isohybrid: pandereta-2010.09.13-i686.iso: seek error - 6: >> Invalid argument > > Thanks for the update. The error seems to come while seeking(fseek(3)) to fix the file pointer at the end of the file, just before adding required padding to the iso. > > --- > if (fseek(fp, isostat.st_size, SEEK_SET)) > err(1, "%s: seek error - 6", argv[0]); > > memset(buf, 0, padding); > if (fwrite(buf, sizeof(char), padding, fp) != (size_t)padding) > err(1, "%s: write error - 2", argv[0]); > --- > > Strange, that it should happen. I guess, may be, HPA could be better able to explain why it should happen for 2G files. > > Can I have the iso file? > > Thank you. > --- > Regards > -Prasad > PS: Please don't send me html/attachment/Fwd mails > > >
???Hi, Bellow is a patch to replace fseek-memset-fwrite padding sequence with a more clean and simple truncate(3) call. == diff --git a/utils/isohybrid.c b/utils/isohybrid.c index 57c1015..fbff06f 100644 --- a/utils/isohybrid.c +++ b/utils/isohybrid.c @@ -541,21 +541,11 @@ main(int argc, char *argv[]) ? ???if (fwrite(buf, sizeof(char), i, fp) != (size_t)i) ? ? ? ???err(1, "%s: write error - 1", argv[0]); -? ? if (padding) -? ? { -? ? ? ? if (!(buf = realloc(buf, padding))) -? ? ? ? ? ? err(1, "%s: could not re-size buffer", argv[0]); - -? ? ? ? if (fseek(fp, isostat.st_size, SEEK_SET)) -? ? ? ? ? ? err(1, "%s: seek error - 6", argv[0]); - -? ? ? ? memset(buf, 0, padding); -? ? ? ? if (fwrite(buf, sizeof(char), padding, fp) != (size_t)padding) -? ? ? ? ? ? err(1, "%s: write error - 2", argv[0]); -? ? } - ? ???free(buf); ? ???fclose(fp); +? ? if (padding && truncate(argv[0], padding)) +? ? ? ? err(1, "%s: could not add padding bytes", argv[0]); + == Thank you. --- Regards ? ? -Prasad PS: Please don't send me html/attachment/Fwd mails
H. Peter Anvin
2010-Sep-14 18:49 UTC
[syslinux] isohybrid: seek error - 6: Invalid argument
On 09/13/2010 02:29 AM, Thomas Schmitt wrote:> Hi, > >> -D_FILE_OFFSET_BITS=64 >>> if (fseek(fp, isostat.st_size, SEEK_SET)) > > fseek(3) expects type long for the address parameter. > int fseek(FILE *stream, long offset, int whence); > > The _FILE_OFFSET_BITS=64 macro has an effect on type off_t. > > So you will either have to use fseeko(3) (and eventually ftello(3)) > > int fseeko(FILE *stream, off_t offset, int whence); > > or you have to define macro > _LARGEFILE_SOURCE > which makes fseek/ftell aliases of fseeko/ftello. >Ah yes... there is that braindamage. -hpa
Possibly Parallel Threads
- Announcing a patch series for isohybrid.c
- isolinux: Generate GPT and Mac bootable images
- [5.11-pre1] SYSAPPEND does not work (IPAPPEND alias works)
- [5.11-pre1] SYSAPPEND does not work (IPAPPEND alias works)
- [5.11-pre1] SYSAPPEND does not work (IPAPPEND alias works)