Hi,
A while back I was asking around about getting DSLstats running on FreeBSD. I'd got as far as building it from source successfully and got the MDWS uploading working and was looking into getting it packaged up for installation via FreeBSD Ports system.
However, that turned out to be rather complex, and I wasn't sure I'd have the free time to act as the port maintainer in future.
Since then, there's been success making DSLstats available as a Docker container. That's great if you're already using Docker on your FreeBSD system. But, if you'd like to keep things 'slim', or your machine isn't meaty enough for the job, here's an alternative.
BackgroundFreeBSD has the ability to load 'personalities' via kernel modules. These modules act as an abstraction, making FreeBSD's kernel appear to be a different OS to selected software.
Alongside the kernel module, FreeBSD also provides a subset of Linux's 'user-land' libraries.
If we activate the Linux kernel module and install the relevant Linux libraries, DSLstats will run perfectly well on FreeBSD!
PrerequisitesThis guide assumes that you have a working FreeBSD installation, including an Xorg-based windowing system. If you want to run the machine headless, I'd suggest using the
xrdp package. This will let you use a Remote Desktop client on another machine to access a virtual X session for DSLstats to run within.
Also, the guide will list the steps I took to get DSLstats running on a FreeBSD 11.1 system. I'll update this with info regarding 10.x systems when I get a chance to set up a virtual machine for testing. The steps should be very similar if not identical, so feel free to have a try and post feedback if you're running 10.x and feeling adventurous!
Also, this is using the
32 Bit version of DSLstats. I'm seeing some odd behaviour with the 64-bit version which I've not yet sorted. However, the 32-bit version works fine on my 64-bit FreeBSD 11.1 system.
Enabling Linux EmulationFirst, take a look to see if the linux kernel module is already loaded. From a terminal prompt, issue the
kldstat command:
% kldstat
Id Refs Address Size Name
1 39 0xffffffff80200000 1f67a88 kernel
2 1 0xffffffff82223000 3f18 amdtemp.ko
3 1 0xffffffff82421000 2018f1 zfs.ko
4 1 0xffffffff82623000 9aea opensolaris.ko
5 1 0xffffffff8262d000 5936 fdescfs.ko
6 1 0xffffffff82633000 3650 ums.ko
7 1 0xffffffff82637000 34d5c pf.ko
8 1 0xffffffff826b4000 bb55 tmpfs.koIf you don't see any mention of 'linux' here, continue through this section to install it. Otherwise, skip to the next section.
Load the linux kernel module:
sudo kldload linuxRun kldstat again to check that they've loaded correctly:
% kldstat
Id Refs Address Size Name
1 39 0xffffffff80200000 1f67a88 kernel
2 1 0xffffffff82169000 abe00 linux.ko
3 4 0xffffffff82215000 df88 linux_common.ko
4 1 0xffffffff82223000 3f18 amdtemp.ko
5 1 0xffffffff82421000 2018f1 zfs.ko
6 1 0xffffffff82623000 9aea opensolaris.ko
7 1 0xffffffff8262d000 5936 fdescfs.ko
8 1 0xffffffff82633000 3650 ums.ko
9 1 0xffffffff82637000 34d5c pf.ko
10 1 0xffffffff826a9000 a877 linprocfs.ko
11 1 0xffffffff826b4000 bb55 tmpfs.koNow, to make sure these load whenever the machine reboots, add the following to your /etc/rc.conf file:
linux_enable="YES"To make sure the system looks as 'linux-y' as possible, we need to mount a couple of locations into the filesystem. Edit your /etc/fstab file and add the following two lines to the end:
linprocfs /compat/linux/proc linprocfs rw 0 0
tmpfs /compat/linux/dev/shm tmpfs rw,mode=1777 0 0...then run these commands to actually mount the two locations:
sudo mount /compat/linux/proc
sudo mount /compat/linux/dev/shm
Install LibrariesThere are a few packages to install to get DSLstats running. Run each of these commands in succession to install these:
sudo pkg install linux_base-c7
sudo pkg install linux-c7-xorg-libs
sudo pkg install linux-c7-xorg-libs
sudo pkg install linux-c7-gdk-pixbuf2
sudo pkg install linux-c7-libpng
The first package there is the base linux environment - based on CentOS 7 (hence the 'c7'). The rest are dependencies needed by DSLstats (and many other GUI-based applications).
Download & Run DSLstatsDownload DSLstats from
dslstats.me.ukChoose the 32-bit Linux version.
Once downloaded, extract the archive file. Personally, I like to rename the resulting folder to simply 'dslstats'. I'll assume you've done the same, and that the folder is in your home directory. Feel free to move it elsewhere (/usr/local/ is probably the best place).
Back at a terminal, change to the dslstats directory:
cd ~/dslstatsNow, we need to 'brand' the executables to tell FreeBSD that these are Linux binaries that it should run within the Linux environment:
brandelf -t Linux dslstats
brandelf -t Linux upload17.l32
Now, assuming you're using a terminal prompt inside your GUI (X) session, start DSLstats now!
./dslstatsNOTE: You may get some errors/warnings about the location of 'curl' -- and maybe even some unhandled exception messages. I found that this happened on first launch, but if I hit Ctrl+C in the terminal window and relaunched, the exception messages stopped.
Setting Up DSLstatsSet up DSLstats as normal, but there's one setting you'll need to change if you're uploading to MDWS - the
Path to curl executable.
Under the
Configuration -> MyDSLWebStats tab, set the
Path to curl executable to
/usr/local/bin/curl.
Remember to untick and re-tick the
Upload data to MyDSLWebStats for the change to take effect.
You're Done! Please leave any feedback for corrections, etc. and I'll investigate/update as needed.
I hope this is helpful to some people!
To-DoI currently run DSLstats in an xrdp virtual session. This is great because my machine's headless and I only need the most minimal of GUI environments for DSLstats. Unfortunately it means I must remote-desktop into the machine and re-launch DSLstats should it ever reboot. I need to find a way in the xrdp/x session configuration to get it to create a session and launch DSLstats automatically at startup.