NetBSD Problem Report #52247

From www@NetBSD.org  Sat May 20 01:23:38 2017
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 528007A209
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 20 May 2017 01:23:38 +0000 (UTC)
Message-Id: <20170520012336.E7DED7A295@mollari.NetBSD.org>
Date: Sat, 20 May 2017 01:23:36 +0000 (UTC)
From: n54@gmx.com
Reply-To: n54@gmx.com
To: gnats-bugs@NetBSD.org
Subject: Problem with running NetBSD/i386 1.0 programs on NetBSD/amd64 7.99.72
X-Send-Pr-Version: www-1.0

>Number:         52247
>Category:       kern
>Synopsis:       Problem with running NetBSD/i386 1.0 programs on NetBSD/amd64 7.99.72
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat May 20 01:25:00 +0000 2017
>Last-Modified:  Mon May 22 01:35:00 +0000 2017
>Originator:     Kamil Rytarowski
>Release:        NetBSD 7.99.72 amd64
>Organization:
TNF
>Environment:
NetBSD compaq 7.99.72 NetBSD 7.99.72 (GENERIC) #31: Fri May 19 18:58:50 CEST 2017  root@chieftec:/public/netbsd-root/sys/arch/amd64/compile/GENERIC amd64
>Description:
I'm attempting to run dynamic executables a.out format files from NetBSD/i386 1.0 on recent NetBSD/amd64.

My goal is to use through netbsd32 compat layer gcc/gas/gnuld/etc from NetBSD 1.0. (I need it to bootstrap easily old project from NetBSD 0.9 attempting to run a.out toolchain).

I downloaded NetBSD 1.0 sets, unpacked to /emul/netbsd32, copied libraries (usr/lib) to /emul/aout/usr/lib (and a copy to /emul/aout, /emul/aout/lib...).

I failed so far to convince dynamic linker to find appropriate libraries:

$ /emul/netbsd32/usr/bin/machine
ld.so: machine: libc.so.12.0: No such file or directory

I tried to run /emul/netbsd32/sbin/ldconfig but it does not help afterwards.

ktruss from ldconfig:
$ ktruss /emul/netbsd32/sbin/ldconfig 
 14395      1 ktruss   fcntl(0x4, 0x3, 0)          = 4194305
 14395      1 ktruss   emul(netbsd)
 14395      1 ktruss   fcntl(0x4, 0x4, 0x400001)   = 0
 14395      1 ldconfig execve("/emul/netbsd32/sbin/ldconfig", 0x7f7fff24afc0, 0x7f7fff24afd0) JUSTRETURN
 14395      1 ldconfig emul(netbsd32)
 14395      1 ldconfig netbsd32___sysctl(0xffffffffffffeca8, 0x2, 0xffffffffffffecb4, 0xffffffffffffecb0, 0, 0) = 0
 14395      1 ldconfig netbsd32_break(0xce34)      = 0
 14395      1 ldconfig netbsd32_break(0xcffc)      = 0
 14395      1 ldconfig netbsd32_break(0xdffc)      = 0
 14395      1 ldconfig netbsd32_break(0xeffc)      = 0
 14395      1 ldconfig netbsd32_break(0xfffc)      = 0
 14395      1 ldconfig netbsd32_open("/emul/netbsd32/usr/lib", 0, 0) = 3
 14395      1 ldconfig compat_12_netbsd32_fstat12(0x3, 0xffffffffffffe458) = 0
 14395      1 ldconfig netbsd32_fcntl(0x3, 0x2, 0x1) = 0
 14395      1 ldconfig netbsd32_break(0x11ffc)     = 0
 14395      1 ldconfig compat_12_netbsd32_getdirentries(0x3, 0x10000, 0x1000, 0xf034) = 1644
 14395      1 ldconfig netbsd32_break(0x12ffc)     = 0
 14395      1 ldconfig compat_12_netbsd32_getdirentries(0x3, 0x10000, 0x1000, 0xf034) = 0
 14395      1 ldconfig netbsd32_open("/emul/netbsd32/usr/X386/lib", 0, 0x1) Err#2 ENOENT
 14395      1 ldconfig netbsd32_break(0x13ffc)     = 0
 14395      1 ldconfig netbsd32_open("/emul/netbsd32/var/run/ld.so.hints+", 0x602, 0x124) = 4
 14395      1 ldconfig netbsd32_write(0x4, 0xffffffffffffece4, 0x1c) = 28
       "iHDL\^A\0\0\0\^\\0\0\0\^O\0\0\0\M-l\^B\0\0\^Y\^B\0\0\^E\^E\0\0"
 14395      1 ldconfig netbsd32_write(0x4, 0x13000, 0x2d0) = 720
       "\M^U\0\0\0\M^Z\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\^A\0\0\0\M-X\0\0\0\M-]\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
 14395      1 ldconfig netbsd32_write(0x4, 0x13400, 0x219) = 537
       "curses\0/usr/lib/libcurses.so.2.1.a\M^V\M^@9!a\0c\0/usr/lib/libc.so.12.0.2.1:!a\0crypt\0/usr/lib/libcrypt.so.0.01>!a\0gnumalloc\0/usr/lib/libgnumalloc.so.0.0\M^@<!a\0edit\0/usr/li"
 14395      1 ldconfig netbsd32_close(0x4)         = 0
 14395      1 ldconfig netbsd32_unlink("/emul/netbsd32/var/run/ld.so.hints") = 0
 14395      1 ldconfig netbsd32_rename("/emul/netbsd32/var/run/ld.so.hints+", "/emul/netbsd32/var/run/ld.so.hints") = 0
 14395      1 ldconfig netbsd32_exit(0xffffffffffffffff)

