This procedure was tested on FreeBSD-CURRENT build from d8819d88af52.
-
Enable linuxulator and install linux userland:
# sysrc linux_enable="YES" # service linux start # pkg install linux_base-c7
Test it:
$ /compat/linux/usr/bin/uname -a Linux monster-1 4.4.0 FreeBSD 14.0-CURRENT #1 main-n254392-d8819d88af52: Wed Apr 6 22 x86_64 x86_64 x86_64 GNU/Linux
For more details on linuxulator setup please refer to handbook.
-
remote-ssh seem to ignore bash config files so we need to change
$PATH
in/etc/login.conf
or send custom env withSetEnv
directive inssh_config
. Choose which fits you better.By default it's class
default
, we need to give priority to linux binaries::path=/compat/linux/usr/sbin /compat/linux/usr/bin /sbin /bin /usr/sbin /usr/bin /usr/local/sbin /usr/local/bin ~/bin:\
rebuild CAP database:cap_mkdb /etc/login.conf
Host your-freebsd.box SetEnv PATH="/compat/linux/usr/sbin:/compat/linux/usr/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin"
-
Set you normal PATH for your every day use in your shell's config file (.bashrc od .zshrc, etc)
-
Connect to your FreeBSD box with VScode's remote SSH extension!
@oliver-giersch, thanks for this work to get VSCode 1.86 working in FreeBSD.
I can confirm that you do NOT need to upgrade to FreeBSD 14 to get your solution to work under FreeBSD 13. However I am using a different ~/ssh/config entry for it:
I could not get the
RemoteCommand
method you're using to work on either FreeBSD 13.2 or 14 under Windows. To get the BASH_ENV method to work, add this to /etc/rc.conf:sshd_flags="-o AcceptEnv=BASH_ENV"
... and to create a .bash_debian file in your $HOME that looks like this:
PATH="/compat/debian/usr/local/sbin:/compat/debian/usr/local/bin:/compat/debian/usr/sbin:/compat/debian/usr/bin:/compat/debian/sbin:/compat/debian/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
A convenient way to invoke this from Windows is to create a shortcut icon on the desktop and set the target property to something like this:
... where
remote-vscode
matches the Host identifier in the ssh config entry and everything else after that matches your home directory and path to your project.Update: I've added these steps to a gist I've been maintaining here:
https://gist.github.com/morganwdavis/6c1880d49102c69c8d9b3ca63f41528b