cloudmesh / cloudmesh-pi-burn

Burns many SD cards so we can build a Raspberry PI cluster
Other
18 stars 12 forks source link

burn: windows: recheck every month, as not yet supported by windows: WSL2 & SD Card Probe on Windows Machine #50

Open dkkolli opened 3 years ago

dkkolli commented 3 years ago

edit by JP 5/9/2022 windows DOES support SD Card Probe on windows machine using WSL2.

Please click here to view a walkthrough that I wrote that guides how to take an sd card inserted into Windows machine and mount it on WSL2 first, make sure that your WSL is version 2 otherwise this will not work. take a look at your WSL list by issuing, on admin powershell, `wsl --list` then issue `wsl --set-version Ubuntu 2` but rename Ubuntu to the name of your WSL. (if it is already version 2 then it will tell you.) then run `wsl --update`, then shutdown by issuing `wsl --shutdown`, then start it up again with `wsl` now, follow this page: https://docs.microsoft.com/en-us/windows/wsl/connect-usb this tutorial includes the following: 1. the user downloads the msi from the latest release https://github.com/dorssel/usbipd-win/releases 2. the user runs the msi and runs the installer to completion 3. the user goes into the WSL linux system, if not in the WSL already, by issuing `wsl` in admin powershell and then issues the following commands: ```bash you@yourwsl:/mnt/c/Windows/system32$ sudo apt install linux-tools-5.4.0-77-generic hwdata -y you@yourwsl:/mnt/c/Windows/system32$ sudo update-alternatives --install /usr/local/bin/usbip usbip /usr/lib/linux-tools/5.4.0-77-generic/usbip 20 ``` then exit the wsl by issuing `exit` and then running, in a NEW instance of admin powershell, `wsl`, then `exit`, then `usbipd wsl list` now we can connect the BUSID that pertains to our SD card PS C:\Windows\system32> usbipd wsl list BUSID VID:PID DEVICE STATE 2-6 0bda:0177 Realtek USB 2.0 Card Reader Not attached now we issue `usbipd wsl attach --busid 2-6` and we run cms burn info

cms burn info fails, on both branches main and windows.

the genesys logic inc logilink is my sd card but it fails

# ----------------------------------------------------------------------
# This is a Linux Computer
# ----------------------------------------------------------------------

# ----------------------------------------------------------------------
# USB Device Probe
# ----------------------------------------------------------------------

+--------+-------+----------+---------+---------------------+-----------------+--------+------------+------------+-------------------------------------+
|   Adr. |   bus |   Vendor |   Prod. | H Vendor            | H Prod.         |   Man. |   Ser.Num. |   USB Ver. | Comment                             |
|--------+-------+----------+---------+---------------------+-----------------+--------+------------+------------+-------------------------------------|
|      2 |     1 |     1507 |    1861 | Genesys Logic, Inc. | Logilink CR0012 |      0 |          2 |          2 | Genesys Logic, Inc. Logilink CR0012 |
|      1 |     1 |     7531 |       2 | Linux Foundation    | 2.0 root hub    |      3 |          1 |          2 | Linux Foundation 2.0 root hub       |
|      1 |     2 |     7531 |       3 | Linux Foundation    | 3.0 root hub    |      3 |          1 |          3 | Linux Foundation 3.0 root hub       |
+--------+-------+----------+---------+---------------------+-----------------+--------+------------+------------+-------------------------------------+
sudo password:

# ----------------------------------------------------------------------
# SD Cards Found
# ----------------------------------------------------------------------

