cryptsetup command is failing with code -1 (wrong or missing parameters)
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
cryptsetup command is failing with code -1 (wrong or missing parameters)
I am trying to encrypt /dev/sda5 with cryptsetup. I have my own product specific installer. So during installation phase I am running the below command from one of the script. I have copied cryptsetup binary, libcryptsetup library files and dm-crypt module into my setup and module is already insmoded into kernel.
Now when I run below command first it complains about absence of /run/cryptsetup file
that I manually create. Now when I run the below command I get another set of errors and I am clueless as what I am missing. I am using customized debian buster and since I have my own installer so I can not use default debian installer.
WARNING !
===========
This will overwrite data on /dev/sda5 irrevocably.
Are you sure ? (Type uppercase yes) : YES
Enter passphrase for /dev/sda5:
Verify passphrase:
Existing 'crypto_LUKS' superblock signature on device /dev/sda5 will be wiped.
Existing 'crypto_LUKS' superblock signature on device /dev/sda5 will be wiped.
Command failed with code -1(wrong or missing parameters)
I am trying to encrypt /dev/sda5 with cryptsetup. I have my own product specific installer. So during installation phase I am running the below command from one of the script. I have copied cryptsetup binary, libcryptsetup library files and dm-crypt module into my setup and module is already insmoded into kernel.
Now when I run below command first it complains about absence of /run/cryptsetup file that I manually create. Now when I run the below command I get another set of errors and I am clueless as what I am missing. I am using customized debian buster and since I have my own installer so I can not use default debian installer.
Code:
#cryptsetup -y -v --type luks2 luksFormat /dev/sda5
WARNING !
===========
This will overwrite data on /dev/sda5 irrevocably.
Are you sure ? (Type uppercase yes) : YES
Enter passphrase for /dev/sda5:
Verify passphrase:
Existing 'crypto_LUKS' superblock signature on device /dev/sda5 will be wiped.
Existing 'crypto_LUKS' superblock signature on device /dev/sda5 will be wiped.
Command failed with code -1(wrong or missing parameters)
Bolded a line for emphasis only. The error is pretty clear; the command line you're using has a syntax error, or is being used incorrectly. Have you read the man page on cryptsetup?? And you're giving us next to nothing to work with...you say you're using a custom Debian install, with your own software to do an installation. We have NO IDEA what you've done to set this up, so we can't really guess as to what the problem is, aside from the error.
Run the command from the command line and see if it works. If so, your program isn't passing something correctly.
The --type option appears to be wrong. Read the man page or the --help output. There needs to be an equals sign (=).
This may also be correct, however please see my advice about a missing <action> which also can be the source of this error. Already noted a few times, but perusing the manual page for the command will give some clear guidance, <action>s are the first section in the man page and also the command synopsis is shown.
For programs that use the standard getopt_long() library function for argument processing, the "=" sign is optional and the forms "--arg=param" and "--arg param" are both acceptable. See "man 3 getopt" for details.
For programs that use the standard getopt_long() library function for argument processing, the "=" sign is optional and the forms "--arg=param" and "--arg param" are both acceptable. See "man 3 getopt" for details.
Thanks. Is the OP still around? I only posted on this somewhat old thread because I was having the same symptoms, but I tracked mine down and the cause was completely different (It left me feeling a little stupid. I've been using Linux since around 1994).
Would the order of the --type parameter matter? Since it's a parameter to the action, it would seem logical that it needs to come after the action. I'm not going to worry about it unless the OP comes back saying they are still having issues. I hate to call out a mod, but the command was absolutely provided an action.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.