How to fold on NetBSD

FAH provides a V7 client installer for Debian / Mint / Ubuntu / RedHat / CentOS / Fedora. Installation on other distros may or may not be easy but if you can offer help to others, they would appreciate it.

Moderators: Site Moderators, FAHC Science Team

Post Reply
Hopfgeist
Posts: 70
Joined: Thu Jul 09, 2020 12:07 pm
Hardware configuration: Dell T420, 2x Xeon E5-2470 v2, NetBSD 10, SunFire X2270 M2, 2x Xeon X5675, NetBSD 9; various other Linux/NetBSD PCs, Macs and virtual servers.
Location: Germany

How to fold on NetBSD

Post by Hopfgeist »

My Unix system of choice has been NetBSD for a long time, for a variety of reasons, both technical and historical.

NetBSD has a capable Linux emulation layer, and with the right libraries installed, can run the Folding at Home client with some restrictions.

To follow these instructions you should have a basic grasp of:
- how to build and install a custom kernel or how to load kernel modules
- how to install packages from pkgsrc
- how to unpack archives into a file system from the command line
- how execute commands from the command line, and redirect output

I use "$" to represent a shell prompt for an unprivileged user,
I use "#" to represent a shell prompt for the superuser (root).


What works:
- downloading the folding core
- CPU-folding (scheduled to maximum "nice"-ness, as it should be), full SMP support: I personally run it on a machine with 24 CPU threads.
- downloading and uploading work units

So the basic functionality is there. Finished work units are counted and are displayed in the statistics, properly attributed to your user and team ID (provided you have a passkey).

What doesn't work:
- GPU folding (having no supported GPU I cannot definitively say that, but it seems unlikely.)
- Remote control of the client (neither via http nor using the proprietary protocol). This is likely caused by an incomplete or incorrect mapping of a Linux syscall to the equivalent NetBSD syscall.

EDIT: The long-standing problem in NetBSD preventing this from working has now been fixed in the main source tree. As soon as the fix is rolled out for NetBSD releases, it should be possible to control FAHClient on NetBSD with FAHControl running anywhere.


How to install:

- Kernel with Linux emulation
You need a kernel with Linux emulation enabled. On NetBSD-9, which is the current stable release, either build a custom kernel with Linux emulation enabled explicitly or add the appropriate kernel modules to /etc/modules.conf and add "modules=YES" to /etc/rc.conf to have them loaded before entering multi-user operation.

- Install Linux libraries and tools
The easiest way to do this is to install all the SuSE-13 libraries from the meta-pkg. I rarely install binary packages using pkg_add, so I will describe my preferred way for installing them from pkgsrc directly. This will probably have to be done with superuser-privileges:

Code: Select all

# cd /usr/pkgsrc/meta-pkgs/suse131/
# make update
This will populate the /emul/linux filesystem, so make sure there is enough room under that path if you only have a small root (/) partition.
It will install much more (around 1 GB) than is required to run the FAH client, so you may choose to install only select packages from /usr/pkgsrc/emulators/suse131_*, but I cannot tell you exactly which ones are required.


- Install the FAH client
Download the normal Linux client, I found that downloading and unpacking the .deb package was the most straightforward. The client itself is exactly the same for all versions.

create a directory and unpack the client using "ar", which will extract ".deb" packages into its components, which is one data.tar.xz and one control.tar.xz archive:

Code: Select all

$ mkdir fah-install
$ cd fah-install
$ ar x fahclient_7.6.13_amd64.deb
All these steps can be done as a normal user. For the next step you may want to install it directly into /emul/linux , which requires superuser privileges. It may run if you install it into a local directory, but then it may not find the corewrapper, unless you also set appropriate paths. So in my example I will install it globally:

Code: Select all

# cd /emul/linux
# tar zxpf <path to data.tar.xz>
- Test the client to see if it runs.

Next make sure that you are familiar with the FAHClient command-line switches, since using a graphical frontend to control the client is not working on NetBSD. To check that the client works and to see what the options are, try running it (as a normal user!) with the help option:

