Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
IW error "key must be [d:]..."
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
enrico3791
Tux's lil' helper
Tux's lil' helper


Joined: 03 Sep 2010
Posts: 77

PostPosted: Sat Dec 10, 2022 10:29 am    Post subject: IW error "key must be [d:]..." Reply with quote

I have this problem since the installation of Gentoo. During installation I simply turned my wireless network to an open network to avoid the password problem.

I use iw to setup a wireless network with these parameters:

SSID: MY-SSID
Password: wireless-password

Following the hand book manual I type:

iw dev wlp4s2 connect -w MY-SSID key 0:wireless-password (or d:0:wireless-password) (both do not work>)

but I receive this error message

WARNING: at list one error occurred. (-1)
key must be [d:]index:data where
'd:' means default (transmit) key
'index:' is a single digit (0-3)
'data' must be 5 or 13 ascii chars

Wireless card is an ATHEROS AR9227

Whats wrong?

Thanks and regards
Enrico
Back to top
View user's profile Send private message
Banana
Veteran
Veteran


Joined: 21 May 2004
Posts: 1358
Location: Germany

PostPosted: Sat Dec 10, 2022 10:54 am    Post subject: Reply with quote

Quote:
...
'data' must be 5 or 13 ascii chars

Well, I don't know the security config here (WPA, WPA2 ...) but the password has to be minimum 5 and maximum 13 chars long. And yours is longer.
_________________
My personal space
My delta-labs.org snippets do expire

PFL - Portage file list - find which package a file or command belongs to.
Back to top
View user's profile Send private message
enrico3791
Tux's lil' helper
Tux's lil' helper


Joined: 03 Sep 2010
Posts: 77

PostPosted: Sat Dec 10, 2022 11:18 am    Post subject: Reply with quote

I would like to avoid to disclose my real SSID and password, so the below are just for this topic purposes:

SSID: MY-SSID (real SSID is 4 chars long)
Password: wireless-password (real password is 9 chars long)
Back to top
View user's profile Send private message
enrico3791
Tux's lil' helper
Tux's lil' helper


Joined: 03 Sep 2010
Posts: 77

PostPosted: Sun Dec 11, 2022 8:51 am    Post subject: Can't start wireless network at the very beginning Reply with quote

I can't even start to install Gentoo because I can't setup a wireless network using iw. I tried the process on 3 different computers but the result is always the same.

The computer where I would like to install Gentoo has an Atheros AR9227 wireless card. lspci -k return the device driver is correctly loaded.

Let's suppose my wireless network has:

