Send trust password to lxd-p2c command

Hi, I am converting a huge number of VMS into LXD containers, I am using the shell :

printf 'y\PASSWORD\n' | /root/lxd-p2c https://DST_SERVERIP:8443 DST_CONTAINERNAME /

and it shows me Error: inappropriate ioctl for device all the time.
Is there are any way to send the password into the lxd-p2c command?


What you could do is use a certificate which is already trusted by LXD and put that in ~/.config/lxc/client.crt and ~/.config/lxc/client.key on the systems you’re migrating, then lxd-p2c won’t be asking for a password at all.

Thank you for your reply, but I generated a TLS cert and trusted by LXD:

But the lxd-p2c still asking for the password, is there are any requirements for the cert?

This is odd, maybe I misread the code of lxd-p2c but this should have worked…
Can you run strace -o out -f lxd-p2c URL testvm /, let it fail in that same way and then do grep client out to see if it ever looks for that client certificate somewhere?

:thinking: Only getting this result:

root@workstation:~# grep client out
1025014 write(1, "Generating a temporary client ce"..., 69) = 69

Any idea? I’m sorry to bother you again because I’m in a hurry to use this feature to migrate workloads.

Not really… any chance you can post the whole strace output somewhere?

Yea, I’ve uploaded it to Pastebin:

Thank you for taking the time to read:)

Was -f passed to that strace run? I’m seeing a lot less stuff in there than I would expect, making me think I may be looking at just one thread.

Yes, with -f:
strace -o out -f ./lxd-p2c testvm /

You can grab a new binary from the test results on that PR or wait tomorrow for someone to merge it and then grab the binary from the main Github Actions.

Thank you stgraber, now I can finally migrate. :slight_smile: