WSL2 VSCode Will Not Load After Ubuntu upgrade - Worked fine for 1 year - visual-studio-code

Running Windows 11, WSL2, Ubuntu 20.04. Been developing with VSCode over a year. I regularly run apt update and apt upgrade without any problem. Today after running apt upgrade I can no longer open VSCode. I get the following error
node:internal/modules/cjs/loader:990
throw err;
^
Error: Cannot find module '\wsl.localhost\Ubuntu-20.04\mnt\c\Users\JimD\AppData\Local\Programs\Microsoft VS Code\Code.exe'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:987:15)
at Module._load (node:internal/modules/cjs/loader:832:27)
at Function.c._load (node:electron/js2c/asar_bundle:5:13343)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
That is the correct path to the VSCode exe, but I am not sure about the \wsl.localhost\Ubuntu-20.04 part
I rolled back my wsl to an month old backup and confirmed VSCode ran fine. Ran apt update and upgrade on that and get the same error.
Does anyone know how to fix this?

Starting from a functioning backup of the WSL image, I manually installed each packaged listed from apt list --upgradable. Turns out it is the upgrade from systemd-genie 2.3 to 2.4 that is causing the problem.
If I upgrade every other package, VSCode still loads. When I upgrade systemd-genie to 2.4 and restart my laptop, VSCode will not load giving the error in the original post.

edit /usr/lib/binfmt.d/WSLInterop.conf, change flag PF to F, reboot wsl seems able to let you run code again, but not sure whether any other side-effects exists.

My final solution was to just not use systemd. With the release of Windows 11, a new feature has been added to WSL to runs scripts on WSL startup. This feature is now also available to Windows 10 users if you install WSL from the Microsoft Store (requires KB5020030, which should be available under Optional Updates).
create the file /etc/wsl.conf and the following
[boot]
command = bash /etc/[path to startup script]
in my case I used the path "/etc/wsl-services-start.sh" This shell script contains only
service apache2 start
service mysql start
Starting apache2 and mysql was the only thing I needed systemd for, so this works fine for me.

Related

How to install specific version in ARCH using yay?

I have issue with latest version of vscode==1.75.1.
I'm ussing Microsoft Dev Containers extension, and inside dev container I cannot run termminal .
Error is: The connection to the terminal's pty host process is unresponsive, the terminals may stop working.
I'm traying to find any olution for this problem.
I done uninstall, remove all filles related to vscode, install agan with yay -S visual-studio-code-bin and still have issue.
I want to install specific version of visual-studio-code-bin==1.74.3, how to install with yay -S?
p.s. This was after I updated system.
Thanks!

Multiple Errors when Running Bun via WSL

I am trying to install some packages using Bun, but I am running into trouble:
$ bun install
error: Failed to initialize network thread: SystemOutdated.
HTTP requests will not work. Please file an issue and run strace().
Is there any known fix to this problem?
Bun leverages some network features which are only available on newer versions of WSL. You can usually fix these issues by updating your WSL version:
wsl --update
And restart your WSL VM:
wsl --shutdown
Also note that Bun only supports WSL2, so you would need to upgrade your WSL version to 2. See the Microsoft guide on updating from WSL1 to WSL2.
Furthermore, if you are getting an error for NotSameFileSystem, then you need to defer to using a different style for installations. This can be done by adding the --backend=copyfile to the end of your commands.

Recipe terminated with fatal error: spawn latexmk ENOENT

