NetBSD Planet


May 17, 2022

Pullup pkgsrc [pullup-pkgsrc #6637] [[email protected]: CVS commit: pkgsrc/multimedia/libaom]
OS News My unholy battle with a Rock64

I’ve got this rock64, which is an aarch64 board comparable to a Raspberry Pi 3 B+ with 4 gigs of ram. For years I’ve wanted to put a distribution on here that doesn’t have a premade image available, mainly because out of all the options on that page I don’t actually like any of them. Well, except NetBSD, but NetBSD doesn’t have GPU drivers for it. Problem is, everything I do want to use provides rootfs tarballs and tells you to figure it out. To do that I’ve got to get a Linux kernel, track down the device trees so it knows what hardware it has, and then wrangle u-boot into actually booting the whole thing. I figured that would be the hard part; little did I know the depths that Single Board Computer Hell would reach.

Unlike x86, ARM is far, far from a standardised platform. The end result of this is that unless you can find tailor-made images specific for your particular ARM board, you’re gonna have to do a lot of manual labour to install an operating system that should work.

Pullup 9 [pullup-9 #1455] Additional fix for CVE-2016-6253
Pullup 8 [pullup-8 #1743] Additional fix for CVE-2016-6253
Pullup 8 [pullup-8 #1742] Improve mfi(4) and mfii(4)

May 16, 2022

Pullup pkgsrc [pullup-pkgsrc #6636] [[email protected]: CVS commit: pkgsrc/www/firefox91-l10n]
Pullup pkgsrc [pullup-pkgsrc #6635] [[email protected]: CVS commit: pkgsrc/www/firefox91]
Ruben Schade A quick look at console file managers

I still consider XTreeGold some of the best utility software ever written, and it still makes using my vintage PCs a joy. I’ve been looking again if there are modern equivalents, especially for exploring file systems and performing batch tasks.

Here’s what I have so far:

Let me know if you have other suggestions, I may be slightly obsessed with the concept right now.

By Ruben Schade in Sydney, 2022-05-17.

Stack Overflow Solaris 8 X11 binaries generate segmentation violation on startup on NetBSD 8.2 [closed]

Edit: This question has also been posted on SuperUser.

All,

Recently, I've been trying to get the Solaris 8 versions of xterm and xauth working on NetBSD from an ssh client with X11 forwarding, but both binaries seem to generate segmentation violations immediately. I ran a ktrace on both programs to try to figure out what happened, and the last few lines of output for both programs look like this:

...
   571      1 xclock   compat_20_getfsstat(0xedefa018, 0xefffede4) Err#2 ENOENT
   571      1 xclock   compat_50_getrusage(0xedefa000, 0x1000) = 0
   571      1 xclock   #115 (obsolete vtrace)(0, 0x1000, 0x7, 0x80000102, 0xffffffff, 0) = -303063040
   571      1 xclock   compat_50_getrusage(0xedee4000, 0x1000) = 0
   571      1 xclock   break(0x25850)              = 0
   571      1 xclock   break(0x27850)              = 0
   571      1 xclock   break(0x27850)              = 0
   571      1 xclock   break(0x29850)              = 0
   571      1 xclock   break(0x29850)              = 0
   571      1 xclock   break(0x2b850)              = 0
   571      1 xclock   compat_43_otruncate(0x5, 0xeffff3a0) = 0
   571      1 xclock   shmdt(0x2, 0x2, 0)          = 3
   571      1 xclock   modctl(0x3, 0x6, 0x1, 0xeffff39c, 0x4) = 0
   571      1 xclock   modctl(0x3, 0xffff, 0x8, 0xeffff398, 0x4) = 0
   571      1 xclock   break(0x2b850)              = 0
   571      1 xclock   break(0x2d850)              = 0
   571      1 xclock   open("/emul/svr4/etc/netconfig", 0, 0x1b6) = 4
   571      1 xclock   #217 (unimplemented)(0x4, 0xefffebb0) = 0
   571      1 xclock   ioctl(0x4, _IO('T',0x1,0), 0xefffeb3c) Err#-4
   571      1 xclock   read(0x4, 0x2b9a4, 0x400)   = 1024
       "#pragma ident\t"@(#)netconfig\t1.16\t99/10/25 SMI"\n#\n# The "Network Configuration" File.\n#\n# Each entry is of the form:\n#\n#       <network_id> <semantics> <fl"
   571      1 xclock   SIGSEGV SIG_DFL

I noticed that the ioctl call is failing; could this be a reason for failure here?

I also ran ktrace on the NetBSD versions of xclock and xterm to see if there were any similarities, and the most similar samples of output I could find were the following:

...
   604      1 xclock   __stat50("/etc/nsswitch.conf", 0xefffeed8) = 0
   604      1 xclock   open("/etc/nsswitch.conf", 0x400000, 0x1b6) = 3
   604      1 xclock   __fstat50(0x3, 0xefffeb70)  = 0
   604      1 xclock   read(0x3, 0xed61d000, 0x4000) = 621
       "#\t$NetBSD: nsswitch.conf,v 1.6 2009/10/25 00:17:06 tsarna Exp $\n#\n# nsswitch.conf(5) -\n#\tname service switch configuration file\n#\n\n\n# These are the default"
   604      1 xclock   read(0x3, 0xed61d000, 0x4000) = 0
...
   604      1 xclock   open("/etc/hosts", 0x400000, 0x1b6) = 3
   604      1 xclock   __fstat50(0x3, 0xefffcc38)  = 0
   604      1 xclock   read(0x3, 0xed61d000, 0x4000) = 831
       "#\t$NetBSD: hosts,v 1.9 2013/11/24 07:20:01 dholland Exp $\n#\n# Host name database.\n#\n# This file contains addresses and aliases for local hosts whose names\n# n"
   604      1 xclock   read(0x3, 0xed61d000, 0x4000) = 0
       ""
   604      1 xclock   close(0x3)                  = 0

Because of this, I suspect the reason might lie in some of the Solaris 8 files that I copied over to the NetBSD virtual machine (e.g. /etc/netconfig), but I'm unsure. Could these files be the reason why none of the Solaris 8 X11 binaries function correctly on NetBSD?

Super User Solaris 8 X11 binaries generate segmentation violations on NetBSD

All,

Recently, I've been trying to get the Solaris 8 versions of xterm and xauth working on NetBSD from an ssh client with X11 forwarding, but both binaries seem to generate segmentation violations immediately. I ran a ktrace on both programs to try to figure out what happened, and the last few lines of output for both programs look like this:

...
   571      1 xclock   compat_20_getfsstat(0xedefa018, 0xefffede4) Err#2 ENOENT
   571      1 xclock   compat_50_getrusage(0xedefa000, 0x1000) = 0
   571      1 xclock   #115 (obsolete vtrace)(0, 0x1000, 0x7, 0x80000102, 0xffffffff, 0) = -303063040
   571      1 xclock   compat_50_getrusage(0xedee4000, 0x1000) = 0
   571      1 xclock   break(0x25850)              = 0
   571      1 xclock   break(0x27850)              = 0
   571      1 xclock   break(0x27850)              = 0
   571      1 xclock   break(0x29850)              = 0
   571      1 xclock   break(0x29850)              = 0
   571      1 xclock   break(0x2b850)              = 0
   571      1 xclock   compat_43_otruncate(0x5, 0xeffff3a0) = 0
   571      1 xclock   shmdt(0x2, 0x2, 0)          = 3
   571      1 xclock   modctl(0x3, 0x6, 0x1, 0xeffff39c, 0x4) = 0
   571      1 xclock   modctl(0x3, 0xffff, 0x8, 0xeffff398, 0x4) = 0
   571      1 xclock   break(0x2b850)              = 0
   571      1 xclock   break(0x2d850)              = 0
   571      1 xclock   open("/emul/svr4/etc/netconfig", 0, 0x1b6) = 4
   571      1 xclock   #217 (unimplemented)(0x4, 0xefffebb0) = 0
   571      1 xclock   ioctl(0x4, _IO('T',0x1,0), 0xefffeb3c) Err#-4
   571      1 xclock   read(0x4, 0x2b9a4, 0x400)   = 1024
       "#pragma ident\t"@(#)netconfig\t1.16\t99/10/25 SMI"\n#\n# The "Network Configuration" File.\n#\n# Each entry is of the form:\n#\n#       <network_id> <semantics> <fl"
   571      1 xclock   SIGSEGV SIG_DFL

I noticed that the ioctl call is failing; could this be a reason for failure here?

I also ran ktrace on the NetBSD versions of xclock and xterm to see if there were any similarities, and the most similar samples of output I could find were the following:

...
   604      1 xclock   __stat50("/etc/nsswitch.conf", 0xefffeed8) = 0
   604      1 xclock   open("/etc/nsswitch.conf", 0x400000, 0x1b6) = 3
   604      1 xclock   __fstat50(0x3, 0xefffeb70)  = 0
   604      1 xclock   read(0x3, 0xed61d000, 0x4000) = 621
       "#\t$NetBSD: nsswitch.conf,v 1.6 2009/10/25 00:17:06 tsarna Exp $\n#\n# nsswitch.conf(5) -\n#\tname service switch configuration file\n#\n\n\n# These are the default"
   604      1 xclock   read(0x3, 0xed61d000, 0x4000) = 0
...
   604      1 xclock   open("/etc/hosts", 0x400000, 0x1b6) = 3
   604      1 xclock   __fstat50(0x3, 0xefffcc38)  = 0
   604      1 xclock   read(0x3, 0xed61d000, 0x4000) = 831
       "#\t$NetBSD: hosts,v 1.9 2013/11/24 07:20:01 dholland Exp $\n#\n# Host name database.\n#\n# This file contains addresses and aliases for local hosts whose names\n# n"
   604      1 xclock   read(0x3, 0xed61d000, 0x4000) = 0
       ""
   604      1 xclock   close(0x3)                  = 0

Because of this, I suspect the reason might lie in some of the Solaris 8 files that I copied over to the NetBSD virtual machine (e.g. /etc/netconfig), but I'm unsure. Could these files be the reason why none of the Solaris 8 X11 binaries function correctly on NetBSD?

UnitedBSD I have the urge to install NetBSD to a power mac g4 or a mac pro g5

I have the urge to install NetBSD to a power mac g4 or better a mac pro g5 and use it as my daily driver
I'm a Boomer !

/r/NetBSD The journey to ZFS raidz1 with different sized disks (On NetBSD) (Wheelbarrow optional)
submitted by /u/jaypatelani
[link] [comments]
Pullup 9 [pullup-9 #1454] Improve mfi(4) and mfii(4)
Pullup 9 [pullup-9 #1453] more lib/56832: Fwd: CVS commit: src/common/lib/libc/atomic

May 15, 2022

Pullup 9 [pullup-9 #1452] dtc tools build fix
Pullup 9 [pullup-9 #1451] lib/56832 fix

May 14, 2022

Pullup 8 [pullup-8 #1741] bioctl(8) fix
DragonFly BSD Digest In Other BSDs for 2022/05/14

“BSD” is in almost every line as a title.  Maybe not a surprise, but visually noticeable.

/r/NetBSD You can run WPS Office on NetBSD
submitted by /u/christhegreekgeek
[link] [comments]
Ruben Schade My journey back to Fedora Workstation

Long-time readers of my rambling would remember I ran Fedora on my laptops for many years. FreeBSD’s Wi-Fi and suspend/resume support was patchy enough that I kept it on the desktop, and Fedora just worked. I also like to keep my toes in a few camps to see how things are progressing on the other side of the fence, and to keep my Linux skills up.

I stopped using Fedora around the time I made the switch on the server side to Debian for Linux workloads. I figured I’d make my life easier by running the same Linux family everywhere.

People categorise Linux distributions based on their package managers, because it’s such an important interface and probably among the first things people use when configuring a system. But the philosophies behind their designs peek through in other ways too, from configuration locations to file systems.

Over time I got work Macs, and FreeBSD became good enough on my laptops. But then Steam and Proton got me back into the Linux desktop again… I can’t understate how much fun it is having access to PC games and GPUs again without needing to touch Windows.

Ubuntu had been fine for this, but its use of Snaps over Flatpaks (or even just package repos) and a few other wrinkles have made it feel decidedly less Debian-y than I remember. It’s hard to quantify, but it felt flaky.

After distro hopping more times than I care to admit, I tried Fedora again after a few friends and people I trust reported positive experiences with Workstation and the immutable Silverblue. It just worked again, save for some Nvidia adventures which I don’t fault Linux distro maintainers for. I even did an update from 35 to 36, and I haven’t had a system upgrade outside the BSD ecosystem go so smoothly.

There are broader questions about the direction Linux is taking, some of which I think is warranted, and others that make me relish my time in FreeBSD, NetBSD, and illumos. But for a desktop game machine I mostly dual-boot into to play Steam games and Minecraft, I’m remembering why I liked using this. If you’re a desktop Linux user in 2022, it’s probably the best experience you’ll get.

By Ruben Schade in Sydney, 2022-05-14.


May 13, 2022

Julio Merino Remembering Buildtool
Build systems are one of my favorite topics in software engineering. If I recall correctly, my interest in this area started when I got into NetBSD in 2002—20 years ago—and became a pkgsrc contributor. Packaging software for NetBSD made me fight various build systems and, in particular, experience the pains of debugging the GNU Autotools. Around that same time, I was also writing small tools here and there. Out of inertia, I used the GNU Autotools for these and, the more I used them, the more I saw an opportunity for improvement.
/r/NetBSD Customizing NetBSD boot banners
submitted by /u/speckz
[link] [comments]

May 12, 2022

Frederic Cambus Customizing NetBSD boot banners

I recently discovered that it’s surprisingly easy to customize the NetBSD boot loader banner, simply by adding some directives in the boot.cfg configuration file.

Here is the relevant part of the boot.cfg(5) manual page:

     banner   The text from banner lines is displayed instead of the standard
              welcome text by the boot loader.  Up to 12 lines can be defined.
              No special character sequences are recognised, so to specify a
              blank line, a banner line with no value should be given.

Back in 2014, I published some NetBSD ASCII logos to be used as motd or as /etc/issue, but they are higher than 12 lines so using them would either require raising the allowed lines limit (likely not a good idea), or resizing them. I then remembered I had requested some Amiga style logos for Linux and *BSD, which were released by h7 in Break’s second artpack in 2013.

So we can simply append this in /boot.cfg:

banner=         _______ ______       ___      _________  ____       __________
banner=__ _____/      //    _/___ __/   \_____\__     /_/  _//______\___     /\_______
banner=--/   _ \     //    _/    \\      _/    |/_   /\______    /    |/    /  \- -- -
banner=_/     \      \     \     //      \     |_/    /    |/    \    /     \  /
banner=\______/      /\_____\_____\______/\____      //    : ____/____      /\/
banner= \     \_____/  \     \     \     \ \  \_____/ \______/\  \   \_____/  \
banner=h7\_____\    \  /\___________\_____\/\__\    \  \     \ \______\    \dS!
banner=------ - \____\/ - --( n e t b s d )-- - \____\/ \_____\/ - --- \____\/ -------

And enjoy some stylish Amiga ASCII art after the next reboot:

         _______ ______       ___      _________  ____       __________
__ _____/      //    _/___ __/   \_____\__     /_/  _//______\___     /\_______
--/   _ \     //    _/    \\      _/    |/_   /\______    /    |/    /  \- -- -
_/     \      \     \     //      \     |_/    /    |/    \    /     \  /
\______/      /\_____\_____\______/\____      //    : ____/____      /\/
 \     \_____/  \     \     \     \ \  \_____/ \______/\  \   \_____/  \
h7\_____\    \  /\___________\_____\/\__\    \  \     \ \______\    \dS!
------ - \____\/ - --( n e t b s d )-- - \____\/ \_____\/ - --- \____\/ -------

     1. Boot normally
     2. Boot single user
     3. Drop to boot prompt

Choose an option; RETURN for default; SPACE to stop countdown.
Option 1 will be chosen in 2 seconds.

Lastly, here is the PNG version converted with Ansilove, in full Topaz glory:

NetBSD ASCII Logo

/r/NetBSD The NetBSD Foundation Annual General Meeting 2022 is open to the public: May 21, 14:00 UTC
submitted by /u/nia_netbsd
[link] [comments]

May 11, 2022

Pullup pkgsrc [pullup-pkgsrc #6634] sendmail: fix SMTP AUTH
UnitedBSD NetBSD cap and T-shirt

I see a cap and T-shirt from NetBSD website,here is the link:
Cap
Sweatshirt

Nice cap and sweatshirt,I want one


May 10, 2022

UnitedBSD NetBSD 9.2 (AMD64) won't boot (Error 3), unlike other OS-s, on IdeaPad 320-15AST

Hi! I decided to start using NetBSD, so I saw the opportunity to do it when I upgraded my main machine, a Lenovo IdeaPad 320-15AST, a little. It is based on the AMD A9-9420 (which, according to a mailing list message I found, should be supported by NetBSD), has now 8 GB of RAM, a "500 GB" 7200 rpm HDD and the newest BIOS. I indended to use it in a multiboot configuration, along with FreeDOS 1.3 and Microsoft Windows 7 SP1 64-bit.

So first came to partitioning the disk. All the MBR partitions were created during FreeDOS' installation. Later I installed Windows 7 and formatted relevant partitions to NTFS. As usual, the laptop now booted only to Windoze. NetBSD came the last - here is the resulting layout, as seen in the installer (which I ran from an USB stick):

       Start(MB)      Size(MB) Flag Kind             Mount    Bootmenu
   ------------- ------------- ---- ---------------- -------- --------
a:             0          2055      Windows FAT32    FREEDOS2 FreeDOS
b:          2055           203      NTFS                      Windoze
c:          2259        146044 Ia   NetBSD                    NetBSD
d:        148303        328634      Extended partition, LBA
e:        148303         16386      NTFS
f:        164689        115624      NTFS
g:        280313         98311      NTFS
h:        378625         98311      Windows FAT32, L DOS_DANE

I was a little surprised by the ability to configure multiboot in the installer, since I searched a bit previously about multibooting NetBSD and Windows 7, only to find very little information on the subject. I thought about using BCD, as I did previously with OpenBSD, which involves copying the first 512 B of the root partition to a file. Anyway, I decided to give the NetBSD's boot selector a try.

Next came partitioning the NetBSD's slice. I mostly replicated the layout I tended to use with OpenBSD:

     Start (MB)     End (MB)    Size (MB)  FS type Flag Filesystem
   ------------ ------------ ------------ -------- ---- ----------
a:         2388         5390         3003    FFSv2 N    /
b:         5391        21775        16385     swap
c:         2259       148302       146044 NetBSD partition
d:            0       476939       476940 Whole disk
e:         2260         2387          128    MSDOS N
f:        21776        27780         6005    FFSv2 N    /usr
g:        27781        33538         5758    FFSv2 N    /var
h:        33539        42545         9007    FFSv2 N    /usr/local
i:        42546        44594         2049    FFSv2 N    /var/log
j:        44595        46396         1802    FFSv2 N    /usr/X11R7
k:        46397        47597         1201    FFSv2 N    /usr/src
l:        47598        49999         2402    FFSv2 N    /usr/obj
m:        50000       148302        98303    FFSv2 N    /home

All partitions created successfully.

I chose to install the following distribution sets:

Initially I wanted to install Share sources, GNU sources and X11 sources as well but during every installation attempt they threw errors related to creating directories and links, so I eventually gave up on them. This didn't affect the main problem in any way. I don't know if this is relevant, but I chose to delete downloaded files after installation.

So it came to final configuration. The network worked during downloading the sets, as well as pkgin and pkgsrc. I added a second user, with /bin/ksh as the shell. The screen looked as follows:

a: Configure network                         configure
b: Timezone                                  Europe/Warsaw
c: Root shell                                /bin/sh
d: Change root password                      password set
e: Enable installation of binary packages    DONE
f: Fetch and unpack pkgsrc                   DONE
g: Enable sshd                               NO
h: Enable ntpd                               NO
i: Run ntpdate at boot                       NO
j: Enable mdnsd                              NO
k: Enable xdm                                NO
l: Enable cgd                                NO
m: Enable lvm                                NO
n: Enable raidframe                          NO
o: Add a user
x: Finished configuring

By default, cgd and raidframe were enabled - I tried this too. Other time I enabled xdm and disabled everything else on the list. No difference in any way, when it comes to main problem.

Installation finished, so I chose to reboot the computer. The following menu appeared:

Fn: diskn
1: FreeDOS
2: Windoze
3: NetBSD

Pressing 3 gives me "Error 3". What's interresting however, FreeDOS 1.3 and Microsoft Windows 7 SP1 64-bit boot fine, out of the box.

I searched about this problem. I found some threads on mailing lists, but the information was sparse. Someone mentioned being able to boot from the installer's boot prompt using the command boot hd0a:netbsd. In my case I got the following:

open: hd0a:netbsd: No such file or directory
boot: hd0a:netbsd: Input/output error

I also tried "wd0a" and "rwd0a" in place of "hd0a", the I tried ommiting the "a" letter but nothing worked. Finally I ran a shell from the installer and managed to successfully mount the root partition, with it's proper contents being in place.

I tried to find some more extensive documentation on NetBSD's boot selector but no success there. Besides the image of 9.2 release, I tried 9.2_STABLE images from between 30th April and 3rd May (doing a fresh installation in place of the previous one) - no difference. So I decided to register here and give all details regarding my installation, so maybe someone more experienced or knowledgeable will spot a mistake I'm not aware of or point out other cause of the problem. Any advice/assistance/solution/help will be highly appreciated!

Stack Overflow SSH to NetBSD 8.2 guest with X11 gives "X11 forwarding request failed on channel 0" [closed]

All,

I'm trying to set up SSH X11 forwarding from a NetBSD 8.2 VM (running via QEMU) to a Ubuntu 20.04 host. When I attempt to ssh -X into the machine, the $DISPLAY variable is not set and I get an error message: "X11 forwarding request failed on channel 0". The following are pertinent environment details:

If I run ssh -v, then the relevant X11 output I get is the following:

Authenticated to localhost ([127.0.0.1]:10022).
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: pledge: exec
debug1: client_input_global_request: rtype [email protected] want_reply 0
debug1: Requesting X11 forwarding with authentication spoofing.
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
X11 forwarding request failed on channel 0

what could be possible reasons for this?

The NetBSD Foundation New Security Advisory: NetBSD-SA2022-001

May 09, 2022

Pullup pkgsrc [pullup-pkgsrc #6633] Security fix for libxml2

May 07, 2022

/r/NetBSD what iso to install netbsd on MediaTek MT7628NN ?

Hello, I have this minirouter that has a MediaTek MT7628NN board and a mips32 24KEc cpu. On this page I see some different iso for 32 mips, but I don't know which should I choice. Can you help me ? The choices are: - MIPSeb - MIPSel

submitted by /u/SkyTeeth
[link] [comments]

May 04, 2022

Stack Overflow Solaris 8 xauth binary hangs on NetBSD

All,

In continuing my efforts of trying to get Solaris 8 programs to function on NetBSD, I'm now attempting to get vncserver from (Tight VNC) to work (I'd link the github page, but the source of the vncserver perl script is slightly different than the one I'm using - though I feel uneasy about dumping all of this code here, I'll paste the source below the question). I've noticed that the system("xauth ...") line is hanging, and I discovered that it's using the xauth binary from Solaris 8. This binary hangs even when running it directly (e.g. ./xauth), so do I need to obtain a NetBSD version of xauth and change those lines for vncserver to work?

source code for the vncserver perl script from Solaris 8 (relevant line is 151)

#!/emul/svr4/usr/bin/perl
#
#  Copyright (C) 1999 AT&T Laboratories Cambridge.  All Rights Reserved.
#
#  This is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This software is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this software; if not, write to the Free Software
#  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
#  USA.
#

#
# vncserver - wrapper script to start an X VNC server.
#

#
# First make sure we're operating in a sane environment.
#

&SanityCheck();

#
# Global variables.  You may want to configure some of these for your site.
#

$geometry = "1024x768";
$depth = 8;
$desktopName = "X";
$vncClasses = "/opt/sfw/vnc/classes";
$vncUserDir = "$ENV{HOME}/.vnc";
$xauthorityFile = "$ENV{HOME}/.Xauthority";

$defaultXStartup
    = ("#!/bin/sh\n\n".
       "xrdb \$HOME/.Xresources\n".
       "xsetroot -solid grey\n".
       "xterm -geometry 80x24+10+10 -ls -title \"\$VNCDESKTOP Desktop\" &\n".
       "twm &\n");

chop($host = `uname -n`);


# Check command line options

&ParseOptions("-geometry",1,"-depth",1,"-pixelformat",1,"-name",1,"-kill",1,
          "-help",0,"-h",0,"--help",0);

&Usage() if ($opt{'-help'} || $opt{'-h'} || $opt{'--help'});

&Kill() if ($opt{'-kill'});

# Uncomment this line if you want default geometry, depth and pixelformat
# to match the current X display:
# &GetXDisplayDefaults();

if ($opt{'-geometry'}) {
    $geometry = $opt{'-geometry'};
}
if ($opt{'-depth'}) {
    $depth = $opt{'-depth'};
    $pixelformat = "";
}
if ($opt{'-pixelformat'}) {
    $pixelformat = $opt{'-pixelformat'};
}

&CheckGeometryAndDepth();

if ($opt{'-name'}) {
    $desktopName = $opt{'-name'};
}


# Create the user's vnc directory if necessary.

if (!(-e $vncUserDir)) {
    if (!mkdir($vncUserDir,0755)) {
    die "$prog: Could not create $vncUserDir.\n";
    }
}
    
# Make sure the user has a password.

($z,$z,$mode) = stat("$vncUserDir/passwd");
if (!(-e "$vncUserDir/passwd") || ($mode & 077)) {
    warn "\nYou will require a password to access your desktops.\n\n";
    system("vncpasswd $vncUserDir/passwd"); 
    if (($? >> 8) != 0) {
    exit 1;
    }
}

print "Found pass\n";

# Find display number.

if ((@ARGV > 0) && ($ARGV[0] =~ /^:(\d+)$/)) {
    print "If check one\n";
    $displayNumber = $1;
    shift(@ARGV);
    if (!&CheckDisplayNumber($displayNumber)) {
    die "A VNC server is already running as :$displayNumber\n";
    }
} elsif ((@ARGV > 0) && ($ARGV[0] !~ /^-/)) {
    print "If check two\n";
    &Usage();
} else {
    print "If check three\n";
    $displayNumber = &GetDisplayNumber();
}

print "Got display number\n";

$vncPort = 5900 + $displayNumber;

$desktopLog = "$vncUserDir/$host:$displayNumber.log";
unlink($desktopLog);

print "Unlinked $desktopLog\n";

# Make an X server cookie - use as the seed the sum of the current time, our
# PID and part of the encrypted form of the password.  Ideally we'd use
# /dev/urandom, but that's only available on Linux.

print "Making cookie...\n";

srand(time+$$+unpack("L",`cat $vncUserDir/passwd`));
print "random number generator seeded...\n";

$cookie = "";
$i = 0;
for (1..16) {
    print "another loop iteration...$i\n";
    $cookie .= sprintf("%02x", int(rand(256)));
    $i++;
}
print "hi\n";
 
$command = "xauth -f $xauthorityFile add $host:$displayNumber . $cookie";
print $command;

system("xauth -f $xauthorityFile add $host:$displayNumber . $cookie");
print "added cookie to authority file\n";
system("xauth -f $xauthorityFile add $host/unix:$displayNumber . $cookie"); 

print "Added cookie to host/unix in authority file\n";

print "X server cookie generated\n";

# Now start the X VNC Server

$cmd = "Xvnc :$displayNumber";
$cmd .= " -desktop " . &quotedString($desktopName);
$cmd .= " -httpd $vncClasses";
$cmd .= " -auth $xauthorityFile";
$cmd .= " -geometry $geometry" if ($geometry);
$cmd .= " -depth $depth" if ($depth);
$cmd .= " -pixelformat $pixelformat" if ($pixelformat);
$cmd .= " -rfbwait 120000";
$cmd .= " -rfbauth $vncUserDir/passwd";
$cmd .= " -rfbport $vncPort";

print "Vncserver started\n";

# Add font path and color database stuff here, e.g.:
#
# $cmd .= " -fp /usr/lib/X11/fonts/misc/,/usr/lib/X11/fonts/75dpi/";
# $cmd .= " -co /usr/lib/X11/rgb";
#

foreach $arg (@ARGV) {
    $cmd .= " " . &quotedString($arg);
}
$cmd .= " >> " . &quotedString($desktopLog) . " 2>&1";

# Run $cmd and record the process ID.

$pidFile = "$vncUserDir/$host:$displayNumber.pid";
print "running $cmd...\n";
system("$cmd & echo \$! >$pidFile");

# Give Xvnc a chance to start up

sleep(3); 

warn "\nNew '$desktopName' desktop is $host:$displayNumber\n\n";

# Create the user's xstartup script if necessary.

if (!(-e "$vncUserDir/xstartup")) {
    warn "Creating default startup script $vncUserDir/xstartup\n";
    open(XSTARTUP, ">$vncUserDir/xstartup");
    print XSTARTUP $defaultXStartup;
    close(XSTARTUP);
    chmod 0755, "$vncUserDir/xstartup";
}

# Run the X startup script.

warn "Starting applications specified in $vncUserDir/xstartup\n";
warn "Log file is $desktopLog\n\n";

# If the unix domain socket exists then use that (DISPLAY=:n) otherwise use
# TCP (DISPLAY=host:n)

if (-e "/tmp/.X11-unix/X$displayNumber") {
    $ENV{DISPLAY}= ":$displayNumber";
} else {
    $ENV{DISPLAY}= "$host:$displayNumber";
}
$ENV{VNCDESKTOP}= $desktopName;

system("$vncUserDir/xstartup >> " . &quotedString($desktopLog) . " 2>&1 &");

exit;


###############################################################################
#
# CheckGeometryAndDepth simply makes sure that the geometry and depth values
# are sensible.
#

sub CheckGeometryAndDepth
{
    if ($geometry =~ /^(\d+)x(\d+)$/) {
    $width = $1; $height = $2;

    if (($width<1) || ($height<1)) {
        die "$prog: geometry $geometry is invalid\n";
    }

    while (($width % 4)!=0) {
        $width = $width + 1;
    }

    while (($height % 2)!=0) {
        $height = $height + 1;
    }

    $geometry = "${width}x$height";
    } else {
    die "$prog: geometry $geometry is invalid\n";
    }

    if (($depth < 8) || ($depth > 32)) {
    die "Depth must be between 8 and 32\n";
    }
}


#
# GetDisplayNumber gets the lowest available display number.  A display number
# n is taken if something is listening on the VNC server port (5900+n) or the
# X server port (6000+n).
#

sub GetDisplayNumber
{
    print "Getting display number...\n";
    foreach $n (1..99) {
        print "Checking display number $n....\n";
    if (&CheckDisplayNumber($n)) {
        return $n+0; # Bruce Mah's workaround for bug in perl 5.005_02
    }
    }
    
    die "$prog: no free display number on $host.\n";
}


#
# CheckDisplayNumber checks if the given display number is available.  A
# display number n is taken if something is listening on the VNC server port
# (5900+n) or the X server port (6000+n).
#

sub CheckDisplayNumber
{
    local ($n) = @_;

    socket(S, $AF_INET, $SOCK_STREAM, 0) || die "$prog: socket failed: $!\n";
    eval 'setsockopt(S, &SOL_SOCKET, &SO_REUSEADDR, pack("l", 1))';
    if (!bind(S, pack('S n x12', $AF_INET, 6000 + $n))) {
    close(S);
    return 0;
    }
    close(S);

    socket(S, $AF_INET, $SOCK_STREAM, 0) || die "$prog: socket failed: $!\n";
    eval 'setsockopt(S, &SOL_SOCKET, &SO_REUSEADDR, pack("l", 1))';
    if (!bind(S, pack('S n x12', $AF_INET, 5900 + $n))) {
    close(S);
    return 0;
    }
    close(S);

    if (-e "/tmp/.X$n-lock") {
    warn "\nWarning: $host:$n is taken because of /tmp/.X$n-lock\n";
    warn "Remove this file if there is no X server $host:$n\n";
    return 0;
    }

    if (-e "/tmp/.X11-unix/X$n") {
    warn "\nWarning: $host:$n is taken because of /tmp/.X11-unix/X$n\n";
    warn "Remove this file if there is no X server $host:$n\n";
    return 0;
    }

    return 1;
}


#
# GetXDisplayDefaults uses xdpyinfo to find out the geometry, depth and pixel
# format of the current X display being used.  If successful, it sets the
# options as appropriate so that the X VNC server will use the same settings
# (minus an allowance for window manager decorations on the geometry).  Using
# the same depth and pixel format means that the VNC server won't have to
# translate pixels when the desktop is being viewed on this X display (for
# TrueColor displays anyway).
#

sub GetXDisplayDefaults
{
    local (@lines, @matchlines, $width, $height, $defaultVisualId, $i,
       $red, $green, $blue);

    $wmDecorationWidth = 4; # a guess at typical size for window manager
    $wmDecorationHeight = 24;   # decoration size

    return if (!defined($ENV{DISPLAY}));

    @lines = `xdpyinfo 2>/dev/null`;

    return if ($? != 0);

    @matchlines = grep(/dimensions/, @lines);
    if (@matchlines) {
    ($width, $height) = ($matchlines[0] =~ /(\d+)x(\d+) pixels/);

    $width -= $wmDecorationWidth;
    $height -= $wmDecorationHeight;

    $geometry = "${width}x$height";
    }

    @matchlines = grep(/default visual id/, @lines);
    if (@matchlines) {
    ($defaultVisualId) = ($matchlines[0] =~ /id:\s+(\S+)/);

    for ($i = 0; $i < @lines; $i++) {
        if ($lines[$i] =~ /^\s*visual id:\s+$defaultVisualId$/) {
        if (($lines[$i+1] !~ /TrueColor/) ||
            ($lines[$i+2] !~ /depth/) ||
            ($lines[$i+4] !~ /red, green, blue masks/))
        {
            return;
        }
        last;
        }
    }

    return if ($i >= @lines);

    ($depth) = ($lines[$i+2] =~ /depth:\s+(\d+)/);
    ($red,$green,$blue)
        = ($lines[$i+4]
           =~ /masks:\s+0x([0-9a-f]+), 0x([0-9a-f]+), 0x([0-9a-f]+)/);

    $red = hex($red);
    $green = hex($green);
    $blue = hex($blue);

    if ($red > $blue) {
        $red = int(log($red) / log(2)) - int(log($green) / log(2));
        $green = int(log($green) / log(2)) - int(log($blue) / log(2));
        $blue = int(log($blue) / log(2)) + 1;
        $pixelformat = "rgb$red$green$blue";
    } else {
        $blue = int(log($blue) / log(2)) - int(log($green) / log(2));
        $green = int(log($green) / log(2)) - int(log($red) / log(2));
        $red = int(log($red) / log(2)) + 1;
        $pixelformat = "bgr$blue$green$red";
    }
    }
}


#
# quotedString returns a string which yields the original string when parsed
# by a shell.
#

sub quotedString
{
    local ($in) = @_;

    $in =~ s/\'/\'\"\'\"\'/g;

    return "'$in'";
}


#
# removeSlashes turns slashes into underscores for use as a file name.
#

sub removeSlashes
{
    local ($in) = @_;

    $in =~ s|/|_|g;

    return "$in";
}


#
# Usage
#

sub Usage
{
    die("\nusage: $prog [:<number>] [-name <desktop-name>] [-depth <depth>]\n".
    "                 [-geometry <width>x<height>]\n".
    "                 [-pixelformat rgbNNN|bgrNNN]\n".
    "                 <Xvnc-options>...\n\n".
    "       $prog -kill <X-display>\n\n");
}


#
# Kill
#

sub Kill
{
    $opt{'-kill'} =~ s/(:\d+)\.\d+$/$1/; # e.g. turn :1.0 into :1

    if ($opt{'-kill'} =~ /^:\d+$/) {
    $pidFile = "$vncUserDir/$host$opt{'-kill'}.pid";
    } else {
    if ($opt{'-kill'} !~ /^$host:/) {
        die "\nCan't tell if $opt{'-kill'} is on $host\n".
        "Use -kill :<number> instead\n\n";
    }
    $pidFile = "$vncUserDir/$opt{'-kill'}.pid";
    }

    if (! -r $pidFile) {
    die "\nCan't find file $pidFile\n".
        "You'll have to kill the Xvnc process manually\n\n";
    }

    $SIG{'HUP'} = 'IGNORE';
    chop($pid = `cat $pidFile`);
    warn "Killing Xvnc process ID $pid\n";
    system("kill $pid");
    unlink $pidFile;
    exit;
}


#
# ParseOptions takes a list of possible options and a boolean indicating
# whether the option has a value following, and sets up an associative array
# %opt of the values of the options given on the command line. It removes all
# the arguments it uses from @ARGV and returns them in @optArgs.
#

sub ParseOptions
{
    local (@optval) = @_;
    local ($opt, @opts, %valFollows, @newargs);

    while (@optval) {
    $opt = shift(@optval);
    push(@opts,$opt);
    $valFollows{$opt} = shift(@optval);
    }

    @optArgs = ();
    %opt = ();

    arg: while (defined($arg = shift(@ARGV))) {
    foreach $opt (@opts) {
        if ($arg eq $opt) {
        push(@optArgs, $arg);
        if ($valFollows{$opt}) {
            if (@ARGV == 0) {
            &Usage();
            }
            $opt{$opt} = shift(@ARGV);
            push(@optArgs, $opt{$opt});
        } else {
            $opt{$opt} = 1;
        }
        next arg;
        }
    }
    push(@newargs,$arg);
    }

    @ARGV = @newargs;
}


#
# Routine to make sure we're operating in a sane environment.
#

sub SanityCheck
{
    local ($cmd);

    #
    # Get the program name
    #

    ($prog) = ($0 =~ m|([^/]+)$|);

    #
    # Check we have all the commands we'll need on the path.
    #

 cmd:
    foreach $cmd ("uname","xauth","Xvnc","vncpasswd") {
    for (split(/:/,$ENV{PATH})) {
        if (-x "$_/$cmd") {
        next cmd;
        }
    }
    die "$prog: couldn't find \"$cmd\" on your PATH.\n";
    }

    #
    # Check the HOME environment variable is set
    #

    if (!defined($ENV{HOME})) {
    die "$prog: The HOME environment variable is not set.\n";
    }

    #
    # Find socket constants. 'use Socket' is a perl5-ism, so we wrap it in an
    # eval, and if it fails we try 'require "sys/socket.ph"'.  If this fails,
    # we just guess at the values.  If you find perl moaning here, just
    # hard-code the values of AF_INET and SOCK_STREAM.  You can find these out
    # for your platform by looking in /usr/include/sys/socket.h and related
    # files.
    #

    chop($os = `uname`);
    chop($osrev = `uname -r`);

    eval 'use Socket';
    if ([email protected]) {
    eval 'require "sys/socket.ph"';
    if ([email protected]) {
        if (($os eq "SunOS") && ($osrev !~ /^4/)) {
        $AF_INET = 2;
        $SOCK_STREAM = 2;
        } else {
        $AF_INET = 2;
        $SOCK_STREAM = 1;
        }
    } else {
        $AF_INET = &AF_INET;
        $SOCK_STREAM = &SOCK_STREAM;
    }
    } else {
    $AF_INET = &AF_INET;
    $SOCK_STREAM = &SOCK_STREAM;
    }
}
Pullup 8 [pullup-8 #1740] Security fix: pppoe(4)

May 03, 2022

UnitedBSD nvidia / nouveau problems on 9.2

Hello I'm currently running NetBSD 9.2 stable:

# uname -a
NetBSD localhost 9.2_STABLE NetBSD 9.2_STABLE (GENERIC) #0: Wed Apr 27 16:54:20 UTC 2022  [email protected]:/usr/src/sys/arch/amd64/compile/GENERIC amd64

and I've been having some issues getting my graphics card to work.

I'm currently trying to get an nvidia GTX 770 to work with nouveau, and it seems like it should be supported:
https://man.netbsd.org/NetBSD-9.2-STABLE/nouveau.4

However, once the boot process is done, even if I have xdm=NO on /etc/rc.conf, I get a blank (black) screen.
The machine is not crashed, as I can ssh into it.

The blank screen does not happen if I disable the nouveau driver on the boot manager with userconf disable nouveau.

Several debug outputs:
dmesg:
https://termbin.com/dlx4

dmesg.boot
https://termbin.com/0wfq

lspci -vnn
https://termbin.com/p60z

Xorg.0.log (after running startx)
https://termbin.com/8bac

modstat
https://termbin.com/5zb5

Any help would be appreciated, thanks!


April 30, 2022

DragonFly BSD Digest In Other BSDs for 2022/04/30

How-to week rather than updates week.


April 29, 2022

NetBSD General on DaemonForums Hey everyone, I'm almost sure that one day I opened the NetBSD homepage and saw "9.3"
Hey everyone, I'm almost sure that one day I opened the NetBSD homepage and saw "9.3" as the last version.
Stack Overflow Solaris 8's gcc isn't searching for header files on NetBSD

I have a gcc 2.95.1 binary installed on a Solaris 8 VM. For an experiment, I'm trying to get it working in a NetBSD environment. However, I can't run the compilation phase on any program that involves #include directives, as the binary doesn't seem to be looking for libraries even without the -I flag specified. The example that I'm trying to test out now is a simple Hello World:

#include <stdio.h>
#include <stdlib.h>
int main() {
    printf("Hello World!\n");
    exit(0);
}

Running gcc -I some_random_directory -v -o hello_world.o -c hello_world.c on the Solaris 8 machine produced this:

Reading specs from /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/2.95.1/specs
gcc version 2.95.1 19990816 (release)
 /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/2.95.1/cpp -lang-c -v -I some_random_directory -D__GNUC__=2 -D__GNUC_MINOR__=95 -Dsparc -Dsun -Dunix -D__svr4__ -D__SVR4 -D__sparc__ -D__sun__ -D__unix__ -D__svr4__ -D__SVR4 -D__sparc -D__sun -D__unix -Asystem(unix) -Asystem(svr4) -D__GCC_NEW_VARARGS__ -Acpu(sparc) -Amachine(sparc) hello_world.c /var/tmp/ccA6aEZ8.i
GNU CPP version 2.95.1 19990816 (release) (sparc)
#include "..." search starts here:
#include <...> search starts here:
 some_random_directory
 /usr/local/include
 /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/2.95.1/../../../../sparc-sun-solaris2.8/include
 /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/2.95.1/include
 /usr/include
End of search list.
The following default directories have been omitted from the search path:
 /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/2.95.1/../../../../include/g++-3
End of omitted list.
 /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/2.95.1/cc1 /var/tmp/ccA6aEZ8.i -quiet -dumpbase hello_world.c -version -o /var/tmp/ccUTCLhe.s
GNU C version 2.95.1 19990816 (release) (sparc-sun-solaris2.8) compiled by GNU C version 2.95.1 19990816 (release).

Running the same compilation command using the Solaris 8 gcc on NetBSD produced this:

Reading specs from /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/2.95.1/specs
gcc version 2.95.1 19990816 (release)
 /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/2.95.1/cpp -lang-c -v -I some_random_directory -D__GNUC__=2 -D__GNUC_MINOR__=95 -Dsparc -Dsun -Dunix -D__svr4__ -D__SVR4 -D__sparc__ -D__sun__ -D__unix__ -D__svr4__ -D__SVR4 -D__sparc -D__sun -D__unix -Asystem(unix) -Asystem(svr4) -D__GCC_NEW_VARARGS__ -Acpu(sparc) -Amachine(sparc) hello_world.c /var/tmp/ccFedUPd.i
GNU CPP version 2.95.1 19990816 (release) (sparc)
#include "..." search starts here:
#include <...> search starts here:
 .
 .
 .
 .
 .
End of search list.
The following default directories have been omitted from the search path:
 /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/2.95.1/../../../../include/g++-3
End of omitted list.
hello_world.c:1: stdio.h: No such file or directory
hello_world.c:2: stdlib.h: No such file or directory

At first, I thought gcc was just ignoring the -I flag, but the other search locations aren't showing up in the second output either. What might be going on here?

UnitedBSD Nbsysrc - sysrc for NetBSD

https://github.com/rgeorgia/nbsysrc/blob/master/README.md


April 27, 2022

Pullup 8 [pullup-8 #1739] Quota1 fix

April 15, 2022

Stack Overflow Cannot locate /usr/share/examples/svr4 on NetBSD 9.2 32-bit

I'm attempting to setup a (32-bit) NetBSD 9.2 virtual machine with QEMU so that I can run SPARC binaries on it, specifically those that were compiled on Solaris machines (currently I've compiled a short C program on Solaris 8 and am trying to run it on NetBSD). During this endeavor, one website I was directed to is here. Specifically, step #4 of that page references a /usr/share/examples/emul/svr4 directory, which I cannot locate on my NetBSD instance. The only subdirectory within the .../emul directory is linux.

I largely followed the steps outlined here to install NetBSD.

I'm curious as to what specific packages/configuration settings are required in order to get the .../emul/svr4 directory to appear...


April 09, 2022

Ruben Schade A list of my first computers

I talk about some of the machines I grew up with, but I don’t think I’ve ever compiled an actual list of them. It was a bit of a bittersweet exercise, given most of these no longer exist. My parents probably saved me from hoarding a ton of this stuff, though I miss it.

I’m sure you’ve got your own list; contact me if you compile one :).

The 1990s

  1. A whitebox 486-SX. I think it ran MS-DOS 5.x, then Windows 3.0, then MS-DOS 6.0 with 3.1. Was recycled when the hard drive died (much to my chagrin), but I did harvest the 5.25-inch floppy drive and ISA Sound Blaster 32 card.

  2. A whitebox Pentium 133 when we moved to Singapore. Was the first computer I used the Internet on, thanks to its external K56Flex modem. Was recycled when a power surge took it out. Years later I found someone on eBay selling the same bezel for the otherwise unremarkable chassis this machine was built in. No idea what I’ll use it for, but naturally I bought it.

  3. A DIY Pentium 200 MHz tower. This was the first computer I ever built myself from parts as a kid, and she still runs to this day! She now even includes the aforementioned parts from that first machine.

  4. An HP Brio BAx. 450 MHz Pentium III. This was our first “branded” computer we got at a tradeshow in Singapore. First ATX machine with PS/2 ports and USB… and the first I bricked with a BIOS update. Long taken to recycling.

  5. A Blueberry iMac DV. The recording studio my sister and I worked had them, and I’d been fascinated by Mac OS from the computers at school. Such an icon of the 1990s. I still have her, but she doesn’t boot.

The 2000s

  1. NTSC Commodore 16, 64, and Plus/4, parents bought from eBay for my 18th birthday. The 64 was sent to the Geekorium after he generously donated his PAL Commodore 128 to me a few years ago.

  2. An AMD Athlon XP tower I built from parts to play PC games on, mostly Age of Empires, Worms II, and Need For Speed. Didn’t know much about graphics, so don’t even remember what GPU I bought for her. My first experience with a burntout CPU when I realised I didn’t attach the heatsink properly. Was recycled.

  3. A Sony Vaio PCG-C1VM [sic] subnotebook. While attempting to upgrade her hard drive, I slipped with a knife (long story) and sliced a part of my hand open. I still have the scar! Needless to say, I recycled her and shouted good riddance, you piece of schmidt!

  4. An iBook G3, dual-USB port version. Probably my favourite laptop ever. Mac OS X barely ran on the iMac DV, but was beautiful on this machine. I did all my high school library studies on it. Also the first computer I booted NetBSD and FreeBSD on.

  5. PowerMac G5, parents bought for my graduation and when I started uni. Produced the first episodes of my silly, long-running podcast on her. Was such a fun machine to tinker with. Ended up selling her on eBay to fund my first MacBook Pro.

  6. ThinkPad X40 and X61, picked up from eBay for peanuts. I ran Fedora on them, because Wi-Fi was a bit flaky on FreeBSD. These were my coffee shop and library study computers. Absolute tanks. Ended up donating them, but I miss them.

  7. MacBook Pro 1,1, the first Intel Mac released. People forget that this generation used the 32-bit Core Duo CPU. Was a beta tester for the first Parallels Desktop virtualisation software on her, and was also set to triple-boot Solaris and FreeBSD.

  8. Toshiba Libretto 70CT, a tiny laptop I’d always wanted as a kid, picked up on eBay for peanuts.

By Ruben Schade in Sydney, 2022-04-10.

DragonFly BSD Digest In Other BSDs for 2022/04/09

Last news item is the saddest.


April 06, 2022

OS News Writing a NetBSD kernel module

In this post, we’ll look at implementing a simple character device driver as a kernel module in NetBSD. Once it is loaded, userspace processes will be able to write an arbitrary byte string to the device, and on every successive read expect a cryptographically-secure pseudorandom permutation of the original byte string.

IF you’ve always wanted to learn how to write a NetBSD driver, here’s a great starting point.


April 04, 2022

Ruben Schade PCLZIP_ERR_BAD_FORMAT (-10) : Invalid archive structure

If WordPress spits out the above error message when installing plugins or themes, you might not have the required PHP curl installed, or a mismatched version.

Assuming you’re using PHP 7.4, you’ll want to install php74-curl or php-curl on FreeBSD, NetBSD/pkgsrc, or Debian-based Linux distros.

This a perfect case study in bad error messages. A layperson would see that error and assume an invalid archive means… an invalid archive. It’s technically correct, and entirely meaningless, to say a non-existent download would also be an invalid archive.

By Ruben Schade in Sydney, 2022-04-05.


April 02, 2022

DragonFly BSD Digest In Other BSDs for 2022/04/02

Mini-ZFS theme this week.


April 01, 2022

Frederic Cambus Toolchains adventures - Q1 2022
My continuous journey into toolchains, in the first quarter of 2022

This is the fourth post in my toolchains adventures series. Please check the previous posts in the toolchains category for more context about this journey.

In Pkgsrc land, I packaged and imported pax-utils, and updated mold to the 1.0.1, 1.0.2, 1.0.3, 1.1, and 1.1.1 versions. Since version 1.0.2, mold can now link NetBSD object files thanks to work done by [email protected]

I also committed upstream fix for CVE-2021-45078 in binutils to fix an out-of-bounds write, and imported our NetBSD/aarch64 support patches for ld from the NetBSD’s src repository. This fixes the build on NetBSD/aarch64. I then updated the package to the 2.38 version which was released in February.

I don’t have much to report on the LLVM side, I only made two documentation related commits this quarter. However, I have a few things I plan to look at, so I should hopefully have more to report next time.

Besides that, I’ve been mostly busy reading different material, and adding a lot of new resources to toolchains.net.

That’s all for now, happy Spring 2022 everyone!

LLVM commits:

2022-03-23 45c6738 [compiler-rt] Remove forgotten mention of SVN modules, LLVM now uses Git
2022-03-21 bc01d8f [compiler-rt] Remove mentions of AuroraUX in code comments and docs

March 30, 2022

Super User Can we have/develop: an accounting non-blocking character device /dev/entropy

do we need to develop ... innovate?

/dev/entropy

a accounting, - non-blocking, high availability-cryptographic unix-type character device that has its own interactive interface to allow programmatic assertions, to allow the definition of pools of entropy of various designated sources, which were previously added to aid the remixing of entropy pool - with specialized software and specific hardware peripherals, dongles, even the conversions of cryptographic functions to hardware

/dev/entropy is capable of persisting keep-state information of elements that are defined in the cryptographic subsystem, such as the details of designated entropy pools, its mode of operation for mixture from sources, it's access information. All information that is needed to keep coherency of a system - secured process of re-entry interpretation.

/dev/entropy will be a non-blocking character device, 2. that allow and assure high availability and early readiness of encapsulated information, to prevent boot time regression of a system, to prevent dangling of boot time processes - with a specific interface that may allow programmed interaction to assert to running configurations of the cryptographic subsystem. Why: The Dutch intelligence community has some formal recommendation towards information transformation for the post-quantum era. Asymmetric encryption would at least benefit to harden a datastore.

Why: because /dev/random looks less elegant now on Debian, with irregular symbolic bursts, nothing qualitative can be said about the pool of entropy. That is not having hypersonic products of entropy from high- and low-quality sources, in a rehashing scheme, exposing bias already to several bits that may lead to more exposure of any cascade of cryptographic functions ahead.

/dev/entropy would help benefit all new methods and algorithms, from cryptographic facilities aiding ambiguity such as having spatial decorrelation, spatial complexity - which by means of graphing has the worst differentiated nodes dissolved in reversal, adding temporal complexity to streams, What we need is that perhaps comes from core isolated lightweight processes to produce asynchronous tokens, to build pathways that with one way hashing functions.

TBC... there will be a tactical augmented console interface and authentication in multiple factors such as holding a zero (mirrored) in from of a image source and the gesture of 'TENET' with both hands. There will also be a tactical projection device that uses lasers to guide the one-time projection.


March 26, 2022

DragonFly BSD Digest In Other BSDs for 2022/03/26

Note the new-to-me book news in there.

 


March 24, 2022

Ruben Schade paprok gets CDE running on NetBSD

CDE was a bit before my time dabbling in UNIX, but I’ve always loved that chiselled Motif aesthetic. Remember when Xfce was billed as CDE-like, and had that bottom panel configured in a similar way?

But I digress. I wanted to give a shoutout to /u/paprok getting CDE running on contemporary NetBSD, which I might have to try on my vintage builds!

Screenshot showing paprok's CDE desktop on NetBSD

As an aside, is a phrase with three words. I subscribe to various BSD subreddits in The Old Reader using RSS feeds, so I don’t have to go to the site directly.

By Ruben Schade in Sydney, 2022-03-24.


March 16, 2022

NetBSD Blog The NetBSD Foundation is a mentoring organization at Google Summer of Code 2022

Google Summer of Code logo

We are happy to announce that The NetBSD Fundation is a mentoring organization at Google Summer of Code 2022!

Would you like to contribute to NetBSD or pkgsrc during the summer? Please give a look to NetBSD wiki Google Summer of Code page with possible ideas list and/or please join #NetBSD-code IRC channel on libera or get in touch with us via mailing lists to propose new projects!

Please note that unlike past years where Google Summer of Code was opened only to university students since this year if you are 18 or older you can be a GSoC contributor.

For more information about Google Summer of Code please give a look to the official GSoC website.

Looking forward to have a nice Google Summer of Code!


March 15, 2022

Frederic Cambus FreeBSD on the Vortex86DX CPU
Running FreeBSD on the DMP EBOX 3300A-H with a Vortex86DX CPU

After trying NetBSD and OpenBSD on my DMP EBOX 3300A-H with a Vortex86DX CPU, I was curious to see how FreeBSD would fare on such constrained systems these days.

For more information and background about the hardware, please refer to my previous article.

Attempting to install FreeBSD 13.0 failed early when loading the kernel, and both supported releases from the FreeBSD 12 series (12.2 and 12.3) also exhibit the same issue.

int=00000006  err=00000000  efl=00000002  eip=013d1651
eax=01fe26b0  ebx=0008274c  ecx=00000000  edx=01fe8b77
esi=01d8c3d8  edi=019b20c8  ebp=019b2038  esp=00000000
cs=0008  ds=0010  es=0010    fs=0010  gs=0010  ss=0010
cs:eip=0f 45 f0 a1 88 20 9b 01-85 c0 0f 45 f0 81 c6 ff
       ff 3f 00 81 e6 00 00 c0-ff 89 35 d4 ad d8 01 8d
ss:esp=f3 ee 00 f0 f3 ee 00 f0-c3 e2 00 f0 f3 ee 00 f0
       f3 ee 00 f0 54 ff 00 f0-4f 07 00 f0 f7 06 00 f0
BTX halted

FreeBSD 13.0 release notes mention that the default CPUTYPE for the i386 architecture is now 686 (instead of 486), and have details on the rationale behind this change.

After digging a bit, it turns out some Vortex86 CPUs lack support for the Conditional Move (CMOV) instruction, and code targetting i686 will fail on those models.

Using objdump to disassemble the kernels for the 12.2, 12.3, and 13.0 releases revealed that they were indeed using CMOV. Performing the same checks on the kernels from FreeBSD 12.0 and 12.1 releases did not show any CMOV instructions use.

The FreeBSD 12.1 installation process completed successfully and I could reboot into the installed system without issues. This version is not supported anymore but it doesn’t matter in this case as it’s more of a one-off thing for the purpose of writing this post, the machine being too constrained for any real world usage in this day and age.

For installing pkg and binary packages, I had to modify the url directive in /etc/pkg/FreeBSD.conf to:

url: "pkg+http://pkg.FreeBSD.org/${ABI}/release_2",

Indeed, quarterly packages and release_3 packages are apparently targetting i686 and their binaries contain CMOV instructions.

Attempting to run i686 binaries result in the following error:

Illegal instruction (core dumped)

We can verify that the culprits are indeed CMOV instructions with the following program:

.section .text

.globl _start

_start:
	cmovl	%eax, %ebx

Let’s assemble, link, and run it:

as cmov.s -o cmov.o
ld cmov.o -o cmov
./cmov
Illegal instruction (core dumped)

With this out of the way, we now have a fully functioning FreeBSD 12.1 installation on this machine.

On a freshly booted system, 16 processes are running and most of the RAM is unused.

last pid:   787;  load averages:  0.30,  0.30,  0.13  up 0+00:02:12    09:55:29
16 processes:  1 running, 15 sleeping
CPU:  6.2% user,  0.0% nice, 10.1% system,  2.1% interrupt, 81.6% idle
Mem: 6556K Active, 1028K Inact, 28M Wired, 16M Buf, 181M Free
Swap: 2752M Total, 2752M Free

  PID USERNAME    THR PRI NICE   SIZE    RES STATE    TIME    WCPU COMMAND
  751 root          1  22    0  5268K  2616K wait     0:00   0.00% login
  759 root          1  20    0  6192K  3108K pause    0:00   0.00% csh
  581 root          1  20    0  4588K  2112K select   0:00   0.00% syslogd
  692 root          1  20    0  8772K  5360K select   0:00   0.00% sendmail
  699 root          1  24    0  4588K  2104K nanslp   0:00   0.00% cron
  787 root          1  23    0  5868K  2592K RUN      0:00   0.00% top
  752 root          1  52    0  4276K  1908K ttyin    0:00   0.00% getty
  756 root          1  52    0  4276K  1908K ttyin    0:00   0.00% getty
  758 root          1  52    0  4276K  1908K ttyin    0:00   0.00% getty
  753 root          1  52    0  4276K  1908K ttyin    0:00   0.00% getty
  757 root          1  52    0  4276K  1908K ttyin    0:00   0.00% getty
  754 root          1  52    0  4276K  1908K ttyin    0:00   0.00% getty
  755 root          1  52    0  4276K  1908K ttyin    0:00   0.00% getty
  695 smmsp         1  52    0  8548K  4848K pause    0:00   0.00% sendmail
   94 root          1  52    0  4152K  1688K pause    0:00   0.00% adjkerntz
  421 root          1  20    0  3864K  1108K select   0:00   0.00% devd

Here is the result of the md5 -t benchmark:

MD5 time trial. Digesting 100000 10000-byte blocks ... done
Digest = 766a2bb5d24bddae466c572bcabca3ee
Time = 20.719989 seconds
Speed = 46.026777 MiB/second

And this is the result of the sha1 -t benchmark:

SHA1 time trial. Digesting 100000 10000-byte blocks ... done
Digest = 02522491d7a8253fcab708560acfa84b2fb7ef1c
Time = 54.165445 seconds
Speed = 17.606692 MiB/second

For the record, OpenSSL speed benchmark results are available here.

Finally, here is a dmesg for reference purposes:

Copyright (c) 1992-2019 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
	The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 12.1-RELEASE r354233 GENERIC i386
FreeBSD clang version 8.0.1 (tags/RELEASE_801/final 366581) (based on LLVM 8.0.1)
VT(vga): resolution 640x480
Firmware Error (ACPI): A valid RSDP was not found (20181213/tbxfroot-369)
CPU: PentiumUnknown (1000.02-MHz 586-class CPU)
  Origin="Vortex86 SoC"  Id=0x522
real memory  = 268435456 (256 MB)
avail memory = 225300480 (214 MB)
random: unblocking device.
stray irq7
Timecounter "TSC" frequency 1000023008 Hz quality 800
random: entropy device external interface
kbd1 at kbdmux0
[ath_hal] loaded
module_register_init: MOD_LOAD (vesa, 0x14d9fb0, 0) error 19
Firmware Error (ACPI): A valid RSDP was not found (20181213/tbxfroot-369)
ACPI: Table initialisation failed: AE_NOT_FOUND
ACPI: Try disabling either ACPI or apic support.
vtvga0: <VT VGA driver> on motherboard
cryptosoft0: <software crypto> on motherboard
pcib0 pcibus 0 on motherboard
pir0: <PCI Interrupt Routing Table: 12 Entries> on motherboard
pci0: <PCI bus> on pcib0
vgapci0: <VGA-compatible display> port 0xdf80-0xdfff mem 0xf8000000-0xfbffffff,0xfefc0000-0xfeffffff at device 3.0 on pci0
vgapci0: Boot video device
isab0: <PCI-ISA bridge> at device 7.0 on pci0
isa0: <ISA bus> on isab0
vte0: <RDC R6040 FastEthernet> port 0xde00-0xdeff mem 0xfefbb400-0xfefbb4ff irq 10 at device 8.0 on pci0
miibus0: <MII bus> on vte0
rdcphy0: <R6040 10/100 media interface> PHY 1 on miibus0
rdcphy0:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
vte0: Ethernet address: 00:1b:eb:22:16:5c
ohci0: <OHCI (generic) USB controller> mem 0xfefb9000-0xfefb9fff irq 11 at device 10.0 on pci0
usbus0 on ohci0
ehci0: <EHCI (generic) USB 2.0 controller> mem 0xfefbb800-0xfefbb8ff irq 11 at device 10.1 on pci0
usbus1: EHCI version 1.0
usbus1 on ehci0
ohci1: <OHCI (generic) USB controller> mem 0xfefba000-0xfefbafff irq 11 at device 11.0 on pci0
usbus2 on ohci1
ehci1: <EHCI (generic) USB 2.0 controller> mem 0xfefbbc00-0xfefbbcff irq 11 at device 11.1 on pci0
usbus3: EHCI version 1.0
usbus3 on ehci1
atapci0: <Generic ATA controller> port 0x1f0-0x1f7,0x3f6,0x170-0x177,0x376,0xef00-0xef0f irq 14 at device 12.0 on pci0
ata0: <ATA channel> at channel 0 on atapci0
ata1: <ATA channel> at channel 1 on atapci0
cpu0 on motherboard
unknown: <PNP0c01> can't assign resources (memory)
Firmware Error (ACPI): A valid RSDP was not found (20181213/tbxfroot-369)
Firmware Error (ACPI): A valid RSDP was not found (20181213/tbxfroot-369)
attimer0: <AT timer> at port 0x40-0x43 irq 0 pnpid PNP0100 on isa0
Timecounter "i8254" frequency 1193182 Hz quality 0
Event timer "i8254" frequency 1193182 Hz quality 100
Firmware Error (ACPI): A valid RSDP was not found (20181213/tbxfroot-369)
atrtc0: <AT realtime clock> at port 0x70-0x71 irq 8 pnpid PNP0b00 on isa0
atrtc0: registered as a time-of-day clock, resolution 1.000000s
Event timer "RTC" frequency 32768 Hz quality 0
Firmware Error (ACPI): A valid RSDP was not found (20181213/tbxfroot-369)
Firmware Error (ACPI): A valid RSDP was not found (20181213/tbxfroot-369)
Firmware Error (ACPI): A valid RSDP was not found (20181213/tbxfroot-369)
Firmware Error (ACPI): A valid RSDP was not found (20181213/tbxfroot-369)
atkbdc0: <Keyboard controller (i8042)> at port 0x60,0x64 irq 1 pnpid PNP0303 on isa0
atkbd0: <AT Keyboard> irq 1 on atkbdc0
kbd0 at atkbd0
atkbd0: [GIANT-LOCKED]
orm0: <ISA Option ROM> at iomem 0xc0000-0xc7fff pnpid ORM0000 on isa0
fdc0: No FDOUT register!
ppc0: parallel port not found.
unknown: <PNP0c01> can't assign resources (memory)
Firmware Error (ACPI): A valid RSDP was not found (20181213/tbxfroot-369)
Timecounters tick every 1.000 msec
usbus0: 12Mbps Full Speed USB v1.0
usbus1: 480Mbps High Speed USB v2.0
ugen0.1: <(0x17f3) OHCI root HUB> at usbus0
uhub0: <(0x17f3) OHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus0
ugen1.1: <(0x17f3) EHCI root HUB> at usbus1
uhub1: <(0x17f3) EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus1
usbus2: 12Mbps Full Speed USB v1.0
usbus3: 480Mbps High Speed USB v2.0
ugen2.1: <(0x17f3) OHCI root HUB> at usbus2
uhub2: <(0x17f3) OHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus2
ugen3.1: <(0x17f3) EHCI root HUB> at usbus3
uhub3: <(0x17f3) EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus3
uhub0: 2 ports with 2 removable, self powered
uhub2: 2 ports with 2 removable, self powered
Trying to mount root from ufs:/dev/da0s1a [rw]...
Root mount waiting for: usbus3 usbus1
uhub1: 2 ports with 2 removable, self powered
uhub3: 2 ports with 2 removable, self powered
Root mount waiting for: usbus3 usbus1
ugen0.2: <vendor 0x0d8c C-Media USB Audio Device> at usbus0
ugen2.2: <Lenovo ThinkPad Compact USB Keyboard with TrackPoint> at usbus2
ukbd0 on uhub2
ukbd0: <Lenovo ThinkPad Compact USB Keyboard with TrackPoint, class 0/0, rev 2.00/3.30, addr 2> on usbus2
kbd2 at ukbd0
Root mount waiting for: usbus3
Root mount waiting for: usbus3
ugen3.2: <Generic USB Storage> at usbus3
umass0 on uhub3
umass0: <Generic USB Storage, class 0/0, rev 2.00/2.20, addr 2> on usbus3
umass0:  SCSI over Bulk-Only; quirks = 0xc100
umass0:2:0: Attached to scbus2
mountroot: waiting for device /dev/da0s1a...
da0 at umass-sim0 bus 0 scbus2 target 0 lun 0
da0: <Generic STORAGE DEVICE 0220> Removable Direct Access SCSI device
da0: 40.000MB/s transfers
da0: 61120MB (125173760 512 byte sectors)
da0: quirks=0x3<NO_SYNC_CACHE,NO_6_BYTE>
lo0: link state changed to UP
vte0: link state changed to DOWN
uaudio0 on uhub0
uaudio0: <vendor 0x0d8c C-Media USB Audio Device, class 0/0, rev 1.10/1.00, addr 2> on usbus0
uaudio0: Play: 48000 Hz, 2 ch, 16-bit S-LE PCM format, 2x8ms buffer.
uaudio0: Play: 44100 Hz, 2 ch, 16-bit S-LE PCM format, 2x8ms buffer.
uaudio0: Record: 48000 Hz, 1 ch, 16-bit S-LE PCM format, 2x8ms buffer.
uaudio0: Record: 44100 Hz, 1 ch, 16-bit S-LE PCM format, 2x8ms buffer.
uaudio0: No MIDI sequencer.
pcm0: <USB audio> on uaudio0
uaudio0: HID volume keys found.
ums0 on uhub2
ums0: <Lenovo ThinkPad Compact USB Keyboard with TrackPoint, class 0/0, rev 2.00/3.30, addr 2> on usbus2
ums0: 6 buttons and [XYZT] coordinates ID=1

March 14, 2022

Frederic Cambus FreeBSD on the CubieBoard2
Some notes on installing and running FreeBSD on the CubieBoard2

I have previously been running NetBSD/evbarm and OpenBSD/armv7 on my CubieBoard2, and wrote about it here and here.

The Cubieboard2 is an ARMv7 device which was released in 2013 so it is quite ancient by now. However, a renewed interest in FreeBSD on my side prompted me to try running the system on this device.

ARMv7 is a Tier 2 architecture on FreeBSD, so the system cannot be upgraded by freebsd-update and must be kept up to date by source. On the plus side, binary packages are available on this platform. For those interested, the FreeBSD wiki has more information about running FreeBSD on Allwinner systems.

Cubieboard2

Required steps for creating a bootable micro SD card are as follow: on a FreeBSD machine, we need to install the u-boot-cubieboard2 package and write the image file and the bootloader to the card.

pkg install u-boot-cubieboard2
dd if=FreeBSD-13.0-RELEASE-arm-armv7-GENERICSD.img of=/dev/da0 bs=1M conv=sync
dd if=/usr/local/share/u-boot/u-boot-cubieboard2/u-boot-sunxi-with-spl.bin of=/dev/da0 bs=1k seek=8 conv=sync

The partition will be automatically resized during first boot to span the whole capacity of the card.

Here is the output of running file on executables:

ELF 32-bit LSB executable, ARM, EABI5 version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, FreeBSD-style, for FreeBSD 13.0 (1300139), stripped

Here is the result of the md5 -t benchmark:

MD5 time trial. Digesting 100000 10000-byte blocks ... done
Digest = 766a2bb5d24bddae466c572bcabca3ee
Time = 13.895305 seconds
Speed = 68.632843 MiB/second

And this is the result of the sha1 -t benchmark:

SHA1 time trial. Digesting 100000 10000-byte blocks ... done
Digest = 02522491d7a8253fcab708560acfa84b2fb7ef1c
Time = 23.223881 seconds
Speed = 41.064381 MiB/second

For the record, OpenSSL speed benchmark results are available here.

Finally, here is a dmesg for reference purposes:

Copyright (c) 1992-2021 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
	The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 13.0-RELEASE #0 releng/13.0-n244733-ea31abc261f: Fri Apr  9 06:33:09 UTC 2021
    [email protected]:/usr/obj/usr/src/arm.armv7/sys/GENERIC arm
FreeBSD clang version 11.0.1 ([email protected]:llvm/llvm-project.git llvmorg-11.0.1-0-g43ff75f2c3fe)
VT: init without driver.
No PSCI/SMCCC call function found
CPU: ARM Cortex-A7 r0p4 (ECO: 0x00000000)
CPU Features: 
  Multiprocessing, Thumb2, Security, Virtualization, Generic Timer, VMSAv7,
  PXN, LPAE, Coherent Walk
Optional instructions: 
  SDIV/UDIV, UMULL, SMULL, SIMD(ext)
LoUU:2 LoC:3 LoUIS:2 
Cache level 1:
 32KB/64B 4-way data cache WB Read-Alloc Write-Alloc
 32KB/32B 2-way instruction cache Read-Alloc
Cache level 2:
 256KB/64B 8-way unified cache WB Read-Alloc Write-Alloc
real memory  = 1039581184 (991 MB)
avail memory = 1002311680 (955 MB)
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
random: unblocking device.
random: entropy device external interface
WARNING: Device "kbd" is Giant locked and may be deleted before FreeBSD 14.0.
kbd0 at kbdmux0
WARNING: Device "openfirm" is Giant locked and may be deleted before FreeBSD 14.0.
ofwbus0: <Open Firmware Device Tree>
aw_ccu0: <Allwinner Clock Control Unit> on ofwbus0
clk_fixed0: <Fixed clock> on aw_ccu0
clk_fixed1: <Fixed clock> on aw_ccu0
clk_fixed2: <Fixed clock> on aw_ccu0
clk_fixed3: <Fixed clock> on aw_ccu0
simplebus0: <Flattened device tree simple bus> on ofwbus0
regfix0: <Fixed Regulator> on ofwbus0
regfix1: <Fixed Regulator> on ofwbus0
regfix2: <Fixed Regulator> on ofwbus0
regfix3: <Fixed Regulator> on ofwbus0
regfix4: <Fixed Regulator> on ofwbus0
regfix5: <Fixed Regulator> on ofwbus0
rtc0: <Allwinner RTC> mem 0x1c20d00-0x1c20d1f irq 39 on simplebus0
rtc0: registered as a time-of-day clock, resolution 1.000000s
aw_gmacclk0: <Allwinner GMAC Clock> mem 0x1c20164-0x1c20167 on aw_ccu0
ccu_a10ng0: <Allwinner A10/A20 Clock Control Unit NG> mem 0x1c20000-0x1c203ff on simplebus0
gic0: <ARM Generic Interrupt Controller> mem 0x1c81000-0x1c81fff,0x1c82000-0x1c83fff,0x1c84000-0x1c85fff,0x1c86000-0x1c87fff irq 77 on simplebus0
gic0: pn 0x1, arch 0x2, rev 0x1, implementer 0x43b irqs 160
aw_nmi0: <Allwinner NMI Controller> mem 0x1c00030-0x1c0003b irq 6 on simplebus0
gpio0: <Allwinner GPIO/Pinmux controller> mem 0x1c20800-0x1c20bff irq 31 on simplebus0
gpiobus0: <OFW GPIO bus> on gpio0
iichb0: <Allwinner Integrated I2C Bus Controller> mem 0x1c2ac00-0x1c2afff irq 59 on simplebus0
iicbus0: <OFW I2C bus> on iichb0
axp2xx_pmu0: <X-Powers AXP209 Power Management Unit> at addr 0x68 irq 82 on iicbus0
gpiobus1: <OFW GPIO bus> on axp2xx_pmu0
iichb1: <Allwinner Integrated I2C Bus Controller> mem 0x1c2b000-0x1c2b3ff irq 60 on simplebus0
iicbus1: <OFW I2C bus> on iichb1
generic_timer0: <ARMv7 Generic Timer> irq 0,1,2,3 on ofwbus0
Timecounter "ARM MPCore Timecounter" frequency 24000000 Hz quality 1000
Event timer "ARM MPCore Eventtimer" frequency 24000000 Hz quality 1000
aw_sid0: <Allwinner Secure ID Controller> mem 0x1c23800-0x1c239ff on simplebus0
awusbphy0: <Allwinner USB PHY> mem 0x1c13400-0x1c1340f,0x1c14800-0x1c14803,0x1c1c800-0x1c1c803 on simplebus0
cpulist0: <Open Firmware CPU Group> on ofwbus0
cpu0: <Open Firmware CPU> on cpulist0
cpufreq_dt0: <Generic cpufreq driver> on cpu0
cpu1: <Open Firmware CPU> on cpulist0
pmu0: <Performance Monitoring Unit> irq 4,5 on ofwbus0
a10dmac0: <Allwinner DMA controller> mem 0x1c02000-0x1c02fff irq 7 on simplebus0
aw_mmc0: <Allwinner Integrated MMC/SD controller> mem 0x1c0f000-0x1c0ffff irq 16 on simplebus0
musbotg0: <Allwinner USB DRD> mem 0x1c13000-0x1c133ff irq 20 on simplebus0
musbotg0: setting phy mode 3
usbus0: Dynamic FIFO sizing detected, assuming 16Kbytes of FIFO RAM
usbus0 on musbotg0
ehci0: <Generic EHCI Controller> mem 0x1c14000-0x1c140ff irq 21 on simplebus0
usbus1: EHCI version 1.0
usbus1 on ehci0
ohci0: <Generic OHCI Controller> mem 0x1c14400-0x1c144ff irq 22 on simplebus0
usbus2 on ohci0
ahci0: <Allwinner Integrated AHCI controller> mem 0x1c18000-0x1c18fff irq 26 on simplebus0
ahci0: AHCI v1.10 with 1 3Gbps ports, Port Multiplier not supported
ahci0: quirks=0x2<NOPMP>
ehci1: <Generic EHCI Controller> mem 0x1c1c000-0x1c1c0ff irq 27 on simplebus0
usbus3: EHCI version 1.0
usbus3 on ehci1
ohci1: <Generic OHCI Controller> mem 0x1c1c400-0x1c1c4ff irq 28 on simplebus0
usbus4 on ohci1
gpioc0: <GPIO controller> on gpio0
aw_wdog0: <Allwinner A10 Watchdog> mem 0x1c20c90-0x1c20c9f irq 38 on simplebus0
aw_ir0: <Allwinner CIR controller> mem 0x1c21800-0x1c2183f irq 41 on simplebus0
pcm0: <Allwinner Audio Codec> mem 0x1c22c00-0x1c22c3f irq 46 on simplebus0
pcm0: cannot find codec clock
device_attach: pcm0 attach returned 6
aw_ts0: <Allwinner Touch Screen controller> mem 0x1c25000-0x1c250ff irq 48 on simplebus0
uart0: <16750 or compatible> mem 0x1c28000-0x1c283ff irq 49 on simplebus0
uart0: console (115384,n,8,1)
gpioc1: <GPIO controller> on axp2xx_pmu0
iic0: <I2C generic I/O> on iicbus0
iic1: <I2C generic I/O> on iicbus1
dwc0: <A20 Gigabit Ethernet Controller> mem 0x1c50000-0x1c5ffff irq 72 on simplebus0
miibus0: <MII bus> on dwc0
rlphy0: <RTL8201L 10/100 media interface> PHY 1 on miibus0
rlphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
dwc0: Ethernet address: 02:0a:09:03:27:08
gpioled0: <GPIO LEDs> on ofwbus0
cryptosoft0: <software crypto>
Timecounters tick every 1.000 msec
usbus0: 480Mbps High Speed USB v2.0
usbus1: 480Mbps High Speed USB v2.0
usbus2: 12Mbps Full Speed USB v1.0
usbus3: 480Mbps High Speed USB v2.0
usbus4: 12Mbps Full Speed USB v1.0
Release APs
ugen0.1: <Mentor Graphics OTG Root HUB> at usbus0
Trying to mount root from ufs:/dev/ufs/rootfs [rw]...
uhub0Root mount waiting for: on usbus0
 usbus0uhub0: <Mentor Graphics OTG Root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus0
 usbus1ugen1.1: <Generic EHCI root HUB> at usbus1
 usbus2uhub1 usbus3 on usbus1
 usbus4uhub1: <Generic EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus1
 CAMugen2.1: <Generic OHCI root HUB> at usbus2

uhub2 on usbus2
uhub2: <Generic OHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus2
ugen4.1: <Generic OHCI root HUB> at usbus4
ugen3.1: <Generic EHCI root HUB> at usbus3
uhub3 on usbus4
uhub4 on usbus3
uhub3: <Generic OHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus4
uhub4: <Generic EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus3
mmc0: <MMC/SD bus> on aw_mmc0
mmcsd0: 249GB <SDHC SD256 6.1 SN 35B0016A MFG 09/2020 by 159 TI> at mmc0 50.0MHz/4bit/32768-block
mmc0: Failed to set VCCQ for card at relative address 20552
uhub2: 1 port with 1 removable, self powered
uhub3: 1 port with 1 removable, self powered
uhub0: 1 port with 1 removable, self powered
uhub1: 1 port with 1 removable, self powered
uhub4: 1 port with 1 removable, self powered
mountroot: waiting for device /dev/ufs/rootfs...
lo0: link state changed to UP
dwc0: link state changed to UP

March 09, 2022

NetBSD Blog Making RockPro64 a NetBSD Server

The time has come to upgrade my SunBlade 2500s to something more power friendly and faster. I'd already removed one CPU and thus half the ram from two of these systems to reduce their power consumption, but it's still much higher than it could be.

After much searching, I've decided on Pine64's RockPro64 4GiB ram model (technically, only 3.875GiB ram.) Pine64 make SBCs, laptops, phones, and various other mostly ARM gadgets, and the RockPro64 has the fastest CPU they ship (Rockchip RK3399), and can use a small "NAS Case", that is sufficient to house 2 HDDs and, at a stretch, upto 6 SSDs (cooling would become quite an issue at this point.)

In my SATA setup, I have 3 SSDs with a JMicron 585 card in the PCIe slot, two SSDs in the NAS case SSD region, and the third is in the HDD region with an adapter. I have used two SATA power splitters to convert the NAS case's 2 SATA power ports into 4, with the 4th one also powering a Noctua case fan. The cabling is not great with this, with enough SATA power cabling for 6 devices to lay. Probably a bespoke power cable to connect to the RockPro64 would make this nicer and probably improve cooling slightly, but I'm just using off-the-shelf components for now.

In the last year or so I've been working on making NetBSD/arm64 big-endian more featureful. In particular, I've added support for:

There are not too many special actions needed for this sort of setup compared to a normal NetBSD or Arm system. While I built my installations by hand, the standard NetBSD Arm images are suitable for this task. It's easiest to start from an SD card with the RockPro64 u-boot installed. There are two U-Boot images available, one for SD/eMMC, and one for SPI (there is an odd problem with the early SPI loader that requires a portion of the image to be different.) The pkgsrc package for sysutils/u-boot-rockpro64 version 2022.01 has these suggested methods for installing the U-Boot image (this package should be buildable on any supported pkgsrc platform).

To install U-Boot into the SD/eMMC card (can run on any system, the image must be written at 32KiB into the device):

# dd if=/usr/pkg/share/u-boot/rockpro64/rksd_loader.img seek=64 of=/dev/rld0c

To install U-Boot into the SPI flash (must be run on the host, and lives at the very start of the device:

# dd if=/usr/pkg/share/u-boot/rockpro64/rkspi_loader.img bs=64k of=/dev/spiflash0

When booting from NVMe or SATA, one must drop to the U-Boot prompt and adjust the "boot_targets" value to put scsi* (SATA) or nvme* ahead of the mmc* and usb* options.

The original value for me:

=> printenv boot_targets
boot_targets=mmc1 usb0 mmc0 nvme0 scsi0 pxe dhcp sf0

Which is then adjusted and saved with eg:

=> setenv boot_targets nvme0 scsi0 mmc1 usb0 mmc0 pxe dhcp sf0
=> saveenv
Saving Environment to SPIFlash... Erasing SPI flash...Writing to SPI flash...done
OK

(In this list, mmc1 is the SD slot, mmc0 is the eMMC card, pxe and dhcp are netbooting, and sf0 attempts to load further U-Boot scripts from SPI.)

There are some minor issues with the RockPro64. It has no ability to use ECC memory. It only comes with 1 PCIe 4x slot, and Rockchip errata limited this to PCIe 1.x (though no NetBSD users encounted any issues with PCIe 2.x enabled, and this can be forced back on via a DTS patch.) It is possible to use a PCIe bridge (I have never done this, though I would like to try in the future) to enable more devices for booting, or to enable both a network and storage device.


March 01, 2022

The NetBSD Foundation New Developer in February 2022

February 08, 2022

OS News A practical solution for GNU/Hurd’s lack of drivers: NetBSD’s rumpkernel framework

GNU/Hurd is the original Free Software operating system started in the 1980s. Its microkernel design has been evolving over the years and the project has not quite hit mainstream use. I believe this is due to one main reason: the lack of drivers for peripherals and hardware. In this talk, I explain how NetBSD kernel drivers have been reused in a microkernel setting and demonstrate their use to boot up a GNU/Hurd system via a userspace rump disk driver, with a driverless Hurd kernel, gnumach. The ACPI management, PCI management, and actual driver are in separate processes with RPC interfaces between them, which separates out their debugging, licencing concerns and execution.

Hurd is a neverending story, derailed by the massive popularity and uptake of the Linux kernel as the de facto standard kernel for the GNU project. I’d love for it to become more competitive, but the situation isn’t exactly looking great.


January 20, 2022

Server Fault How to configure NetBSD to accept vlan tagged packets

I am trying to set up a NetBSD install with a static ip that is on a vlan. The router is set up to only allow other vlans to access this vlan, but not the other way around. So the NetBSD install should be able to ping the outside world and respond to pings by devices on other vlans. This is the same environment and machine and connection as Unable to reach host with static ip and gateway is vlan - Debian 10 just different os. I was able to get that machine working with the same gateway/server/netmask values. Just a quick summary...

Router configuration:

IP: 192.168.2.1
Netmask: 255.255.255.0
DHCP range: 192.168.2.2 - 192.168.2.10

This particular vlan configuration (VLAN 3):

VLAN IP: 192.168.0.1
Netmask: 255.255.255.0
DHCP range: 192.168.0.10 - 192.168.0.254

NetBSD/server configuration: Address 192.168.0.2 Netmask: 255.255.255.0 Gateway: 192.168.0.1

The man page for vlan said to do the following to set up (adapted for current set up):

ifconfig vlan3 create
ifconfig vlan3 vlan 3 vlanif bce0

But, I was not able to ping the outside world nor respond to pings from other vlans. I then tried to do:

create
vlan 3 vlanif bce0

and reboot, but that yielded the same result. I assigned 192.168.0.2 to vlan3 via ifconfig vlan3 192.168.0.2 netmask 255.255.255.0 and I got the same result.

I wasn't sure if lack of other vlans were interfering so I created ifconfig.vlan1 - ifconfig.vlan3 and then rebooted:

/etc/ifconfig.vlan1:

create
vlan 1 vlanif bce0 up

/etc/ifconfig.vlan2:

create
vlan 2 vlanif bce0 up

/etc/ifconfig.vlan3:

create
vlan 3 vlanif bce0 up

But I got the same result. I assigned vlan3 192.168.0.2, but the result was the same.

I tried creating a tap (ifconfig tap0 create) and then assigning it 192.168.0.2 then creating vlan3 (I destroyed vlan3 before hand) and then doing ifconfig vlan 3 vlanif tap up, but result was the same.

Here's a snippet of if I go back to the /etc/ifconfig.vlan1-3 files with no ip assigned to any vlan interface and tcpdump -vv -e vlan and then ping 192.168.0.2 from other vlans:

05:35:06.932765 90:a7:c1:b6:37:44 (oui Unknown) > Broadcast, ethertype 802.1Q (0x8100), length 60: vlan 3, p 0, ethertype ARP (0x0806), Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.0.2 tell 192.168.0.1, length 42
05:35:07.932679 90:a7:c1:b6:37:44 (oui Unknown) > Broadcast, ethertype 802.1Q (0x8100), length 60: vlan 3, p 0, ethertype ARP (0x0806), Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.0.2 tell 192.168.0.1, length 42

Here is raw tcpdump: https://web.archive.org/web/20220112142651/https://tmpfiles.org/dl/188092/tcpdumpout

I have ensured that my default route is 192.168.0.1.

I'm not sure if network interfaces are loaded in the wrong order or if there is a firewall/packet filter that's on by default that I'm not aware of, but I don't know what's wrong.


January 12, 2022

NetBSD General on DaemonForums Issues with XFCE
The default X on NetBSD 9.2 works fine for me, but I have some problems with XFCE. This is what I did to install and run XFCE:
Code:

$ doas pkgin install xfce4
$ startxfce4

This is the problems I have when using XFCE:
  • Firefox crashes very often.
  • XFCE displays a crosshatched background and a mouse cursor after each reboot. I have to delete ~/.config/xfce4 to restore the default panels.
Can anyone help me fix the issues?
The NetBSD Foundation pkgsrc-2021Q4 released

January 08, 2022

Benny Siegert The BulkTracker Outage
I have been running the BulkTracker web app for keeping track of pkgsrc bulk package build results since about 2015. After running without problems since the start (!!), the BulkTracker app had its first outage in November of 2021. It turns out that the function that renders the home page returns a 500 if it gets an error from Datastore. The error that was returned was: rpc error: code = ResourceExhausted desc = Quota exceeded.

January 03, 2022

Frederic Cambus Toolchains adventures - Q4 2021
My continuous journey into toolchains, in the fourth quarter of 2021

This is the third post in my toolchains adventures series. Please read the introduction and the Q3 2021 report if you want to get more context about this journey.

The fourth quarter of 2021 started out in the best possible way, as I’ve been granted commit access to the LLVM project on October 1st.

During the first part of October, I did commit a couple of micro-optimizations to several compiler drivers along with small improvements in various places, as highlighted in the commit list at the end of this post.

At the end of the month, I attended the OpenBSD h2k21 hackathon in Gouveia, Portugal.

During the hackathon, I spent some time doing builds of LLVM from our base system to do measurements and evaluate if it could make sense to build our toolchain with ThinLTO optimizations enabled. While full LTO builds would be out of the question as our developers regularly build snapshots of the base system (and often on laptops), ThinLTO typically achieves a good compromise between optimizations and resources usage.

Unfortunately, my experiment didn’t prove conclusive, and I quickly grew tired of waiting hours between each run to check the results. I used LLVM 11.1.0 at the time, and retesting more recently with LLVM 13.0.0 on a 4 CPUs virtual machine with 16GB of RAM gave similar results. Running time make -j4 in /usr/src/gnu/usr.bin/clang after applying modifications to enable building with ThinLTO resulted in a 7.3% increase in build time. Then, using the newly built ThinLTO optimized toolchain, I rebuilt an optimized LLVM again and the build was only 1.1% faster than the previous run.

Those preliminary benchmarks only measuring build time make me think there is little point in enabling ThinLTO alone at this time, and that it should be coupled with PGO (Profile-guided optimization) to be worth considering.

For the record, I used the following diff to rebuild LLVM in base:

Index: gnu/usr.bin/clang/Makefile.inc
===================================================================
RCS file: /cvs/src/gnu/usr.bin/clang/Makefile.inc,v
retrieving revision 1.25
diff -u -p -r1.25 Makefile.inc
--- gnu/usr.bin/clang/Makefile.inc	21 Aug 2021 03:00:02 -0000	1.25
+++ gnu/usr.bin/clang/Makefile.inc	24 Oct 2021 16:18:15 -0000
@@ -46,6 +46,11 @@ CXXFLAGS+=	-fomit-frame-pointer
 NOPIE_FLAGS=	-fPIE
 .endif
 
+# ThinLTO
+.if ${MACHINE_ARCH} == "amd64"
+CXXFLAGS+=	-flto=thin
+.endif
+
 CPPFLAGS+=	-D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS \
 		-D__STDC_FORMAT_MACROS

The next thing I did was checking usage of .gnu.warning.* sections in our C library. For an introduction to these sections, please refer to this article.

At the time of writing, libc functions for which we have .gnu.warning.* sections are:

.gnu.warning.strcpy:
	strcpy() is almost always misused, please use strlcpy()
.gnu.warning.stpcpy:
	stpcpy() is dangerous; do not use it
.gnu.warning.wcscat:
	wcscat() is almost always misused, please use wcslcat()
.gnu.warning.sprintf:
	sprintf() is often misused, please use snprintf()
.gnu.warning.tempnam:
	tempnam() possibly used unsafely; consider using mkstemp()
.gnu.warning.vsprintf:
	vsprintf() is often misused, please use vsnprintf()
.gnu.warning.mktemp:
	mktemp() possibly used unsafely; consider using mkstemp()
.gnu.warning.strcat:
	strcat() is almost always misused, please use strlcat()
.gnu.warning.wcscpy:
	wcscpy() is almost always misused, please use wcslcpy()
.gnu.warning.rand_r:
	rand_r() is not random, it is deterministic.
.gnu.warning.rand:
	rand() may return deterministic values, is that what you want?
.gnu.warning.getwd:
	getwd() possibly used unsafely; consider using getcwd()
.gnu.warning.random:
	random() may return deterministic values, is that what you want?
.gnu.warning.tmpnam:
	tmpnam() possibly used unsafely; consider using mkstemp()

Support for emitting linker warnings when using a symbol for which a .gnu.warning.symbol section exists is implemented in GNU linkers (ld and gold), but currently not in LLVM’s LLD linker. Since we switched to LLD as the default linker on most of OpenBSD architectures, those warnings are not emitted anymore for a majority of users.

I thus sent a diff to remove mentions of ld warning messages for the mktemp(3), tmpnam(3), and tempnam(3) manual pages, but it was suggested that we should instead try to get LLD to support this feature instead. After discussing the matter with other developers during h2k21, this is indeed the consensus.

On the last day of the hackathon, I packaged elfcat, which is a neat ELF visualizer generating interactive HTML files from ELF binaries.

In November, I built gwcheck, a small tool to display .gnu.warning.* sections names in ELF objects along with their content, in order to check which other projects used them. So far, aside from OpenBSD, it turned out that FreeBSD, NetBSD, and DragonFly all use these sections in their libc, and that glibc, Newlib, diet libc, uClibc do as well. I then added a comment about my findings in the LLVM bug tracker issue about adding support in LLD to generate linker warnings when encountering them.

Regarding LLVM itself, I added support in llvm-readobj for reading ELF core notes for both OpenBSD and NetBSD. Notes generated in those core files provide additional information about the kernel state and CPU registers. These notes are described in the core(5) manual pages for each of those operating systems. Here is a link to the OpenBSD version, and here is one for the NetBSD counterpart.

I have not much to report in Pkgsrc land for this quarter, the only toolchains related commit I got the chance to make was for updating the mold linker to the 1.0.0 version.

That’s all for now. I absolutely would like to continue exploring the topic, but I feel there is only so much I can do on my free time. Maybe I should start considering working in the field full-time?

LLVM commits:

2021-12-20 f6ba5c4 [llvm-readobj] Check ELFType value first when checking for OpenBSD notes
2021-11-29 878ff1f [llvm-readobj] Add support for machine-independent NetBSD ELF core notes
2021-11-24 69deb13 [clang][scan-build] Use cc/c++ instead of gcc/g++ on FreeBSD
2021-11-02 6503117 [llvm-readobj] Add support for reading OpenBSD ELF core notes
2021-10-30 6ecd4a4 [clang][scan-build] Use uname -s to detect the operating system
2021-10-21 b471e25 [clang] Support __float128 on DragonFlyBSD
2021-10-21 9635b29 [docs] Fix broken link rendering in the LLVM Coding Standards
2021-10-16 4d7c7d8 [docs] Mention DragonFlyBSD as a supported platform for LLVM
2021-10-15 ecef035 [Driver][NetBSD] Use Triple reference instead of ToolChain.getTriple()
2021-10-14 8ecbcd0 [Driver][Darwin] Use T reference instead of getToolChain().getTriple()
2021-10-14 f7a3214 [Driver][WebAssembly] Use ToolChain reference instead of getToolChain()
2021-10-09 6417260 [Driver][OpenBSD] Use ToolChain reference instead of getToolChain()
2021-10-08 1f90b36 [Driver][NetBSD] Use ToolChain reference instead of getToolChain()
2021-10-06 f0ffff4 [CMake] Fix typo in error message for LLD in bootstrap builds