balena-io / balena-cli

The official balena CLI tool.
Apache License 2.0
452 stars 138 forks source link

balena config inject not working on windows #2759

Open smiccoli opened 4 months ago

smiccoli commented 4 months ago

Expected Behavior

I want to update the device UUID in the config.json file of an image for generic-amd64 device type previously flashed on a USB stick running balena config inject .\config.json --drive \\.\PhysicalDrive1 as documented to save time instead of flashing the new image for each device

Actual Behavior

balena config inject .\config.json --drive \\.\PhysicalDrive1
File is a directory: undefined

Additional information may be available with the `--debug` flag.

For further help or support, visit:
https://www.balena.io/docs/reference/balena-cli/#support-faq-and-troubleshooting

Steps to Reproduce the Problem

The usb stick is recognized

PS C:\balena> balena util available-drives
DEVICE             SIZE     DESCRIPTION
\\.\PhysicalDrive1 125.2 GB SanDisk SanDisk 3.2 Gen1 USB Device

And the previous config.json is read properly

PS C:\balena> balena config read --drive \\.\PhysicalDrive1
applicationId:         <omitted-app-id>
deviceType:            generic-amd64
userId:                <omitted-user-id>
appUpdatePollInterval: 600000
listenPort:            48484
vpnPort:               443
apiEndpoint:           https://api.balena-cloud.com
vpnEndpoint:           cloudlink.balena-cloud.com
registryEndpoint:      registry2.balena-cloud.com
deltaEndpoint:         https://delta.balena-cloud.com
mixpanelToken:         <omitted-panel-token>
logsEndpoint:          https://logs.balena-cloud.com
deviceApiKey:          <omitted-device-api-key>
registered_at:         1714038105
deviceId:              <omitted-device-id>
uuid:                  <omitted-uuid>
files:
  network/network.config:
    """
      [service_home_ethernet]
      Type=ethernet
      Nameservers=8.8.8.8,8.8.4.4
    """

New config.json is generated

balena config generate --device <omitted-new-device-id> --version 5.1.50+rev1 --dev --output config.json

When trying to inject the new configuration the command fail as below

PS C:\balena> balena config inject .\config.json --drive \\.\PhysicalDrive1 --debug
[debug] new argv=[C:\Program Files\balena-cli\client\bin\node.exe,C:\Program Files\balena-cli\client\bin\run,config:inject,.\config.json,--drive,\\.\PhysicalDrive1] length=6
[debug] Deprecation check: 0.07967 days since last npm registry query for next major version release date.
[debug] Will not query the registry again until at least 7 days have passed.
File is a directory: undefined

Error: EISDIR: illegal operation on a directory, fstat

For further help or support, visit:
https://www.balena.io/docs/reference/balena-cli/#support-faq-and-troubleshooting

[debug] Event tracking error: Timeout awaiting 'response' for 0ms

Specifications

smiccoli commented 4 months ago

same issue with other commands such as

balena config write --drive \\.\PhysicalDrive1 hostname custom-hostname

i also tried with

balena config write --drive "\\.\PhysicalDrive1" hostname custom-hostname

but didnt make a difference