.....

After struggling I managed to start "machine" with renaming libc: cp -- libc.so.12.0 libc.so.12.0.2.1:!a

I noted that resolution of file/dir names is slightly broken in these binaries.

Example:

compaq$ sudo chroot /emul/netbsd32/ /bin/sh                                                                                                                                                  
# ls
..&#65533;     .m      altroot&#65533;binr    devn    etcn    homeo   mntn    rootd   sbino   stando  sys&#65533;    tmpt    usr&#65533;    var


I think there are few problems:
 - filename/dirname resolution with trailing trash
 - a.out libraries shall be in /emul/aout not /emul/netbsd32 according to the documentation
>How-To-Repeat:
1. Fetch NetBSD 1.0 sets.
2. Untarball them to /emul/netbsd32
3. Copy libraries to /emul/aout
4. Try to run /emul/netbsd/usr/bin/ programs
>Fix:
N/A

>Audit-Trail:
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/52247: Problem with running NetBSD/i386 1.0 programs on
 NetBSD/amd64 7.99.72
Date: Sat, 20 May 2017 12:17:58 +0200

 On Sat, May 20, 2017 at 01:25:00AM +0000, n54@gmx.com wrote:
 > 3. Copy libraries to /emul/aout

 Wouldn't that be for 64bit a.out binaries (which never existed for amd64)?

 Martin

From: christos@zoulas.com (Christos Zoulas)
To: gnats-bugs@NetBSD.org, kern-bug-people@netbsd.org, 
	gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, n54@gmx.com
Cc: 
Subject: Re: kern/52247: Problem with running NetBSD/i386 1.0 programs on NetBSD/amd64 7.99.72
Date: Sat, 20 May 2017 09:35:54 -0400

 On May 20, 10:20am, martin@duskware.de (Martin Husemann) wrote:
 -- Subject: Re: kern/52247: Problem with running NetBSD/i386 1.0 programs on 

 | The following reply was made to PR kern/52247; it has been noted by GNATS.
 | 
 | From: Martin Husemann <martin@duskware.de>
 | To: gnats-bugs@NetBSD.org
 | Cc: 
 | Subject: Re: kern/52247: Problem with running NetBSD/i386 1.0 programs on
 |  NetBSD/amd64 7.99.72
 | Date: Sat, 20 May 2017 12:17:58 +0200
 | 
 |  On Sat, May 20, 2017 at 01:25:00AM +0000, n54@gmx.com wrote:
 |  > 3. Copy libraries to /emul/aout
 |  
 |  Wouldn't that be for 64bit a.out binaries (which never existed for amd64)?

 No these are i386 a.out binaries. I had fixed them but I guess they broke
 again (the emulation that is).

 christos

From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/52247: Problem with running NetBSD/i386 1.0 programs on
 NetBSD/amd64 7.99.72
Date: Sun, 21 May 2017 11:21:22 +0200

 On Sat, May 20, 2017 at 01:40:00PM +0000, Christos Zoulas wrote:
 >  No these are i386 a.out binaries. I had fixed them but I guess they broke
 >  again (the emulation that is).

 Yes, but I think kamil is misreading the man page vs. the /emul path.

 Martin

From: Kamil Rytarowski <n54@gmx.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/52247: Problem with running NetBSD/i386 1.0 programs on
 NetBSD/amd64 7.99.72
