I can't find /rootfs on Windows 10 - c

I'm very confused with the whole WSL situation. Sometimes I feel like I get it but in reality, I don't. My main confusion is where does Ubuntu (I use Ubuntu 20.04) save files? And how do they intertwine with files I install with Windows Command Line? All installations I have done via Ubuntu have been a waste of time, I can't find packages or libraries I install for any programming language. If someone knows of a course or video that could help me understand, I would appreciate it if you share it as well.
The specific situation of this question is caused because I installed a package for C with Ubuntu (the cs50 one) but I can't get VS Code to recognize it. I tried adding /usr/local path to the c_cpp_properties.json but it doesn't find this path.
I go to this folder in the explorer and I don't find anything, as expected.
Thanks in advance.

The file ext4.vhdx is the complete filesystem for the Linux subsystem. However, you can't (or shouldn't) access it directly from Windows 10.
Instead (within the Linux subsystem) you can access your C: drive through mount point /mnt/c (E.g. ls -l /mnt/c/Users ), and that way copy files between the two file systems.
If you want to user Windows explorer (again within the Linux subsystem), use following command:
/mnt/c/Windows/explorer.exe .
Just found out. You can access the files directly from Windows 10. E.g:
dir \\wsl$\Ubuntu-20.04\home

I faced the same problem. I was trying to reach rootfs but couldn't and as you have shown, I was reaching a dead end at "ext4.vhdx". After looking at articles, I found the home directory is found within the Linux subsystem, and to reach there you can use the following path to Linux and go to Linux > Ubuntu > home > user/admin and you'll be in your home directory.

You can directly type \\\\wsl$ in the directory path and then you can see the below image to access the file directory of ubuntu.
File Directory
Then, You can navigate here to see all the files as same as rootfs.`
\Ubuntu-22.04\home\user-name
`

I had the same issue and this is how I figured it out:
first, open PowerShell and type: wsl -d Ubuntu
then, go to your file explorer and type: \\wsl$
this will open the Ubuntu folder and you can access all your files

Related

Code execution cannot proceed because libquickmail-0.dll was not found?

I was looking for a quick and easy way to automatically send a file to my gmail for debugging purposes on multiple remote machines. However I am apparently having linking issues which I can't seem to solve.
I downloaded the win64 zip file of libquick, IDE is CodeBlocks, compile target is x64 and running on 64-bit Windows 10.
There were 10 files that came in the zip folder, in lib/include/bin. They were
bin > libquickmail-0.dll, libquickmaillight-0.dll, quickmaillight.exe.
include > quickmail.h.
lib > libquickmail.a, libquickmail.dll.a, libquickmail.la, libquickmaillight.a, libquickmaillight.dll.a, libquickmaillight.la.
I linked to all of the .a/.dll.a/.la and .dll files and it still gives me this error: Code execution cannot proceed because libquickmail-0.dll was not found
I have no idea what the problem is and am very open to ideas. Thank you for your time.
Either copy the libquickmail-0.dll to the same directory as your linked executable or add the libquickmail bin directory to your path. This will allow Windows to find the DLL to run the executable.

"File" command error - how to update magic file

I have been using the "file" command in terminal (Mac) for a while.
Now encountering this error:
file: File 5.31 supports only version 14 magic files. `/usr/share/file/magic.mgc' is version 13
Seems like a fairly simple solution to update the magic file, but can't find any instructions to complete this. Can someone advise?
Any help is much appreciated here.
Perhaps you have more than one file executable in your $PATH. It can get confused if it finds a different database (magic) than it expected. File 5.29 (tagged October 2016) bumped the format to version 14. File 5.31 appears to be the current version on MacOS (works for me).
The "magic" file is built up from many smaller files (see git repository (mirror)). If you needed a specific version that's not prepackaged, you could download the source and compile it, starting with the project page, which points to an ftp site.
However, replacing that magic.mgc file runs into Apple's "system protection" (limited permissions). It's possible to turn that off (perhaps not a Good Idea®) But it's doable.
While you could replace the data file, it might be simpler to just install MacPorts and use the file package from that. It's currently at 5.32 (a step ahead of Apple's package), and if you did not like that, it's simpler to remove/alter.

Bash for Windows 10 gcc won't compile c files pasted into the root directory

As the title suggests, if I paste a c file written somewhere else into the root directory of the Linux Subsystem, I can't compile it.
I did a test where I made two differently titled hello world programs: one in vi that I can get into from the bash interface, and one elsewhere. When I compiled the one made in vi, it worked fine. Trying to do so for the one made elsewhere (after pasting it into the root directory), however, resulted in this:
gcc: error: helloWorld2.c: Input/output error
gcc: fatal error: no input files
compilation terminated
Any help with this would be much appreciated.
Do not change Linux files using Windows apps and tools!
Assuming what you meant by "paste a C file written somewhere else into the root directory of the Linux subsystem" is that you pasted your file into %localappdata%\lxss, this is explicitly unsupported. Files natively created via Linux syscalls in this area have UNIX metadata, which files natively created with Windows tools don't have.
Use /mnt/c (and the like) to access your Windows files from Linux; don't try to modify Linux files from Windows.
Quoting from the Microsoft blog linked at the top of this answer (emphasis from the original):
Therefore, be sure to follow these two rules in order to avoid losing files, and/or corrupting your data:
DO store files in your Windows filesystem that you want to create/modify using Windows tools AND Linux tools
DO NOT create / modify Linux files from Windows apps, tools, scripts or consoles
You cannot copy (by default, who knows how Windows bash is set up!) files into the root directory! Your gcc error is say "no input files", so the copy has most likely failed. Copy the files to your home directory instead, for instance:
cp helloWorld2.c ~/
instead of:
cp helloWorld2.c /

CUDA samples run but no nvcc found - Mint 15 64 bit

I have downloaded and ran the CUDA 5.0 installer on my Mint 15 64bit distro. After hours of agony adjusting / removing / installing packages, it was able to finish installation - at least that what it said.
I can go run the CUDA samples so I thought hey it's working. However, I just made a new cu file and wanted to compile but it said "nvcc command not found"
I have looked at a topic similar to this here and they are talking about /opt/bin/ directory however on mine, there is no such directory. Does that mean it actually did not install ? It tells me to install nvidia cuda toolkit with apt-get but I am not sure if I should do that.
Also, I did say I ran the CUDA samples fine but I have to say ldconfig /usr/local/cuda/lib64
before I can get it to working. Is there a way to automate that ?
Thanks
You need to add the bin directory of the nvcc compiler driver to your PATH (environment variable), and you need to add the appropriate lib directories to your LD_LIBRARY_PATH environment variable.
For an immediate test, this should be as simple as:
export PATH=$PATH:/usr/local/cuda/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/lib
These instructions should be presented to you at the completion of a successful cuda toolkit install, but it seems your install method may have been roundabout.
To make this "automatic" you may want to investigate one of the methods to add these statements to a script run at login. For example, if you have a .bashrc file in your user's home directory, try editing that with the above commands. It should probably be sufficient to put the above commands at the very end of your ~/.bashrc file if you have one.
Note that Linux Mint is not one of the officially supported CUDA distros, so your mileage may vary.

Installing a project in KDevelop fails

I've got a project in KDevelop, but attempting to install if from within the IDE simply gives the following output:
/home/<myusername>/Projects/rect/build/release> kdesu -t -- make -j8 install
*** Failed ***
However, when I run the exact same command from the exact same location in terminal (outside KDevelop), it asks for the root password as it should and installs just fine. All possible solutions for the problem I could find are either for missing kdesu or kdesu installed in a location not on PATH by default; however, I most certainly have kdesu on my system and I have exported its location, and like I said, the exact command that KDevelop appears to be trying to run works beautifully outside the IDE.
So, how would I get the install option working in KDevelop itself?
I'm using Debian Wheezy if this matters.
I got around this by creating a symlink to the kdesu binary in /usr/local/bin, which seems to be working just fine. I'm still curious as to why it didn't work before since the directory containing kdesu was on the PATH, though.
Of course the problem with my PATH was that I was only setting it in the console but the PATH is different for GUI applications (thanks D.J.Duff for pointing that out, can't believe I didn't know this) - I fixed it by adding PATH="$PATH:/usr/lib/kde4/libexec" (the location of these binaries) to my .profile file as suggested here.

Resources