SSID: MY-SSID (it's not my real SSID, the real one is 4 chars long)
Password: wireless-password (it's not my real password, the real one is 9 chars long no special chars just a capital letter, a number and other 7 chars)

Following the hand book manual I type:

ifconfig -a return the device name is wlp4s2.

ip link set dev wlp4s2 up, no message returned so it works

iw dev wlp4s2 connect -w MY-SSID key 0:wireless-password (or d:0:wireless-password) (both do not work)

hereafter the error message which seems related on the way I enter the key

WARNING: at list one error occurred. (-1)
key must be [d:]index:data where
'd:' means default (transmit) key
'index:' is a single digit (0-3)
'data' must be 5 or 13 ascii chars

Please note: if change my network to an open network with NO password using: iw dev wlp4s2 connect -w MY-SSID I get immediately connected. So there is something wrong with the key part of the command.

Any idea how to fix it?

Thanks and regards
Enrico
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3875

PostPosted: Sun Dec 11, 2022 9:52 am    Post subject: Reply with quote

Yes please use an ubuntu live iso to install Gentoo.
It will configure your wireless connection in a jiff.
_________________
:)
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 4018
Location: Bavaria

PostPosted: Sun Dec 11, 2022 3:49 pm    Post subject: Reply with quote

[I have merged your both topics together. -- pietinger]
Back to top
View user's profile Send private message
enrico3791
Tux's lil' helper
Tux's lil' helper


Joined: 03 Sep 2010
Posts: 77

PostPosted: Sun Dec 11, 2022 7:08 pm    Post subject: Reply with quote

"Yes please use an ubuntu live iso to install Gentoo.
It will configure your wireless connection in a jiff."


How can install Gentoo from an Ubuntu live iso?

Anyway, somehow the idea is good. I tried with a Live iso of Mint 20.1. I opened a terminal and I tried to configure the wireless network with the same command used for Gentoo. In order:

ifconfig -a ( the wireless card is wpl4s2)

ip link set dev wlp4s2 up (no message returned so it works)

iw dev wlp4s2 connect -w MY-SSID key 0:wireless-password (or d:0:wireless-password)

Result is the exactly the same:

WARNING: at list one error occurred. (-1)
key must be [d:]index:data where
'd:' means default (transmit) key
'index:' is a single digit (0-3)
'data' must be 5 or 13 ascii chars
or 10 or 26 hex digits
for example: d:2:6162636465 is the same as d:2:abcde


Resuming the problem: I have this early message, beginning of a Gentoo installation, on 3 different computers and the also using a Mint iso.

What am I doing un-correctly?

Enrico
Back to top
View user's profile Send private message
Leonardo.b
Apprentice
Apprentice


Joined: 10 Oct 2020
Posts: 294

PostPosted: Sun Dec 11, 2022 10:57 pm    Post subject: Reply with quote

iw probably doesn't support your WiFi encryption.
https://wireless.wiki.kernel.org/en/users/Documentation/iw
wpa_supplicant is a good alternative, avaiable in Gentoo.

From Linux Mint, you can simply use the graphical interface to connect to the network.
Back to top
View user's profile Send private message
gentoo_ram
Guru
Guru


Joined: 25 Oct 2007
Posts: 474
Location: San Diego, California USA

PostPosted: Wed Dec 14, 2022 4:09 pm    Post subject: Reply with quote

Yes, the 'iw' commands are designed for WEP which isn't used on modern networks anymore. wpa_supplicant supports WPA, WPA2, and WPA3. You should use wpa_supplicant to authenticate and attach to the network. Then use dhcpcd to get an IP address once authenticated.
Back to top
View user's profile Send private message
enrico3791
Tux's lil' helper
Tux's lil' helper


Joined: 03 Sep 2010
Posts: 77

PostPosted: Thu Dec 15, 2022 1:18 pm    Post subject: Reply with quote

I tried also with wpa_supplicant but I can't complete the process. I used these sequence of command:

ifconfig wlp2s0 up works no problem

iwlist wlp2s0 scan | grep ESSID I can see my SSID listed

wpa_passphrase MU-SSID wireless-password | tee /etc/wpa_supplicant.conf no problem it works

sudo wpa_supplicant -B -c /etc/wpa_supplicant.conf -i wlp2s0 no error message, so it works

dhclient wlp2s0 here I have the error message command not found.

How can I go further and complete the process?

Enrico
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3875

PostPosted: Thu Dec 15, 2022 2:39 pm    Post subject: Reply with quote

Plz use ubuntu live desktop.
It will prompt you to connect to network.
If not click the NM applet icon.
Do NOT try it from terminal.
If you must use terminal use iwd
see
[url]
https://wiki.archlinux.org/title/iwd#iwctl
[/url]
wpa_supplicant is a bit disgusting.
I also never succeeded connecting in my home wifi via it
I always use iwd.
Please avoid wasting your time trying to terminall connect to wifi just for installing Gentoo.
After installation you can try it more relaxedly.
If possible please use ethernet.
Quote:

How can install Gentoo from an Ubuntu live iso?

Anyway, somehow the idea is good. I tried with a Live iso of Mint 20.1. I opened a terminal and I tried to configure the wireless network with the same command used for Gentoo. In order:


The same way you would via Gentoo install cd.
Better.
You only need a linux environment.
Any is ok.
Try ubuntu.They are meticulouss about wifi connections because they address "beginners".
_________________
:)
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21497

PostPosted: Thu Dec 15, 2022 3:16 pm    Post subject: Reply with quote