Code: Select all

$ /emul/linux/usr/bin/FAHClient --help
I have written a small wrapper-script to call the FAHClient with the appropriate parameters (working directory, username, passkey, team-id, smp configuration, etc.). If you don't know how to do that, folding on NetBSD is probably not for you :)

Please correct me if I got something wrong, or ask if anything is unclear.

Cheers, and happy NetBSD-folding,
HG
Last edited by Hopfgeist on Wed Nov 04, 2020 9:07 am, edited 3 times in total.
Image
Dell PowerEdge T420: 2x Xeon E5-2470 v2
MeeLee
Posts: 1339
Joined: Tue Feb 19, 2019 10:16 pm

Re: How to fold on NetBSD

Post by MeeLee »

Buy a GT 730. They're ridiculously slow, but you can usually find them for $25 on ebay.
If you can make the Nvidia drivers, and OpenCL drivers work on that, it's guaranteed that it'll work on bigger GPUs, as GT/GTX 700 series use the same drivers as the RTX GPUs.
Hopfgeist
Posts: 70
Joined: Thu Jul 09, 2020 12:07 pm
Hardware configuration: Dell T420, 2x Xeon E5-2470 v2, NetBSD 10, SunFire X2270 M2, 2x Xeon X5675, NetBSD 9; various other Linux/NetBSD PCs, Macs and virtual servers.
Location: Germany

Re: How to fold on NetBSD

Post by Hopfgeist »

Addendum:

There was a long-standing bug in the parameter mapping for some system calls in the Linux-Emulation layer in NetBSD. Some of those have now been fixed, most notably setting the socket receive timeout. The fix has been commited to the main source tree, but has not (yet) been backported to the main release versions (8.x, 9.1). If you know how to patch kernel files, a short stopgap-fix is available attached to the corresponding bug report:

Code: Select all

--- sys/compat/linux/common/linux_socket.c.orig 2020-11-03 17:27:47.055555944 +0100
+++ sys/compat/linux/common/linux_socket.c      2020-11-03 18:28:20.184244766 +0100
@@ -884,6 +884,10 @@
                return SO_SNDLOWAT;
        case LINUX_SO_RCVLOWAT:
                return SO_RCVLOWAT;
+       case LINUX_SO_RCVTIMEO:
+               return SO_RCVTIMEO;
+       case LINUX_SO_SNDTIMEO:
+               return SO_SNDTIMEO;
        case LINUX_SO_KEEPALIVE:
                return SO_KEEPALIVE;
        case LINUX_SO_OOBINLINE:
This now makes the Linux client fully functional on NetBSD, including remote control via FAHControl.
:D

Some more backstory: up to and including Client 7.6.13, the socket "receive timeout" option was only set for the remote control interface. Starting with Client Version 7.6.20, the same option was also set for the sockets used for downloading and uploading work units, making 7.6.20+ completely unusable on NetBSD. That's when I finally decided that NetBSD needed to be fixed, so I dug around in the appropriate kernel source files, found the problem, and here we are.

You are welcome.

Cheers,
HG.
Image
Dell PowerEdge T420: 2x Xeon E5-2470 v2
PantherX
Site Moderator
Posts: 6986
Joined: Wed Dec 23, 2009 9:33 am
Hardware configuration: V7.6.21 -> Multi-purpose 24/7
Windows 10 64-bit
CPU:2/3/4/6 -> Intel i7-6700K
GPU:1 -> Nvidia GTX 1080 Ti
§
Retired:
2x Nvidia GTX 1070
Nvidia GTX 675M
Nvidia GTX 660 Ti
Nvidia GTX 650 SC
Nvidia GTX 260 896 MB SOC
Nvidia 9600GT 1 GB OC
Nvidia 9500M GS
Nvidia 8800GTS 320 MB

