LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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


Reply
  Search this Thread
Old 10-19-2020, 09:28 AM   #1
Praveen_Rinku
LQ Newbie
 
Registered: Nov 2012
Posts: 6

Rep: Reputation: Disabled
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.

#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)
 
Old 10-19-2020, 09:52 AM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Assuming you're perusing the manual page for cryptsetup.

You didn't give it an <action> to perform.
 
1 members found this post helpful.
Old 10-19-2020, 10:00 AM   #3
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by Praveen_Rinku View Post
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.
 
Old 10-19-2020, 11:13 AM   #4
sgosnell
Senior Member
 
Registered: Jan 2008
Location: Baja Oklahoma
Distribution: Debian Stable and Unstable
Posts: 1,943

Rep: Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542
The --type option appears to be wrong. Read the man page or the --help output. There needs to be an equals sign (=).
 
1 members found this post helpful.
Old 10-19-2020, 03:34 PM   #5
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Quote:
Originally Posted by sgosnell View Post
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.
 
1 members found this post helpful.
Old 01-07-2021, 09:05 AM   #6
WoodchuckTX
LQ Newbie
 
Registered: Jan 2021
Distribution: Ubuntu
Posts: 3

Rep: Reputation: Disabled
I'm having the same problem. I've used the command before, so I'm quite puzzled. And luksFormat is an action. Quote from the manpage, bold is mine:

The following are valid LUKS actions:

luksFormat <device> [<key file>]

On recent versions it should default to a type of luks2. Same results = sign or not.
 
Old 01-07-2021, 09:47 AM   #7
WoodchuckTX
LQ Newbie
 
Registered: Jan 2021
Distribution: Ubuntu
Posts: 3

Rep: Reputation: Disabled
Doh! My problem is that I never typed my yes in uppercase...

It is the missing = on the type command. Following command works for me (container_a is a 2TB file filled with 0's)
Quote:
sudo cryptsetup -v luksFormat --type=luks2 ./container_a
 
Old 01-08-2021, 08:50 AM   #8
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
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.
 
1 members found this post helpful.
Old 01-08-2021, 01:07 PM   #9
WoodchuckTX
LQ Newbie
 
Registered: Jan 2021
Distribution: Ubuntu
Posts: 3

Rep: Reputation: Disabled
Quote:
Originally Posted by rknichols View Post
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
edit a file /etc/fstab , what parameters can be changebale and which parameters lenin99 Debian 7 01-24-2017 04:03 AM
[SOLVED] Why there are two separate parameters in /proc/sys/net/ipv4/ for security parameters gprathap1121@gmail.com Linux - Security 4 07-14-2014 12:41 AM
13 2.6.29.6 cryptsetup luks wrong device name in /dev/mapper/* TheSoftRock Slackware 1 03-04-2010 05:51 PM
cryptsetup error (Command failed: Invalid argument) SlackN00b Slackware 5 02-07-2007 12:59 PM
cryptsetup - command failed: invalid argument Captain Harlock Debian 2 05-09-2006 12:18 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:30 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration