Sebastian, On 01/15/2015 12:49 AM, Sebastian Herbszt wrote:> which version of pxelinux were you trying? Looks like < 5.x.the one from Fedora 20, syslinux-4.05. It turns out that pxelinux.0 from Fedora 21, syslinux-6.03, reports "Failed to load ldlinux.c32" when ldlinux.c32 can't be read, and "Loading <FILE>... failed: No such file or directory" when the TFTP server replies with "Permission denied" for the kernel or initrd. So this problem has slightly changed, but it hasn't been fixed. Thanks, Andreas
> Sebastian, > > On 01/15/2015 12:49 AM, Sebastian Herbszt wrote: > > which version of pxelinux were you trying? Looks like < 5.x. > > the one from Fedora 20, syslinux-4.05. > > It turns out that pxelinux.0 from Fedora 21, syslinux-6.03, reports > "Failed to load ldlinux.c32" when ldlinux.c32 can't be read, and > "Loading <FILE>... failed: No such file or directory" when the TFTP > server replies with "Permission denied" for the kernel or initrd. So > this problem has slightly changed, but it hasn't been fixed. > > Thanks, > Andreas > _______________________________________________ > Syslinux mailing list > Submissions to Syslinux at zytor.com > Unsubscribe or set options at: > http://www.zytor.com/mailman/listinfo/syslinux >About the "Permission denied" message, if read-permissions are not allowed for the kernel/initrd, then what else can Syslinux do? This message, as of version 6.03, seems to correspond to the real situation. About the "failed to load" message... What exactly do you mean with "when ldlinux.c32 can't be read"? The "failed to load ldlinux.c32" message is usually triggered when ldlinux.c32 is not located in the expected location (together with (l)pxelinux.0, or with the other Syslinux BIOS bootloaders). So, if ldlinux.c32 is adequately present and yet it cannot be read, what's the reason? Isn't it possible that some Syslinux-related package (or something else) in Fedora is over-complicating this matter? IIRC, older Syslinux versions didn't care about file attributes/permissions of the bootloader files. If this is still valid/correct/adequate for Syslinux 6.03, then it shouldn't care about the respective attributes/permissions of the core module (ldlinux.{c32,e32,e64}) either. Perhaps I am misremembering, and/or perhaps this logic is inadequate/incorrect? Regards, Ady.
Hello Andreas, Andreas Gruenbacher wrote:> Sebastian, > > On 01/15/2015 12:49 AM, Sebastian Herbszt wrote: > > which version of pxelinux were you trying? Looks like < 5.x. > > the one from Fedora 20, syslinux-4.05. > > It turns out that pxelinux.0 from Fedora 21, syslinux-6.03, reports > "Failed to load ldlinux.c32" when ldlinux.c32 can't be read, andLDLINUX is special: core/elflink/load_env32.c 170:out: 171: writestr("\nFailed to load "); 172: writestr(LDLINUX);> "Loading <FILE>... failed: No such file or directory" when the TFTP > server replies with "Permission denied" for the kernel or initrd.open() returns ENOENT for all errors: com32/lib/sys/open.c 68: handle = open_file(pathname, flags, &fp->i.fd); 69: if (handle < 0) { 70: close(fd); 71: errno = ENOENT;> So this problem has slightly changed, but it hasn't been fixed.The (almost untested) patch below should fix this. Sebastian diff --git a/com32/lib/sys/open.c b/com32/lib/sys/open.c index 1ed5bb4..8858f07 100644 --- a/com32/lib/sys/open.c +++ b/com32/lib/sys/open.c @@ -65,10 +65,12 @@ int open(const char *pathname, int flags, ...) fp = &__file_info[fd]; + errno = 0; handle = open_file(pathname, flags, &fp->i.fd); if (handle < 0) { close(fd); - errno = ENOENT; + if (!errno) + errno = ENOENT; return -1; } diff --git a/core/fs/pxe/tftp.c b/core/fs/pxe/tftp.c index 446da63..c89d3bf 100644 --- a/core/fs/pxe/tftp.c +++ b/core/fs/pxe/tftp.c @@ -205,6 +205,7 @@ void tftp_open(struct url_info *url, int flags, struct inode *inode, uint64_t opdata; uint16_t src_port; uint32_t src_ip; + uint16_t error_code; (void)redir; /* TFTP does not redirect */ (void)flags; @@ -280,6 +281,16 @@ wait_pkt: switch (opcode) { case TFTP_ERROR: inode->size = 0; + error_code = *(uint16_t *)(reply_packet_buf + 2); + switch (ntohs(error_code)) { + case 1: /* File not found. */ + errno = ENOENT; + break; + + case 2: /* Access violation. */ + errno = EACCES; + break; + } goto done; /* ERROR reply; don't try again */ case TFTP_DATA:
Hi, On 01/16/2015 12:19 AM, Sebastian Herbszt wrote:> Andreas Gruenbacher wrote: >> "Loading <FILE>... failed: No such file or directory" when the TFTP >> server replies with "Permission denied" for the kernel or initrd. > [...] > > The (almost untested) patch below should fix this.hmm, probably close but I still get the same "No such file or directory" error message. Also, should error codes other than 1 (File not found) and 2 (Access violation) not be mapped to something like EIO and not ENOENT? Thanks, Andreas