ERROR: executing command 'burn info'
======================================================================
'removable'
'removable'
Traceback (most recent call last):
  File "/home/jp/cm/cloudmesh-cmd5/cloudmesh/shell/shell.py", line 1103, in main
    stop = cmd.onecmd(command)
  File "/home/jp/cm/cloudmesh-cmd5/cloudmesh/shell/shell.py", line 421, in onecmd
    return func(arg)
  File "/home/jp/cm/cloudmesh-cmd5/cloudmesh/shell/command.py", line 112, in new
    func(instance, args, arguments)
  File "/home/jp/cm/cloudmesh-pi-burn/cloudmesh/burn/command/burn.py", line 811, in do_burn
    execute("info", card.info(output=output))
  File "/home/jp/cm/cloudmesh-pi-burn/cloudmesh/burn/sdcard.py", line 1084, in info
    print(Printer.write(details,
  File "/home/jp/cm/cloudmesh-common/cloudmesh/common/Tabulate.py", line 143, in write
    _results = Printer.select(_results,
  File "/home/jp/cm/cloudmesh-common/cloudmesh/common/Tabulate.py", line 77, in select
    _results.append([result[key] for key in order])
  File "/home/jp/cm/cloudmesh-common/cloudmesh/common/Tabulate.py", line 77, in <listcomp>
    _results.append([result[key] for key in order])
KeyError: 'removable'

======================================================================
laszewsk commented 2 years ago

review if new release can access sdcards from wsl2. I think it may still not be the case

laszewsk commented 2 years ago

So looks liek that the burn info does not return the field removable ... in the printout. THis is easy to fix as one could set removable to None .., as that is just a table value ... this would habben in the burn info ... I guess

jpfleischer commented 2 years ago

@laszewsk if we add

for x in results:
    x["removable"] = None

then cms burn info yields

(ENV3) usr@Sledgehammer:/mnt/f$ cms burn info

# ----------------------------------------------------------------------
# This is a Linux Computer
# ----------------------------------------------------------------------

# ----------------------------------------------------------------------
# USB Device Probe
# ----------------------------------------------------------------------

+--------+-------+----------+---------+---------------------+-----------------+--------+------------+------------+-------------------------------------+
|   Adr. |   bus |   Vendor |   Prod. | H Vendor            | H Prod.         |   Man. |   Ser.Num. |   USB Ver. | Comment                             |
|--------+-------+----------+---------+---------------------+-----------------+--------+------------+------------+-------------------------------------|
|      2 |     1 |     1507 |    1861 | Genesys Logic, Inc. | Logilink CR0012 |      0 |          2 |          2 | Genesys Logic, Inc. Logilink CR0012 |
|      1 |     1 |     7531 |       2 | Linux Foundation    | 2.0 root hub    |      3 |          1 |          2 | Linux Foundation 2.0 root hub       |
|      1 |     2 |     7531 |       3 | Linux Foundation    | 3.0 root hub    |      3 |          1 |          3 | Linux Foundation 3.0 root hub       |
+--------+-------+----------+---------+---------------------+-----------------+--------+------------+------------+-------------------------------------+
sudo password:

# ----------------------------------------------------------------------
# SD Cards Found
# ----------------------------------------------------------------------

+----------+--------+-------------+----------------+--------------+------------+---------+----------+-------------+-------------+
| Path     | Info   | Formatted   | Size           | Plugged-in   | Readable   | Empty   | Access   | Removable   | Writeable   |
|----------+--------+-------------+----------------+--------------+------------+---------+----------+-------------+-------------|
| /dev/sda | Msft   | True        | 275 GB/256 GiB | True         | True       | False   | True     |             | True        |
| /dev/sdb | Msft   | True        | 275 GB/256 GiB | True         | True       | False   | True     |             | True        |
+----------+--------+-------------+----------------+--------------+------------+---------+----------+-------------+-------------+

# ----------------------------------------------------------------------
# Mount points
# ----------------------------------------------------------------------

WARNING: No mount points found. Use cms burn mount

(ENV3) usr@Sledgehammer:/mnt/f$

the problem is that the device is not a /dev/ , instead it is located at /mnt/f

jpfleischer commented 2 years ago

it seems like the solution is to upgrade to windows 11. https://docs.microsoft.com/en-us/windows/wsl/wsl2-mount-disk

laszewsk commented 2 years ago

do you have card in reader? also i suggest to add the =None in code but make sure it does not break anything.

laszewsk commented 2 years ago

make sure card is formatted with fat32 or something windows knows about

laszewsk commented 2 years ago

It makes sense to disbanden the windows 10 effort and use windows 11. I however can not update as I am unsure what impact this has on my system due to the hightened security and I do dual boot into windows and Linux. e.g. as my machine is primarily used for linux and not windows I like not to upgrade to windows 11. Also I think uva does not support windows 10 to 11 upgrade ...

laszewsk commented 2 years ago

Also I note that Windows 11 was released Oct 11 2021. SO it would have been timely for this to have been looked at. What os are you using?

jpfleischer commented 2 years ago

i am using windows 10 but i can verify that WSL can write to sd card through a usb reader. sudo mount -t drvfs D: /mnt/d cd /mnt/d touch test