Date: Mon, 22 May 2017 03:34:46 +0200

 This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
 --fvBKI0PmTJRNxsM8UJWvmIOkffSNpjsr8
 Content-Type: multipart/mixed; boundary="IFlN2GnBNqDBjIlAiAKEemlbTRslkkT4T";
  protected-headers="v1"
 From: Kamil Rytarowski <n54@gmx.com>
 To: gnats-bugs@NetBSD.org
 Message-ID: <ea6c90ef-88f1-e5be-a6e6-547deb7a0917@gmx.com>
 Subject: Re: kern/52247: Problem with running NetBSD/i386 1.0 programs on
  NetBSD/amd64 7.99.72
 References: <pr-kern-52247@gnats.netbsd.org>
  <20170520012336.E7DED7A295@mollari.NetBSD.org>
  <20170521092501.236587A2AE@mollari.NetBSD.org>
 In-Reply-To: <20170521092501.236587A2AE@mollari.NetBSD.org>

 --IFlN2GnBNqDBjIlAiAKEemlbTRslkkT4T
 Content-Type: text/plain; charset=windows-1252
 Content-Transfer-Encoding: quoted-printable

 On 21.05.2017 11:25, Martin Husemann wrote:
 > The following reply was made to PR kern/52247; it has been noted by GNA=
 TS.
 >=20
 > From: Martin Husemann <martin@duskware.de>
 > To: gnats-bugs@NetBSD.org
 > Cc:=20
 > Subject: Re: kern/52247: Problem with running NetBSD/i386 1.0 programs =
 on
 >  NetBSD/amd64 7.99.72
 > Date: Sun, 21 May 2017 11:21:22 +0200
 >=20
 >  On Sat, May 20, 2017 at 01:40:00PM +0000, Christos Zoulas wrote:
 >  >  No these are i386 a.out binaries. I had fixed them but I guess they=
  broke
 >  >  again (the emulation that is).
 > =20
 >  Yes, but I think kamil is misreading the man page vs. the /emul path.
 > =20
 >  Martin
 > =20
 >=20

 Regardless of the location of headers, there are problems with filename
 resolution (?) as noted in the report.


 --IFlN2GnBNqDBjIlAiAKEemlbTRslkkT4T--

 --fvBKI0PmTJRNxsM8UJWvmIOkffSNpjsr8
 Content-Type: application/pgp-signature; name="signature.asc"
 Content-Description: OpenPGP digital signature
 Content-Disposition: attachment; filename="signature.asc"

 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2

 iQIcBAEBCAAGBQJZIkA8AAoJEEuzCOmwLnZse9UP/2Tr0L8zH7FIyUApDULT98tn
 W0LS3DnuwxzOtypJ88H/LzlpzRthRWS2+2ywHvEVQYwzRtswxueXJU0InzVYCARg
 rwyYKIVc+7I1jLFI9Takq/PBBjSOUPe3sWWJvX2OcorxN0NrVwyUDgbY37JwL7Aq
 FHzYSdn3yCNlkGJM76gMsFZh5TVT2SR6Q+OtQ9j+fSt0o/3J9bEM9drwUhQbixMR
 wtdpRdTINLwQ1vu/U/o9fPXQbheXIRKc/EzCzRfx05on9bHEEQQP4MqaFb+faGf7
 n47puBL6zIy/2bpMFRzYbMKUKJD7jdDE/H+D8Su2TuM0r+wk9lfKRL8XE0lXHkmn
 ubtz5AfNMAbx8RVoYRTGKimMlCytZvu4o/1aBIN6xw24xMnovklgRLhSjrgGlN9I
 6zNvvHNskzUFhjstFIz+5Z6/HETHGIyGS1PnY3y11QI7364+ZeFepIEiGmwvurnj
 nnvyAcjOnk/mqkFAewHDrnPOBjCTZMuRoAIncAqbhzH/6sGd6WAzufU0n4LJia3H
 AWCkM2Ycs9qTTNp9D4GhU44NBTPHuUOQAoj60IFIMNzcyY8lomQITBiA/AZtxjwY
 iC0RU/Vs3dudigjw4otgudlTfaxn/kkZT9dd1kNguzE5OVue9/Vyh7UiMb4bNugQ
 69SwYd3I34nKzoVF7ytv
 =Kbgj
 -----END PGP SIGNATURE-----

 --fvBKI0PmTJRNxsM8UJWvmIOkffSNpjsr8--

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.