NCS installation Linux

Hi,

I've already spent a lot of time on this issue. I develop on a Windows laptop. I need to run unit tests with Twister before committing to our repository. I can't do this on Windows because native_sim is not supported. I tried to setup the ncs toolchain on WSL2/ubuntu 24.04 LTS. I found many different install instruction but i failed. i've also tried to use the docker-image used in the CI of ncs-sample-application, but could not get it to work locally. Could you please write in simple sentences, what I need in what order to setup ncs to run twister unit test on native_sim on WSL2/Ubuntu? We have a free-standing application.

gcc-arm-none-eabi (which version)? zephyr-sdk? ncs-sdk? nrfutil? jlink? its really confusing.

Parents
  • Hi

    I would say the easiest way to install NCS in WSL is to use VScode

    Press CTRL+Shift+o to open the following menu

    Then connect to wsl and proceed to install NCS as you would in windows by installing the correct extensions and downloading the sdk

    When you have done this, you can continue to develop as normally only difference is that you are using windows. 

    If you are to connect a DK after you are done with your simulated board you will need to add usb passthrouch in wsl https://learn.microsoft.com/en-us/windows/wsl/connect-usb 

    Regards

    Runar

  • Hi, I didn't knew this way, thank you.

    When I follow the guide https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/app_dev/create_application.html

    and try to create a workspace application from the ncs-sample-application with  

    west init github.com/.../ncs-example-application my_sample

    it fails as 

    FATAL ERROR: already initialized in /home/me/ncs/v3.1.0, aborting.
    Note:
        In your environment, ZEPHYR_BASE is set to:
        /home/me/ncs/v3.1.0/zephyr

        This forces west to search for a workspace there.
        Try unsetting ZEPHYR_BASE and re-running this command.

  • When you are doing this, you are pulling down the entire ncs again and this can't be done inside a folder where you already have NCS. 

    To do this I would do the following (I will use command line commands to make it easier) inside wsl:

    # Launching a enviroment where west is loaded, switch version to your version
    nrfutil sdk-manager toolchain launch --ncs-version v3.1.1 --shell
    
    # Navigate to where you would like to create the workspace and make a folder
    mkdir folder_name
    cd folder_name
    
    west init -m https://github.com/nrfconnect/ncs-example-application --mr main my-workspace
    
    cd my-workspace
    
    west init
     

    Regards

    Runar

  • Hi, something is not working correctly with wsl and vs code nrf extension. i have a fresh Ubuntu 24.04 on WSL. I connect to remote via VS Code and install all extensions and 3.1.1 SDK and toolchain. When I create new application, it gets created but not opened. I see this error:

    2025-12-05 08:48:19.036 [error] Error: Unable to write file 'vscode-remote://wsl+ubuntu-24.04/home/.vscode/settings.json' (NoPermissions (FileSystemError): Error: EACCES: permission denied, mkdir '/home/.vscode')
  • I somehow made it work. However, flashing from the extension does not work with my workspace app (on windows):

    Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "C:\ncs\toolchains\c1a76fddb2\opt\bin\Scripts\west.exe\__main__.py", line 7, in <module> File "C:\ncs\toolchains\c1a76fddb2\opt\bin\Lib\site-packages\west\app\main.py", line 1199, in main app.run(argv or sys.argv[1:]) File "C:\ncs\toolchains\c1a76fddb2\opt\bin\Lib\site-packages\west\app\main.py", line 278, in run self.run_command(argv, early_args) File "C:\ncs\toolchains\c1a76fddb2\opt\bin\Lib\site-packages\west\app\main.py", line 584, in run_command self.run_extension(args.command, argv) File "C:\ncs\toolchains\c1a76fddb2\opt\bin\Lib\site-packages\west\app\main.py", line 739, in run_extension self.cmd.run(args, unknown, self.topdir, manifest=self.manifest, File "C:\ncs\toolchains\c1a76fddb2\opt\bin\Lib\site-packages\west\commands.py", line 200, in run self.do_run(args, unknown) File "C:\ncs-inter\zephyr\scripts\west_commands\flash.py", line 32, in do_run do_run_common(self, my_args, runner_args, domain_file=domains_file) File "c:\ncs-inter\zephyr\scripts/west_commands\run_common.py", line 241, in do_run_common for runner in runners_ext: TypeError: 'NoneType' object is not iterable

    I still have the impression, that workspace apps are not really well integrated with the extension, although you recommend it as project configuration.

  • Hi,

    I was asked to have a look at this case, since Runar is currently out-of-office.

    Ingfu said:
    I somehow made it work.

    Great!

    Ingfu said:
    However, flashing from the extension does not work with my workspace app (on windows)
    Ingfu said:
    I still have the impression, that workspace apps are not really well integrated with the extension, although you recommend it as project configuration.

    I have no intention to contradict you on that impression, but please note that running the extension from within WSL is not considered a target platform for us. There might be corner cases and/or unexpected behavior stemming from WSL which complicates things, and since we do not test the extension with a WSL setup this is not something we are able to monitor.

    Please also note that there are some caveats surrounding the use of workspaces, as well as a dual terminology in terms of VS Code workspace v.s. West workspace.For details, please see the section on Workspaces in the nRF Connect for VS Code documentation.

    Regards,
    Terje

Reply
  • Hi,

    I was asked to have a look at this case, since Runar is currently out-of-office.

    Ingfu said:
    I somehow made it work.

    Great!

    Ingfu said:
    However, flashing from the extension does not work with my workspace app (on windows)
    Ingfu said:
    I still have the impression, that workspace apps are not really well integrated with the extension, although you recommend it as project configuration.

    I have no intention to contradict you on that impression, but please note that running the extension from within WSL is not considered a target platform for us. There might be corner cases and/or unexpected behavior stemming from WSL which complicates things, and since we do not test the extension with a WSL setup this is not something we are able to monitor.

    Please also note that there are some caveats surrounding the use of workspaces, as well as a dual terminology in terms of VS Code workspace v.s. West workspace.For details, please see the section on Workspaces in the nRF Connect for VS Code documentation.

    Regards,
    Terje

Children
No Data
Related