Intel Core i7-860
Intel Core i7-3840QM
Intel i3-3240
Intel Core 2 Duo E8200
Intel Core 2 Duo E6550
Intel Core 2 Duo T8300
Intel Pentium E5500
Intel Pentium E5400
Location: Land Of The Long White Cloud
Contact:

Re: How to fold on NetBSD

Post by PantherX »

That's wonderful! Thanks for helping out the community :D
ETA:
Now ↞ Very Soon ↔ Soon ↔ Soon-ish ↔ Not Soon ↠ End Of Time

Welcome To The F@H Support Forum Ӂ Troubleshooting Bad WUs Ӂ Troubleshooting Server Connectivity Issues
Neil-B
Posts: 1996
Joined: Sun Mar 22, 2020 5:52 pm
Hardware configuration: 1: 2x Xeon E5-2697v3@2.60GHz, 512GB DDR4 LRDIMM, SSD Raid, Win10 Ent 20H2, Quadro K420 1GB, FAH 7.6.21
2: Xeon E3-1505Mv5@2.80GHz, 32GB DDR4, NVME, Win10 Pro 20H2, Quadro M1000M 2GB, FAH 7.6.21 (actually have two of these)
3: i7-960@3.20GHz, 12GB DDR3, SSD, Win10 Pro 20H2, GTX 750Ti 2GB, GTX 1080Ti 11GB, FAH 7.6.21
Location: UK

Re: How to fold on NetBSD

Post by Neil-B »

Hopfgeist wrote:Some more backstory: up to and including Client 7.6.13, the socket "receive timeout" option was only set for the remote control interface. Starting with Client Version 7.6.20, the same option was also set for the sockets used for downloading and uploading work units, making 7.6.20+ completely unusable on NetBSD. That's when I finally decided that NetBSD needed to be fixed, so I dug around in the appropriate kernel source files, found the problem, and here we are.
Now there is something in this that make me wonder if some of the more recent connection style issues people have been having with win/linux installations of current client link to this ... the short response errors or dropping out uploads/downloads where previously there have been no issues might possibly be linked to this I wonder?

I guess this change may have been to try and resolve the issue with connections hanging that has been around for a bit - maybe unintended consequence is that if set a bit aggressively it is just nerfing slow/spotty connections?
2x Xeon E5-2697v3, 512GB DDR4 LRDIMM, SSD Raid, W10-Ent, Quadro K420
Xeon E3-1505Mv5, 32GB DDR4, NVME, W10-Pro, Quadro M1000M
i7-960, 12GB DDR3, SSD, W10-Pro, GTX1080Ti
i9-10850K, 64GB DDR4, NVME, W11-Pro, RTX3070

(Green/Bold = Active)
Hopfgeist
Posts: 70
Joined: Thu Jul 09, 2020 12:07 pm
Hardware configuration: Dell T420, 2x Xeon E5-2470 v2, NetBSD 10, SunFire X2270 M2, 2x Xeon X5675, NetBSD 9; various other Linux/NetBSD PCs, Macs and virtual servers.
Location: Germany

Re: How to fold on NetBSD

Post by Hopfgeist »

Neil-B wrote: Now there is something in this that make me wonder if some of the more recent connection style issues people have been having with win/linux installations of current client link to this ... the short response errors or dropping out uploads/downloads where previously there have been no issues might possibly be linked to this I wonder?

I guess this change may have been to try and resolve the issue with connections hanging that has been around for a bit - maybe unintended consequence is that if set a bit aggressively it is just nerfing slow/spotty connections?
Possible. I think it complained that it was trying to set receive timeout to 30 seconds at socket level.

Code: Select all

07:14:56:WARNING:WU00:FS00:Failed to get ID from 'assign1.foldingathome.org:80': Could not set receive timeout to 30: Invalid argument
This was the error message I was receiving, prior to the NetBSD kernel fix, which can indeed be cutting it too close for congested/slow server connections.

Cheers,
HG
Image
Dell PowerEdge T420: 2x Xeon E5-2470 v2
Post Reply