enrico3791 wrote:
Password: wireless-password (it's not my real password, the real one is 9 chars long no special chars just a capital letter, a number and other 7 chars)

WARNING: at list one error occurred. (-1)
key must be [d:]index:data where
'd:' means default (transmit) key
'index:' is a single digit (0-3)
'data' must be 5 or 13 ascii chars
I do not use iw, but as I read this error, if your password is not 5 or 13 characters long, then you cannot use iw to enter it. Per your post, your password is 9 characters long. Perhaps switching to a 13 character password would work.
Back to top
View user's profile Send private message
enrico3791
Tux's lil' helper
Tux's lil' helper


Joined: 03 Sep 2010
Posts: 77

PostPosted: Fri Dec 16, 2022 12:46 pm    Post subject: Reply with quote

Thanks to everybody for the help, but please note I have this problem of wi-fi connection at Gentoo installation using the Minimal -CD. If I can't manage to setup the connection I can't go further with the installation of Gentoo.

I can't imagine I'm the only one having this problem. I just follow the instruction of the Gentoo Hanbook. Nobody else is using a wireless network with WPA to install Gentoo?
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21497

PostPosted: Fri Dec 16, 2022 4:18 pm    Post subject: Reply with quote

enrico3791 wrote:
During installation I simply turned my wireless network to an open network to avoid the password problem.
If you successfully installed Gentoo with an open network, you should be able to install wpa_supplicant and dhcpcd over that same open network, then use them once the network is again secured. Does that not work for you?
enrico3791 wrote:
I would like to avoid to disclose my real SSID and password, so the below are just for this topic purposes:

Password: wireless-password (real password is 9 chars long)
It may be clearer to write your placeholder as Password1, to show the actual length, while withholding the true value.
enrico3791 wrote:
How can install Gentoo from an Ubuntu live iso?
The installation instructions only require a working Linux environment with a relatively modern kernel. Whether you boot from a Gentoo minimal CD or an Ubuntu live CD, you get what you need. You can then create partitions, download the stage3, unpack it, and so on.
enrico3791 wrote:
I opened a terminal and I tried to configure the wireless network with the same command used for Gentoo. In order:

iw dev wlp4s2 connect -w MY-SSID key 0:wireless-password (or d:0:wireless-password)

Result is the exactly the same:

WARNING: at list one error occurred. (-1)
key must be [d:]index:data where
'd:' means default (transmit) key
'index:' is a single digit (0-3)
'data' must be 5 or 13 ascii chars
or 10 or 26 hex digits
for example: d:2:6162636465 is the same as d:2:abcde
This is expected. You are still trying to use iw in a way that will not work. Ubuntu's iw is not modified to accept inputs that Gentoo's iw rejects. You must either use iw as its instructions state, or not use iw at all.
enrico3791 wrote:
What am I doing un-correctly?
You are using iw with a key it does not accept, according to its error message. You must specify a key that it will accept.
enrico3791 wrote:
I tried also with wpa_supplicant but I can't complete the process. I used these sequence of command:

dhclient wlp2s0 here I have the error message command not found.
If the command is not found, then you need to install it, or use a different command. The instructions you were responding to told you to use dhcpcd, not dhclient:
gentoo_ram wrote:
You should use wpa_supplicant to authenticate and attach to the network. Then use dhcpcd to get an IP address once authenticated.
enrico3791 wrote:
Thanks to everybody for the help, but please note I have this problem of wi-fi connection at Gentoo installation using the Minimal -CD. If I can't manage to setup the connection I can't go further with the installation of Gentoo.
As suggested above, you could use an Ethernet connection, or use a different live environment. For some wireless cards, you might get success just by using wpa_supplicant with dhcpcd.
enrico3791 wrote:
I can't imagine I'm the only one having this problem. I just follow the instruction of the Gentoo Hanbook. Nobody else is using a wireless network with WPA to install Gentoo?
According to what gentoo_ram wrote above, which seems to be confirmed by the wireless wiki for iw, you cannot use iw for WPA:
https://wireless.wiki.kernel.org/en/users/Documentation/iw#establishing_a_basic_connection wrote:
You can use iw to connect to an AP directly if and only if the AP has:
  • No encryption
  • Uses WEP for encryption
Notably absent from this list is WPA. Just above that is a more pointed warning:
https://wireless.wiki.kernel.org/en/users/Documentation/iw wrote:
If you need to connect to an AP with WPA or WPA2 encryption requirements then you must use wpa_supplicant.
Personally, I prefer Ethernet for a Gentoo installation even when wireless works, because I can get better download speeds over Ethernet, and an initial install can require several gigabytes of downloads.

The handbook specifically states that you cannot use iw for WPA:
https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Networking#Preparing_for_wireless_access wrote:
Note
If the wireless network is set up with WPA or WPA2, then wpa_supplicant needs to be used. For more information on configuring wireless networking in Gentoo Linux, please read the Wireless networking chapter in the Gentoo Handbook.
Back to top
View user's profile Send private message
enrico3791
Tux's lil' helper
Tux's lil' helper


Joined: 03 Sep 2010
Posts: 77

PostPosted: Thu Dec 29, 2022 9:50 am    Post subject: Reply with quote

Let's close this topic. I manage to install using a wired network, but still I have some network problem so I open a new topic.
Thanks to everybody for the support.
Enrico
Back to top
View user's profile Send private message
haf1zoglu
n00b
n00b


Joined: 28 Nov 2022
Posts: 12

PostPosted: Sun Feb 05, 2023 8:53 am    Post subject: Reply with quote

I got the same problem with enrico just with the difference i got into this issue after installing the gentoo on my laptop.

Installation guide followed and net-setup helped to connect my wifi network easily. But after installation and reboot, i couldnt connect to network. Wifi configuration is quite hard for a new user.
wpa_supplicant is also very hard to manage for a beginner.


Ah also beside that when i disable my password and made the network open access, even in this case i couldnt connect.

Happy to provide any output if you need for assistance. Thanks in advance.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21497

PostPosted: Sun Feb 05, 2023 2:46 pm    Post subject: Reply with quote

haf1zoglu wrote:
I got the same problem with enrico
I think this is incorrect, since:
haf1zoglu wrote:
Ah also beside that when i disable my password and made the network open access, even in this case i couldnt connect.
enrico3791 wrote:
Please note: if change my network to an open network with NO password using: iw dev wlp4s2 connect -w MY-SSID I get immediately connected.
In enrico3791's case, removing the password allowed use of the network. In your case, it does not. Therefore, you do not have the same problem. You may also be encountering the iw error discussed in this thread, but we cannot determine that since you did not provide any error messages.
haf1zoglu wrote:
But after installation and reboot, i couldnt connect to network. Wifi configuration is quite hard for a new user.
Yes. Wired Ethernet is much simpler to use, and in my opinion, a better choice to start. After wired Ethernet works well, then you can look at using wireless.

If you need assistance, please give us something to work with. Since you do not have the same problem as enrico3791, we cannot make any assumptions about what hardware you have or how you have configured it. I suggest we address your problems in a separate thread, and link to that thread here for anyone who wants to follow along. I see that you provided some environment information in net-setup details. We could use that thread to get your network up.
Back to top
View user's profile Send private message
haf1zoglu
n00b
n00b


Joined: 28 Nov 2022
Posts: 12

PostPosted: Sun Feb 05, 2023 3:20 pm    Post subject: Reply with quote

Hu wrote:
haf1zoglu wrote:
I got the same problem with enrico
I think this is incorrect, since:
haf1zoglu wrote:
Ah also beside that when i disable my password and made the network open access, even in this case i couldnt connect.
enrico3791 wrote:
Please note: if change my network to an open network with NO password using: iw dev wlp4s2 connect -w MY-SSID I get immediately connected.
In enrico3791's case, removing the password allowed use of the network. In your case, it does not. Therefore, you do not have the same problem. You may also be encountering the iw error discussed in this thread, but we cannot determine that since you did not provide any error messages.
haf1zoglu wrote:
But after installation and reboot, i couldnt connect to network. Wifi configuration is quite hard for a new user.
Yes. Wired Ethernet is much simpler to use, and in my opinion, a better choice to start. After wired Ethernet works well, then you can look at using wireless.

If you need assistance, please give us something to work with. Since you do not have the same problem as enrico3791, we cannot make any assumptions about what hardware you have or how you have configured it. I suggest we address your problems in a separate thread, and link to that thread here for anyone who wants to follow along. I see that you provided some environment information in net-setup details. We could use that thread to get your network up.


thanks a lot for your time and composing that reply on my activity. Yes you are absolutely right, its not similar to enrico3791's issue. When i realised i went differently. Looking for follow up on the seperate thread i raised as you mentioned. net-setup details
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum