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

Error: Unknown device type #362

Open
xdoestech opened this issue May 12, 2022 · 14 comments
Open

Error: Unknown device type #362

xdoestech opened this issue May 12, 2022 · 14 comments

Comments

@xdoestech
Copy link

after going through this (https://www.reddit.com/r/CarHacking/comments/ot3gjf/socketcancanutils_on_windows/) guide on reddit
I am able to run sudo modprobe vcan
but ip link add dev vcan0 type vcan
returns an error: unknown device type...

I am using linux on wsl2 for the first time so hopefully it is some basic issue?

any help is appreciated

@hartkopp
Copy link
Member

Hi as you started with your question here : #46 (comment)

I once build my own WSL2 kernel too to get the CAN support working.

But I'm pretty sure that there was no module loading support and the kernel was a single file.

So I enabled the CAN stuff by setting the selections to Y instead of M, so that the entire CAN support (including vcan) was built inside the kernel.

Or did you just build modules without building (and installing) the kernel?

@xdoestech
Copy link
Author

I built and installed a kernel as far as I know...

I went into the menuconfig and enabled can and vcan
this is what I see when I try to run it...

root@LAPTOP-7G36NVGI:/# sudo modprobe vcan
root@LAPTOP-7G36NVGI:/# sudo ip link add dev vcan0 type vcan
Error: Unknown device type.

I have vcan in the system (I cant seem to remember the command to show it but its there)

@hartkopp
Copy link
Member

Hm, maybe the ip tool?

What does ip -V show?

And does ip link help dev show vcan and vxcan in the list of [TYPE]s ??

Maybe your ip tool is part of a multi-call binary like busybox which has a stripped configuration.

Then you should install the iproute2 package to install the full blown version.

@xdoestech
Copy link
Author

Good looks that was the command I used... but unfortunately it shows both vcan and vxcan

also looks like I already have iproute2 installed...

TYPE := { vlan | veth | vcan | vxcan | dummy | ifb | macvlan | macvtap | bridge | bond | team | ipoib | ip6tnl | ipip | sit | vxlan | gre | gretap | erspan | ip6gre | ip6gretap | ip6erspan | vti | nlmon | team_slave | bond_slave | bridge_slave | ipvlan | ipvtap | geneve | vrf | macsec | netdevsim | rmnet | xfrm }

@xdoestech
Copy link
Author

I also installed debian (distro?) (from Microsoft store) to double-check that I did anything and it also shows the same output for ip link help dev, but it gives the original FATAL error telling me I made the new kernel correctly?

modprobe: FATAL: Module vcan not found in directory /lib/modules/5.10.102.1-microsoft-standard-WSL2

@xdoestech
Copy link
Author

would giving up on using the wsl and just booting linux solve this issue? At this point I'm ready to quit windows all together... make a boot USB and plug into my laptop?

@hartkopp
Copy link
Member

would giving up on using the wsl and just booting linux solve this issue? At this point I'm ready to quit windows all together... make a boot USB and plug into my laptop?

Excellent choice! I'm using Xubuntu or Debian - installs within 10 minutes :-D

@xdoestech
Copy link
Author

screw it ill see you on the other side // hopefully this clears up the issue

@hartkopp
Copy link
Member

Good looks that was the command I used... but unfortunately it shows both vcan and vxcan

also looks like I already have iproute2 installed...

TYPE := { vlan | veth | vcan | vxcan | dummy | ifb | macvlan | macvtap | bridge | bond | team | ipoib | ip6tnl | ipip | sit | vxlan | gre | gretap | erspan | ip6gre | ip6gretap | ip6erspan | vti | nlmon | team_slave | bond_slave | bridge_slave | ipvlan | ipvtap | geneve | vrf | macsec | netdevsim | rmnet | xfrm }

The fact that ip shows up and also shows this help text does not necessarily mean that you have iproute2 installed.

On Debian dpkg -l | grep iproute should show if the package is really installed.

@hartkopp
Copy link
Member

I also installed debian (distro?) (from Microsoft store) to double-check that I did anything and it also shows the same output for ip link help dev, but it gives the original FATAL error telling me I made the new kernel correctly?

modprobe: FATAL: Module vcan not found in directory /lib/modules/5.10.102.1-microsoft-standard-WSL2

This is the problem with the module installation (and you need to run depmod -a after install).

That's why I built a WSL2 based Linux kernel without modules but with the CAN subsystem built-in.

@xdoestech
Copy link
Author

On the other side with linux mint... its not great so far, but I guess I just need to download everything

for debian I meant to say that I didn't add or install anything and was using it to test that the output was different from the ubuntu which I did change (I did the whole kernal nonsense including depmod -a on ubuntu and the fatal error went away, but it could not find vcan0 even though vcan was installed

Im going with Linux Mint from here on out... If this is a terrible mistake let me know (It was recommend over anything else and I didn't want to have to spend 4 hours figuring it out... I ended up spending 5 hours)

@hartkopp
Copy link
Member

depmod -a on ubuntu and the fatal error went away, but it could not find vcan0 even though vcan was installed

vcan is just the module.

Once loaded this vcan kernel module (e.g. with modprobe vcan ) the "software device" vcan0 has to be created with ip link add dev vcan0 type vcan and then ip link set vcan0 up

@RTBijinepalli
Copy link

RTBijinepalli commented Mar 1, 2024

once i run modprobe vcan i am getting an FATAL error: module vcan not found in directory

@marckleinebudde
Copy link
Member

You have to compile your kernel with CONFIG_CAN_VCAN enabled.

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

4 participants