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-c7Test 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/LinuxFor more details on linuxulator setup please refer to handbook.
-
remote-ssh seem to ignore bash config files so we need to change
$PATHin/etc/login.confor send custom env withSetEnvdirective 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.confHost 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!
@morganwdavis Yes, snippets from the various files:
/etc/rc.conf:
linux_enable="YES"/etc/ssh/sshd_config:
AcceptEnv BASH_ENV~/.bash_linux:
PATH="/compat/linux/usr/local/sbin:/compat/linux/usr/local/bin:/compat/linux/usr/sbin:/compat/linux/usr/bin:/compat/linux/sbin:/compat/linux/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"env:
SHELL=/usr/local/bin/zsh// also used bash as shell for user arjan, but that resulted in problems with connecting..ssh/config:
Installed remote extensions: 'github copilot chat' and 'microsoft c/c++ Extension Pack'
It works to some extend, 'open remote folder' in home directory and within the /compat/linux chroot. CMake extension seems to be bound to the same directories, not able to find the installed C/C++ compilers in FreeBSD....