I have just installed debian 10 as well as vscode. I have been struggling with this for 3 days now.. I installed texlive from terminal with the following command:
sudo apt install texlive
I then installed the latex workshop extension in vscode and tried building a .tex file. The following error popped up:
Recipe terminated with fatal error: spawn latexmk ENOENT.
I then preceded to install latexmk from terminal with:
sudo apt install latexmk
The same error kept popping up after that. The output showed this.
[14:59:34] Recipe step env: {}
[14:59:34] cwd: /home/phoenix/Documents/stellies/year4/2021/s&s-414/pracs/prac-4/report
[14:59:34] LaTeX build process spawned. PID: undefined.
[14:59:35] LaTeX fatal error: spawn latexmk ENOENT, . PID: undefined.
[14:59:35] Does the executable exist? PATH: /app/bin:/usr/bin:/home/phoenix/.var/app/com.visualstudio.code-oss/data/node/bin:/home/phoenix/.var/app/com.visualstudio.code-oss/data/cargo/bin:/home/phoenix/.var/app/com.visualstudio.code-oss/data/python/bin
[14:59:35] The environment variable $SHELL: /bin/sh
I then proceded to review the texlive website. I noticed that i did not set the path variable to include the texlive binaries. The texlive website gives the following path to the binary files : PATH=/usr/local/texlive/2021/bin/x86_64-linux:$PATH
however /usr/local/texlive does not exist on my system for some reason. Where can i find the correct path to the texlive binaries on Debian 10?
I had the same problem. The root cause was: (1) software's bin folder missing from PATH; (2) bad file privileges. Consequently, VSC couldn't access latexmk, which explains the error messages.
In my case, the problem occurred on a mac, and specifically after I installed MacTex, which, in turn, installs Tex Live. I believe the same solution may apply to linux distros too.
Solution:
Claim file ownership (which was originally root) under folder /usr/local/texlive: sudo chown -R <username> /usr/local/texlive, where <username> is the OS-level user name. The fix will work for this specific user. If it is not enough, try instead setting group owner appropriately, and/or consider Step 3.
Add /usr/local/texlive/2021/bin/<software_dialect> to PATH. <software_dialect> depends on the installed software version: in my case it is universal-darwin; on linux it might be x86_64-linux.
If the problem persists, try to change file access permissions under /usr/local/texlive using chmod.
EDIT: As a final step, restart VSC for changes to take effect.
I recently encountered the same problem on MacOS Monterrey (M1 based). I used basictex (just for the context). As required by the installation instruction,
I added TeXLive to PATH,
installed latexmk package to the TeX distribution.
However, still got the same error as OP.
Afte reading the wiki again more carefully, what finally worked for me was as simple as restarting VS Code and MacOS. Everything works as expected after a reboot of the MAC.
I had this same problem on Mac recently, the fix that worked for me was to uninstall and reinstall the LaTeX Workshop extension.
I got the same issue , seems to be a misbehaving from Vscode on MacOS
check if the command is in the path on mac
-which command_you are running example which latexmk
If this output something that means you have your latex installed, otherwise go and installed it and make sure it is accessible via command line.
If latex is installed and you are getting that issue you can just restart your VSCode and everything will be okay.
Had a similar error and came across this post when looking for a solution.
I wanted to use texlive on Vscode with WSL2 on Windows 10. Installing texlive-full in wsl fixed this error for me.
On Mac, this is a way to fix the issue
Step1: reinstall mactex by downloading it from this link: http://www.tug.org/mactex/mactex-download.html
Step2: In your terminal do cd /usr/local, you should see texlive folder
Step3: In your terminal do sudo vim etc/paths to set the environment. Details are in this link: https://www.architectryan.com/2012/10/02/add-to-the-path-on-mac-os-x-mountain-lion/
Step4: In your terminal do /usr/local/texlive/2021/bin/x86_64-linux at the bottom. check the folder to see if the year is correct. Details in: http://www.tug.org/texlive/quickinstall.html.
Step5: Quit VC code completely, and reopen it.

Powershell commands/scripts not actually running

I am trying to install Emscripten on my computer, and I have run into trouble getting Emscripten actually installed.
I am using the same commands as can be found on the project webpage, but when I try to run
emsdk install latest
Powershell (which is what I am using, but the basic command prompt is behaving the same way) doesn't do anything at all - it just returns without installing anything.
For reference, I have installed Emscripten on this same computer before, but decided to try and do a fresh install of Emscripten after running emsdk activate latest decided to "stop working" as well (whereas it worked just fine last week) - running the command, Powershell simply returned without actually doing anything.
Any ideas on what to check to see why these commands don't seem to run?
I think I solved it. When running the install command in Powershell ISE, it threw the error "Python was not found but can be installed from the Microsoft Store: https://go.microsoft.com/fwlink?linkID=2082640"
despite me having Python installed. Changing the order of my PATH variables to set my Python install directory above the Winapps directory solved the issue with running the install command.

Opening WSL remote window not working - command wslpath not found

When trying to open a new Remote-WSL window I run into an error during the "Installing VS Code Server in WSL (details): Installing WSL components" step. Appears it can not find the wslpath command.
I have tried looking at my PATH variables, I didn't see wslpath anywhere there nor do I know what the path should look like? I also tried reinstalling my linux distribution but that did not help.
[2019-07-09 12:23:39.266] Launching C:\Windows\System32\wsl.exe bash -c "'$(wslpath -u 'c:/Users/laida/.vscode/extensions/ms-vscode-remote.remote-wsl-0.38.8/scripts/wslServer.sh')' '0f3794b38477eea13fb47fbe15a42798e6129338' 'stable' '.vscode-server' 'C:/Users/laida/AppData/Local/Temp/vscode-remote-wsl/0f3794b38477eea13fb47fbe15a42798e6129338/vscode-server-linux-x64.tar.gz' 0 " in c:\Users\laida\.vscode\extensions\ms-vscode-remote.remote-wsl-0.38.8
[2019-07-09 12:23:39.562] /bin/bash: wslpath: command not found
[2019-07-09 12:23:39.562] bash: : command not found
[2019-07-09 12:25:10.024] VS Code Server for WSL failed to start. No messages received for 90s
I just ran into this today when starting up Remote - WSL. I am using an older Windows 10 version as #Biswapriyo noted, so I resolved it by installing wslpath from https://github.com/laurent22/wslpath
(Note: I also had to install php for that to work).
After that I was able to start Remote - WSL
I imagine that installing a newer Windows 10 version would probably work as well, but I'm unable to do that (managed image) and even if I were able that's kind of like killing an ant with a sledgehammer.