Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kernel instalation #2

Open
lisbravo opened this issue Aug 30, 2019 · 8 comments
Open

kernel instalation #2

lisbravo opened this issue Aug 30, 2019 · 8 comments

Comments

@lisbravo
Copy link

Im sorry if this is not the right place for this question but, are you sure that
sudo make install
will install the newly compiled kernel y wsl 2? I've followed your instructions many times with no success just to find that the kernel in the /boot is not the one that wsl uses

@rpasek
Copy link
Owner

rpasek commented Aug 30, 2019

Hi psykhon,
I'm pretty sure it does but I haven't confirmed 100% that it's loading the new kernel. If you look carefully you'll notice that this method is simply modprobing in kernel modules that we've built, not building the drivers into the kernel.

One thing that had me stumped for a while is that WSL 2 seems to only run the exact named version as installed. If you acquired the source using git, if you make changes to files that are not ignored by git, the Linux build process will append a + to the name of the kernel to indicate that your build is dirty. For example you may see at the end of the Linux build:
DEPMOD 4.19.43-microsoft-standard+

To get around this you could do:
sudo make LOCALVERSION= (note my previous edit of this comment is wrong)

I found this information on https://stackoverflow.com/questions/19333918/dont-add-to-linux-kernel-version

@lisbravo
Copy link
Author

By now I can confirm that make install does not loads the new kernel
https://github.com/MicrosoftDocs/WSL/releases/tag/18947
still havent had any success runing a new kernel in this way but I'll get back to you when I manage to do it

@lisbravo
Copy link
Author

lisbravo commented Aug 30, 2019

I manage to get it working:
-First I just compiled a kernel with ms defaults
sudo make KCONFIG_CONFIG=Microsoft/config-wsl
-Copied
/usr/src/4.19.57-microsoft-standard/arch/x86/boot/compressed/vmlinux.bin
to
C:\Users\lbrav\kernel
-Added a .wslconfig file in C:\Users\lbrav\ with
[wsl2] #kernel=C:\\Users\\lbrav\\kernel\\vmlinux.bin
-Restart WSL
wsl --shutdown wsl -d Ubuntu

@ConnorChristie
Copy link

Thank you @lisbravo! Installing the custom kernel by using the wsl2 config worked like a treat. Then I was able to install the kernel modules and finally run the startusb.sh without seeing any errors!

@CalebGreer
Copy link

CalebGreer commented Apr 3, 2020

I tried to run the command for compiling a kernel with ms defaults

sudo make KCONFIG_CONFIG=Microsoft/config-wsl

it gives me this output:

***
*** Configuration file "Microsoft/config-wsl" not found!
***
*** Please run some configurator (e.g. "make oldconfig" or
*** "make menuconfig" or "make xconfig").
***
scripts/kconfig/Makefile:69: recipe for target 'syncconfig' failed
make[2]: *** [syncconfig] Error 1
Makefile:534: recipe for target 'syncconfig' failed
make[1]: *** [syncconfig] Error 2
Makefile:633: recipe for target 'include/config/auto.conf.cmd' failed
make: *** [include/config/auto.conf.cmd] Error 2```

I have run the configurator so I am not sure what the next step in fixing this would be

@theseankelly
Copy link

theseankelly commented Apr 4, 2020

It's been a couple weeks since I did this, but I think I followed the instructions in the primary readme (take care to check out the correct branch, per issue number #3).

Specifically, these steps (again, use the actual version/git tag that matches your kernel at the moment, mine is 4.19.104-microsoft-standard, git tag 4.19.104-microsoft-standard

/usr/src/4.19.104-microsoft-standard$ sudo cp /proc/config.gz config.gz
/usr/src/4.19.104-microsoft-standard$ sudo gunzip config.gz
/usr/src/4.19.104-microsoft-standard$ sudo mv config .config
/usr/src/4.19.104-microsoft-standard$ sudo make menuconfig

Instead of make KCONFIG_CONFIG=Microsoft/config-wsl. In theory using the current config from proc/config.gz from within WSL should be the WSL defaults.

Anyway, the key was to copy the kernel out of WSL and then point WSL At it in .wslconf per @lisbravo 's comment.

@pagkly
Copy link

pagkly commented Apr 29, 2020

Hi @theseankelly and @lisbravo I could not get it to work.
I already tried checkout v4.19.84 and it would show something @CalebGreer had posted being
*** Configuration file "Microsoft/config-wsl" not found!

When I checkout 4.19.84-microsoft-standard it showed something like

user@DESKTOP-KDJ7PIR:/usr/src/4.19.84-microsoft-standard$ sudo git checkout 4.19.84-microsoft-standard
M       Microsoft/config-wsl
HEAD is now at db998769a92e Merge tag 'v4.19.84' into linux-msft-wsl-4.19.y
user@DESKTOP-KDJ7PIR:/usr/src/4.19.84-microsoft-standard$

and sudo make KCONFIG_CONFIG=Microsoft/config-wsl works
and show this at the end

  DEPMOD  4.19.84-microsoft-standard+
sh ./arch/x86/boot/install.sh 4.19.84-microsoft-standard+ arch/x86/boot/bzImage \
        System.map "/boot"
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.19.84-microsoft-standard+ /boot/vmlinuz-4.19.84-microsoft-standard+
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.19.84-microsoft-standard+ /boot/vmlinuz-4.19.84-microsoft-standard+
update-initramfs: Generating /boot/initrd.img-4.19.84-microsoft-standard+
W: mkconf: MD subsystem is not loaded, thus I cannot scan for arrays.
W: mdadm: failed to auto-generate temporary mdadm.conf file.
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.19.84-microsoft-standard+ /boot/vmlinuz-4.19.84-microsoft-standard+
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.19.84-microsoft-standard+ /boot/vmlinuz-4.19.84-microsoft-standard+

but whenever I startusb.sh

modprobe: FATAL: Module usbip-core not found in directory /lib/modules/4.19.84-microsoft-standard
modprobe: FATAL: Module vhci-hcd not found in directory /lib/modules/4.19.84-microsoft-standard

I did @lisbravo
[wsl2] #kernel=C:\\Users\username\\kernel\\vmlinux.bin
%userprofile%\.wslconfig and %userprofile%\kernel\vmlinux.bin and shutdown and restart wsl as well but startusb.sh still shows something like that.

usbip is working good and I have set up everything on the windows side. just left with the compiling

@Luigi90900
Copy link

Remove the # in front of kernel=C:\...\kernel\vmlinux.bin. The # comments out the line so it gets ignored. I did the same thing before realizing that.

My .wslconfig is:

[wsl2]
kernel=C:\\Users\\Luigi90900\\kernel\\vmlinux.bin
swap=0

cakira added a commit to cakira/usbip-wsl2-instructions that referenced this issue Jun 24, 2021
This commit is related to rpasek#2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants