Announcement

Collapse
No announcement yet.

How to set up a feeder on Windows 10/11 using Windows Subsystem for Linux

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to set up a feeder on Windows 10/11 using Windows Subsystem for Linux

    I was inspired to write this post by, "How to set up a feeder using 64-bit Ubuntu Linux on Intel platform".

    Like the author of that post, I wanted to set up a feeder, but not on an RPi. Not that I have any issues with RPi, but I already have too many computers and I don't want another one, solely for a feeder. I also don't want to repurpose a computer that's currently running Windows to Linux.

    Ultimately, I will probably move this feeder to a Linux VM on a Hyper-V server, because there are some limitations inherent with WSL and I already have a Hyper-V server. I started with WSL because I wanted to be sure I could overcome the USB limitation that Hyper-V and WSL both share.

    Since I have an FR24 feeder that's been running continuously for almost a month, I thought I would share my results with this community in case someone else wants to try it.

    The configuration is the following:
    • Windows 10 Version 22H2 64-bit
    • WSL Version 2
    • Ubuntu 22-04 LTS
    • usbipd-win
    • fr24feed-debian-ubuntu-amd64-i386
    • Rafael Micro R820T2
    If you don't know anything about WSL, it enables running Linux literally "inside" a Windows computer. Although WSL is based on Linux running inside a VM, it doesn't behave like a normal VM. WSL is accessible from inside a PowerShell or CMD window. You can execute Linux commands from a Windows prompt or Windows commands from a Linux (bash) prompt.

    One of the limitations of WSL is that it doesn't natively support USB. Support for USB is provided by usbipd-win.

    If you want to know more about WSL here are some references:

    Windows Subsystem for Linux Documentation

    Issues found on WSL. Contribute to microsoft/WSL development by creating an account on GitHub.


    DISCLAIMER: This post is not a tutorial on WSL, Linux, usbipd-win or fr24feed and I'm writing this from memory. I recommend that you read the references before you start.

    If you try this procedure and encounter a problem, feel free to post your comments / questions and I will do my best to answer them and / or update this post if necessary.

    There are two versions of WSL. I'm using WSL 2. I did not try to see if this would work on WSL 1.

    PREREQUISITES:

    WSL 2 is only available in Windows 11 or Windows 10 version 2004 and higher (Build 19041 and higher). Check your Windows version by selecting the Windows logo key + R, type winver, select OK.

    As WSL is based on Hyper-V, the processor must support virtualization and virtualization must be enabled in the BIOS.

    [PART 1 OF 4]​

  • #2
    Step 1. Install WSL.

    You can install WSL using the Control Panel / Programs and Features / Windows Features or from the command line or from the Microsoft Store. The version of software that is installed by the command line and Microsoft store is not tied to Windows Updates, so it's preferable.

    Here is the Windows command to install WSL:
    Code:
    wsl --install
    By default, Ubuntu is installed. If you want to pick a distro, use this Windows command to list the available options:
    Code:
    wsl --list --online
    Install WSL with the distro of your choice using the following Windows command:
    Code:
    wsl --install -d <Distribution Name>
    Pick whatever distro you're comfortable with, but note that I only tried Ubuntu 22-04 LTS.

    To start WSL, open a window using this Windows command:
    Code:
    wsl ~
    The reason for ~ is to set the current directory in the Linux home directory of the user, not in the Windows home directory. It's especially important to remember where the current directory is when you are running as root.

    At this point, I also updated the distro using these Linux commands.
    Code:
    sudo apt-get update
    sudo apt-get upgrade
    Before you proceed, take a few minutes to read how WSL works, because there are some subtle differences compared to running Linux on the metal or in a VM.

    One thing that's strange about WSL is that it doesn't shutdown and reboot exactly like a stand-alone computer running Linux.

    If you need to reboot it, you first exit the open windows.

    Then you shut it down using this Windows command:
    Code:
    wsl --shutdown
    To reboot, just open a window.

    Here is a link to more reading on the topic:
    How to install Linux on Windows with WSL
    Install Windows Subsystem for Linux with the command, wsl --install. Use a Bash terminal on your Windows machine run by your preferred Linux distribution - Ubuntu, Debian, SUSE, Kali, Fedora, Pengwin, Alpine, and more are available.


    [PART 2 OF 4]​
    Last edited by bimmerdriver; 2024-02-18, 06:03.

    Comment


    • #3
      Step 2. Install usbipd-win.

      Here is the Windows command to install usbipd-win:
      Code:
      winget install usbipd
      Here is a link to more reading on the topic:
      Connect USB devices
      Learn how to connect a USB device to your WSL 2 Linux distribution using usbipd-win.



      Now, connect your receiver and open Windows Command prompt in Administrator mode.

      Here is the Windows command to see a list of usb devices on your computer:
      Code:
      usbipd list
      You should see your device in the list. Note the BUSID of your device.

      To attach the usb device to WSL, here are the Windows commands:
      Code:
      usbipd bind --busid=<BUSID>
      usbipd attach --wsl --busid=<BUSID>
      WSL must be running for the attach command to work.

      To verify that your device is attached to WSL, use this Windows command:
      Code:
      usbipd list
      To verify that the device is attached to WSL, use this Linux command:
      Code:
      lsusb
      At this point, you are ready to install the feeder, but take note that you must reattach the receiver every time you reboot WSL (or the computer). (You don't have to rebind it. It will stay bound.) The practical implication of this is that when you reboot WSL, the feeder software will start but without the receiver connected, so you have to restart the software after you reattach the receiver to WSL.

      [I'm going to investigate if it's possible to create a service to reattach the receiver before the other services start. I will update this post when / if I find a solution to this issue.]

      [PART 3 OF 4]
      Last edited by bimmerdriver; 2024-02-18, 06:05.

      Comment


      • #4
        Step 3. Install fr24feed.

        Install dump1090-fa:
        Code:
        sudo bash -c "$(wget -O - https://github.com/abcd567a/fr24feed-debian-ubuntu-amd64-i386/raw/master/install-dump1090-fa.sh)"
        Install fr24feed:
        Code:
        wget https://repo-feed.flightradar24.com/linux_binaries/fr24feed_1.0.46-1_amd64.deb
        sudo dpkg -i fr24feed_1.0.46-1_amd64.deb
        Configure fr24feed:
        Code:
        sudo fr24feed --signup
        Here is a link to the packages and the installation procedure for the feeder and associated software:
        FlightRadar24 data feeder installation script for Debian 9 & 10 amd64 / Ubuntu 18.04 amd64 on 64bit Intel CPU - GitHub - abcd567a/fr24feed-debian-ubuntu-amd64-i386: FlightRadar24 data feeder i...


        Special thanks to abcd567​ for answering many questions and also for providing the above link to the ​packages and installation procedure.

        [PART 4 OF 4]​

        Comment


        • #5
          Thanks for your instructions and help!
          I am trying to start a feeder on my laptop runing WSL2 and Ubuntu 22.04
          I followed instructions, but I am stuck at the last step. I can not execute fr24feed and dump1090.
          I get the message:

          Code:
          System has not been booted with systemd as init system (PID 1). Can't operate.
          Failed to connect to bus: Host is down
          It is the same for both fr24feed and dump1090 when using systemctl

          I did some searching and it seems that in WSL2 systemd should be supported, but all the instructions and fixes that I found are not working.
          Please help ... what am I missing?​

          Comment


          • #6
            It's been a while since I updated this thread, so an update is overdue. I've been feeding to FR24 since January 24th and to FA (including MLAT) since March 4th.

            I had problems feeding to FR24, which I reported in a separate thread. It would stop uploading in the late evening and would not resume uploading until 12-14 hours later (the next day). This problem seems to be have been caused by time synchronization issues. Since I enabled systemd-timesyncd to use ntp, fr24feed has been uploading continuously (almost 2 weeks). The only interruptions have been to install updates on the desktop computer that's hosting WSL and on the Hyper-V server that's hosting my router. There are still time synchronization issues, but I think this is related to the way fr24feed is using NTP. I'm still investigating this.

            Based on how it's been working, I think WSL2 a viable alternative to using an RPi. The only thing that's somewhat annoying is that there is no way to automatically attach the SDR USB to the VM at boot time. It has to be manually attached. However, as long as you don't unplug the USB or reboot the computer (or the VM), it stays attached. I plan to automate this, but I haven't had a chance get it done.

            Comment


            • #7
              Originally posted by kkomarica View Post
              Thanks for your instructions and help!
              I am trying to start a feeder on my laptop runing WSL2 and Ubuntu 22.04
              I followed instructions, but I am stuck at the last step. I can not execute fr24feed and dump1090.
              I get the message:

              Code:
              System has not been booted with systemd as init system (PID 1). Can't operate.
              Failed to connect to bus: Host is down
              It is the same for both fr24feed and dump1090 when using systemctl

              I did some searching and it seems that in WSL2 systemd should be supported, but all the instructions and fixes that I found are not working.
              Please help ... what am I missing?​
              You are right that systemd is supported. I'm kind of surprised you are having this problem. I've done a clean installation a couple of times and not had this problem, so I'm wondering how you installed it.

              First, what version of Windows are you running? It needs to be up to date. I'm running 22H2.

              Did you use the command line:

              Code:
              wsl --install
              If so, then try updating it:

              Code:
              wsl --update
              After that, check the version:

              Code:
              wsl --version
              Here is the output from my system:

              Code:
              >wsl --version
              WSL version: 2.1.5.0
              Kernel version: 5.15.146.1-2
              WSLg version: 1.0.60
              MSRDC version: 1.2.5105
              Direct3D version: 1.611.1-81528511
              DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
              Windows version: 10.0.19045.4170


              After that, make sure your distro is up to date.

              Code:
              >wsl --list --verbose
              NAME STATE VERSION
              * Ubuntu-22.04 Running 2


              Run the following commands:

              Code:
              sudo apt-get update
              sudo apt-get upgrade
              sudo apt-get dist-upgrade
              sudo apt-get autoremove
              sudo apt-get autoclean
              If you're still having the problems then uninstall the distro and reinstall it.

              Comment


              • #8
                @kkomarica​ I found this link, which further makes me think your system is not up-to-date:

                Learn how to use systemd to manage Linux services with Windows Subsystem for Linux.

                Comment


                • #9
                  I have tried everything that it's written here, but no luck. The issue remains.
                  I have made several reinstalls following all the instructions.
                  Everything is up to date, except the windows 10. I have 21H2 version 19044.1566
                  I don't like updating windows, but if you think that the slightly older version could be the problem, I will give it one last try.​

                  Comment


                  • #10
                    Originally posted by kkomarica View Post
                    I have tried everything that it's written here, but no luck. The issue remains.
                    I have made several reinstalls following all the instructions.
                    Everything is up to date, except the windows 10. I have 21H2 version 19044.1566
                    I don't like updating windows, but if you think that the slightly older version could be the problem, I will give it one last try.​
                    That's really strange. If you're running 21H2, it should be sufficient. I'm using 22H2 build 19045.4170.

                    Please confirm you installed wsl using wsl --install and not using the control panel.

                    Please run the following commands and post the output:

                    wsl -- version
                    wsl --list --verbose

                    Please show the contents of /etc/wsl.conf.

                    Comment


                    • #11
                      Like Borat would said: GREAT SUCCESS!
                      Feeder is up an running, using WSL2 .
                      Big thanks bimmerdriver for all the help!


                      It seems that in the older version of windows I could not update the WSL kernel to the level needed to support systemd.
                      After windows update, I could update WSL to the latest version and now it's working.

                      How can I accesses the dump-fa status/map when using wsl ... how can I see the IP address of the wsl virtual machine?
                      Last edited by kkomarica; 2024-03-23, 09:25.

                      Comment


                      • #12
                        Originally posted by kkomarica View Post
                        Like Borat would said: GREAT SUCCESS!
                        Feeder is up an running, using WSL2 .
                        Big thanks bimmerdriver for all the help!


                        It seems that in the older version of windows I could not update the WSL kernel to the level needed to support systemd.
                        After windows update, I could update WSL to the latest version and know it's working.

                        How can I accesses the dump-fa status/map when using wsl ... how can I see the IP address of the wsl virtual machine?
                        That's great news! I'm glad to hear you got it working.

                        If you want to know the ip address of the WSL VM, the command is:

                        CODE]wsl hostname -I[/CODE]

                        You can access the dump1090-fa map using

                        <ip>/skyaware/
                        <ip>:8754

                        You can also use 127.0.0.1 or localhost, rather than the actual address.

                        FYI, I started working on a systemd service to attach the USB SDR at boot, before dump1090-fa starts. When I get it working, I'll share it here.

                        I'm also wrestling with fr42feed messing with the system clock. I might try setting up a local ntpd on the VM. Again, I'll post about that if it helps.

                        Comment


                        • #13
                          Originally posted by bimmerdriver View Post

                          FYI, I started working on a systemd service to attach the USB SDR at boot, before dump1090-fa starts. When I get it working, I'll share it here.
                          This will be great. Waiting for you to get it working and share

                          I have created a batch file "Start-WSL.bat" and saved it on Desktop.
                          When I want to start wsl, I right-click it and choose "run as administrator"
                          This batch file not only starts wsl, but also attaches the DVB-T Dongle to wsl.

                          The contents of this batch file are as follows:

                          Code:
                          wsl
                          powershell -Command "& {usbipd bind --hardware-id 0bda:2838; usbipd attach --wsl --hardware-id 0bda:2838}"


                          LATER EDIT (March 23, 2024):
                          I found that the comands given above for the batch file do NOT work reliably. Sometimes the DVB-T will be attached, and sometime NOT attached. I have now completely changed the code and it seems to work reliably. The revised code for batch file "Start-WSL.bat" is given below:

                          Code:
                          start wsl
                          timeout 2
                          usbipd bind --hardware-id 0bda:2838
                          usbipd attach --wsl --hardware-id 0bda:2838
                          exit​

                          Please note that if you want to log the stderr & stdout when batch file is run, then use following code in the batch file. You have to give log file's location. I have used C:\Users\abcd\Documents\wsl-log.txt

                          Code:
                          start wsl
                          timeout 2
                          usbipd bind --hardware-id 0bda:2838 > C:\Users\abcd\Documents\wsl-log.txt 2>&1
                          usbipd attach --wsl --hardware-id 0bda:2838 >> C:\Users\abcd\Documents\wsl-log.txt 2>&1
                          exit​


                          The contents of log file are as follows:

                          Code:
                          usbipd: info: Device with hardware-id '0bda:2838' found at busid '1-14'.
                          usbipd: info: Device with busid '1-14' was already shared.
                          usbipd: info: Device with hardware-id '0bda:2838' found at busid '1-14'.
                          usbipd: info: Using WSL distribution 'Ubuntu' to attach; the device will be available in all WSL 2 distributions.
                          usbipd: info: Using IP address 172.19.80.1 to reach the host.
                          
                          ​


                          The cmd window opened by running the batch file as administrator


                          wsl-started-by-batch-file.png
                          Last edited by abcd567; 2024-03-23, 20:28.

                          Comment


                          • #14
                            Originally posted by kkomarica View Post
                            I have tried everything that it's written here, but no luck. The issue remains.
                            I have made several reinstalls following all the instructions.
                            Everything is up to date, except the windows 10. I have 21H2 version 19044.1566
                            I don't like updating windows, but if you think that the slightly older version could be the problem, I will give it one last try.​

                            Just to report back after a few days ... everything is running without problems.
                            The only thing that I don't know how to setup is MLAT ... it just says "not running"
                            I have read posts here that one should not be concerned about MLAT in FR24, but I would really like to locate some local traffic (helicopters and small planes).
                            My geographical position is on the other side of the hill from the majority of other receivers and I believe that I could help in MLAT calculations.

                            Comment


                            • #15
                              @kkomarica

                              FR24 has said that:

                              (1) MLAT is allowed only if in fr24feed settings, you select "receiver =dvbt". This means dump1090-mutability will be installed, and you will have to remove dup1090-fa or readsb if you have it already installed.

                              (2) If you are feeding other sites as well from your receiver, then you should disable mlat in fr24feed settings.

                              Comment

                              Working...
                              X