File System with Buildroot - Network & Keyboard issues - linux

I'm using Buildroot to create a file system to run on a ARM target.
After a few attempts, I managed to make it work but I noticed a few problems.
There wasn't any package manager.
It's impossible to install new utilities. I've found this question about opkg and I'll try to include it before the compilation of Buildroot
The keyboard has been set with the us_US layout.
Is it possible to set the default keyboard layout to it_IT from buildroot instead of loading a configuration file with loadkmap in /etc/rcS?
The ping and the wget commands show
ping www.google.com
ping: bad address google.com
Is there any specific configuration to do in Buildroot in order to solve this problem?
The network point is the most important.
Here is the output of the ifconfig command:
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:25702 errors:0 dropped:0 overruns:0 frame:0
TX packets:25702 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 MB) TX bytes:0 (0.0 MB)

Regarding you question about keyboard layout: There is no way of setting the keyboard layout from the buildroot configuration.
You need to configure it from an init script under /etc/init.d (not in /etc/init.d/rcS; that script is solely used for running the scripts under /etc/init.d/* and should normally not be modified).
See e.g. http://git.buildroot.org/buildroot/tree/system/skeleton/etc/init.d/S40network for a simple template to base your init script on.

Related

WLan0 connection on pi3 similar device[yocto] [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 3 years ago.
Improve this question
I have a Yocto-Box that's that based on this tutorial. Everything is fine except Wifi. I can't get wlan0 interface running. I don't why it is having problems !
here is what I've done:
root#MYONE:~# ifconfig
eth0 Link encap:Ethernet HWaddr 74:FE:48:3A:55:AB
inet addr:192.168.178.88 Bcast:192.168.178.255 Mask:255.255.255.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
eth1 Link encap:Ethernet HWaddr 74:FE:48:3A:55:AC
inet addr:192.168.178.89 Bcast:192.168.178.255 Mask:255.255.255.0
inet6 addr: fe80::76fe:48ff:fe3a:55ac%4804152/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4965 errors:0 dropped:0 overruns:0 frame:0
TX packets:8457 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:279140 (272.5 KiB) TX bytes:3066125 (2.9 MiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1%4804152/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:169 errors:0 dropped:0 overruns:0 frame:0
TX packets:169 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:12859 (12.5 KiB) TX bytes:12859 (12.5 KiB)
wlan0 Link encap:Ethernet HWaddr 02:00:EA:FF:D2:06
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
this is the wpa_supplicant.conf file:
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
update_config=1
network={
ssid="FRITZ!Box 7630 MO"
psk="42483903143454867118"
key_mgmt=WPA-PSK
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
auth_alg=OPEN
}
the data is similar to another pi3 which's connected via Wifi !
and when I take a look into the log file here is what I get:
ifconfig: SIOCGIFFLAGS: No such device
Successfully initialized wpa_supplicant
Line 1: unknown global field 'Passphrase must be 8..63 characters'.
Line 1: Invalid configuration line 'Passphrase must be 8..63 characters'.
Failed to read or parse configuration '/usr/customized/infrastructure/rootfs/config/wpa.conf'.
udhcpc (v1.24.1) started
Sending discover...
Sending discover...
Sending discover...
No lease, forking to background
Does anybody has a idea how may solve this !
UPDATE
Thanks to #dagelf answer, here's the output of iwconfig
root#MYONE:~# iwconfig
sit0 no wireless extensions.
lo no wireless extensions.
wlan0 IEEE 802.11abgn ESSID:off/any
Mode:Managed Access Point: Not-Associated Tx-Power=20 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
eth1 no wireless extensions.
eth0 no wireless extensions.
root#MYONE:~# lsmod
Module Size Used by
bnep 19037 2
wcn36xx 71132 0
venus 66686 0
videobuf2_dma_sg 13896 1 venus
v4l2_mem2mem 16221 1 venus
tpm_spi_tis 4055 0
tpm 50326 1 tpm_spi_tis
smsc75xx 38940 0
root#MYONE:~#
As you can see the interface is detected !
Thanks a lot in advance!
The only thing that needs to be in the wpa_supplicant.conf file, is the details for a network to connect to. You can create a fresh file with:
wpa_passphrase Mywifinetwork > /usr/customized/infrastructure/rootfs/config/wpa.conf
*type in passphrase for Mywifinetwork and then enter*
The error message you're getting says that your passphrase isn't long enough. That might in fact be the only thing wrong...
Further on it mentions the above wpa.conf file - so I don't think it's using the wpa_supplicant.conf file you have. You can leave out everything from the > and it will just echo it to the console, then you can copy and paste it into that wpa.conf file. Also, I see you have the KEY_MGMT clause in there twice, and some spaces at the beginning - it might not like that - if it is actually using that file. I suspect a typo somewhere when you set this up.
You can test the wpa_supplicant.conf file - and connect manually with:
ifconfig wlan0 up
wpa_supplicant -Dnl80211 -iwlan0 -c/usr/customized/infrastructure/rootfs/config/wpa.conf
That should connect you to the wireless network. Then, in another terminal window, you need to get an IP address from the network:
dhclient -d -i wlan0
Then you should be connected. But there are also programs, like NetworkManager, that try to do this automatically in the background and will interfere with this process, so it is best to use the system's preferred configuration methods.
The wireless interface will only show up when there is a wireless driver loaded. It is increasingly rare to find a device for which there is not wireless driver... but usually you can just use a USB wireless adapter for those devices.
The wireless device can also be called "eth0" or "eth1". An easy way to tell is to run the command:
iwconfig
It only shows wireless devices.
You can also try
iw dev
If neither of those commands are present, you can look at the boot log for clues, eg:
dmesg | grep -i wireless
Or
grep -i wireless /var/log/messages
Or
grep -i wireless /var/log/syslog
Or
lsmod
Where you can see if you can find the module loaded for your wireless device.
To see all the modules available on your system, you can look in /usr/src/linux*/drivers/net/wireless, eg.
find /usr/src/linux*/drivers/net/wireless
Or
echo `for a in /usr/src/linux*; do (cd $a/drivers/net/wireless; for b in */*; do echo $b; done); done|egrep -v '(Makefile|Kconfig)'|cut -d\/ -f2|sort|uniq`
In very rare circumstances, you will need to manually enable your device by loading its driver, eg:
modprobe -v ath10k
(The -v is just so it shows more detail, but you can just "dmesg" afterward too. If there is no "dmesg" command, you can also:)
cat /dev/kmsg
Sometimes wireless drivers or devices crash, in which case you might be able to fix them without a reboot with a:
rmmod iwlmvm
modprobe iwlmvm
(This is the driver for some intel devices which regularly crash on me.)
I hope you've learned about one of the important cornerstones of Linux with this!
Many bigger systems, like Ubuntu and Fedora, rename the interfaces to things like "wlp2s0" or "enp5s1n2" or "enx908723081" - in a repeatable manner - because depending on the kernel and boot process, if you have 2 similar cards, they could sometimes reverse order - such that eth0 is what used to be eth1, and vice versa - causing your device to connect the wrong interfaces to the wrong networks.

Docker host config has wrong IP address

I'm trying to install Docker on Raspbian but it seems to have picked up an old config from somewhere. No idea where from, as I can't find any references anywhere.
I have installed Docker on Raspbian using sudo apt-get install docker-ce.
When I try to connect to Docker, it tries to connect to the wrong IP address (192.168.1.75 when it should be 192.168.1.227).
$ docker ps
error during connect: Get http://192.168.1.75:2376/v1.38/containers/json: dial tcp 192.168.1.75:2376: connect: no route to host
The server used to be on 192.168.1.75 but is now on 192.168.1.227.
$ ifconfig eth0
eth0 Link encap:Ethernet HWaddr b8:27:eb:50:b4:16
inet addr:192.168.1.227 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:42704 errors:0 dropped:0 overruns:0 frame:0
TX packets:61093 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:6278037 (5.9 MiB) TX bytes:80578119 (76.8 MiB)
I've tried rebooting the server, deleting the contents of the /var/run/docker folder, and even reinstalling Docker. It's still determined that the IP address is 192.168.1.75.
You can set the machine where the docker command tries to connect with the DOCKER_HOST environment variable:
export DOCKER_HOST="tcp://192.168.1.227:2376"
But it's strange that you have to do this on a default installation, perhaps they is a DOCKER_HOST variable in you bash/zsh profile that cause this problem ?

difference between eth0 and venet0 configuration on CentOS 6.3

I followed this tutorial to set up a nameser using BIND on my VPS built in CentOS 6.3 64-bit. I have two VPS servers, one is virtualized by Xen, and the other is by OpenVZ. I noticed that the two servers differ in their network interface: Xen server has eth0 (configured /etc/sysconfig/network-scripts/ifcfg-eth0), while OpenVZ has venet0 (/etc/sysconfig/network-scripts/ifcfg-venet0).
When I follow that tutorial, the nameserver on my Xen server is working well, but the nameserver on OpenVZ server does not work at all. This made me think why and what difference made them work differently for the nameserver?
The following is the result I got from "ifconfig" command:
[root#server1 data]# ifconfig
lo Link encap:Local Loopback
**inet addr:127.0.0.1** Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:112 errors:0 dropped:0 overruns:0 frame:0
TX packets:112 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:10819 (10.5 KiB) TX bytes:10819 (10.5 KiB)
venet0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:50.31.115.236 P-t-P:50.31.115.236 Bcast:0.0.0.0 Mask:255.255.255.255
UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1
RX packets:539325 errors:0 dropped:0 overruns:0 frame:0
TX packets:368277 errors:0 dropped:80 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:41142712 (39.2 MiB) TX bytes:37293025 (35.5 MiB)
As you can see that venet0 has its inet addr:127.0.0.1. Could someone help me with understanding the differences? Thanks
According to the information you included in your question venet0 has the IP 50.31.115.236. The 127.0.0.1 you see is for the special network interface lo.
Usually the first network interface is named eth0. Virtualizing with Xen doesn't change that as it is pretending to be just a normal hardware. OpenVZ is working a bit different and as I understand it the name of the ethernet device venet0 got set by the system administrator of the physical machine.
I can't take a look at the linked tutorial as I only get a blank page so can only give a general advice: Wherever it is showing eth0 use venet0 instead for the second system.

wireshark doesn't display icmp traffic between tow logical interafce

I add tow logical interfaces for test with the following commands :
# set link on physical Device Up
sudo ip link set up dev eth0
# create logical Interfaces
sudo ip link add link eth0 dev meth0 address 00:00:8F:00:00:02 type macvlan
sudo ip link add link meth0 dev meth1 address 00:00:8F:00:00:03 type macvlan
# order IP Addresses and Link
sudo ip addr add 192.168.56.5/26 dev meth0
sudo ip addr add 192.168.56.6/26 dev meth1
sudo ip link set up dev meth0
sudo ip link set up dev meth1
ifconfig
meth0 Link encap:Ethernet HWaddr 00:00:8f:00:00:02
inet addr:192.168.56.5 Bcast:0.0.0.0 Mask:255.255.255.192
inet6 addr: fe80::200:8fff:fe00:2/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:35749 errors:0 dropped:47 overruns:0 frame:0
TX packets:131 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3830628 (3.8 MB) TX bytes:15278 (15.2 KB)
meth1 Link encap:Ethernet HWaddr 00:00:8f:00:00:03
inet addr:192.168.56.6 Bcast:0.0.0.0 Mask:255.255.255.192
inet6 addr: fe80::200:8fff:fe00:3/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:35749 errors:0 dropped:47 overruns:0 frame:0
TX packets:115 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3830628 (3.8 MB) TX bytes:14942 (14.9 KB)
I run "wireshark" to test traffic between meth0 and meth1 ,
so I execute ping 192.168.56.6 to generate icmp traffic but this traffic doesn't appear in wireshark .
there is a a problem in wireshark with logical interface ?
Is there a problem in wireshark with logical interface?
Probably not. You'll probably see the same problem with tcpdump, netsniff-ng, or anything else that uses PF_PACKET sockets for sniffing on Linux (Linux in general, not just Ubuntu in particular, or even Ubuntu, Debian, and other Debian-derived distributions).
Given that those are two logical interfaces on the same machine, traffic between them will not go onto the Ethernet - no Ethernet adapters I know of will receive packets that they transmit, so if the packet were sent on the Ethernet the host wouldn't see it, and there wouldn't be any point in wasting network bandwidth by putting that traffic on the network even if the Ethernet adapter would see its own traffic.
So if you're capturing on eth0, you might not see the traffic. Try capturing on lo instead.

Using BusyBox version of netcat for listening tcp port

I need to listen some arbitrary port inside the Linux embedded box.
I chose port 6660 because it is meant for uncrypted connections anyway and since the Linux box running customized Linux OS there are not many ports open.
I found out that netcat (nc on command line) would be the easiest and the best ready to go solution for that, so I do not have to start programming some C program for that purpose.
I managed to grasp the command and options and I implemented simplest way to listen plain text on my PC from another PC like this:
sven#sven:~$ nc 192.168.4.110 6660
sven#sven:~$ hello there!
anotherUser#userg:~$ nc -l -p 6660
anotherUser#userg:~$ hello there!
But the case is that the netcat tool is coming with the busybox package on that Linux box. And I am not sure what would be the syntax how to listen a port (6660 for example). I always get the same dialog:
~ # nc -l -p 6660
BusyBox v1.17.1 (Debian 1:1.17.1-8) multi-call binary.
Usage: nc [IPADDR PORT]
Open a pipe to IP:PORT
Also I've tried many other ways how to implement listening but cant get it done.
I assume at least it would give me any options? also
nc -h
or
nc --help
dont give any "minus" options
But sending the text from Linux embedded box to my PC works:
~ # nc 192.168.4.130 6660
fsdf
tere
^C
~ #
sven#sven:~$ nc -l -p 6660
fsdf
tere
Linux embedded box has fully functional net connection inside the same local network and has existing eth0 and lo links
eth0 Link encap:Ethernet HWaddr D0:E3:47:00:03:5F
inet addr:192.168.4.179 Bcast:192.168.4.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:28046281 errors:0 dropped:0 overruns:0 frame:0
TX packets:428464 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2458890234 (2.2 GiB) TX bytes:83021395 (79.1 MiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:2282 errors:0 dropped:0 overruns:0 frame:0
TX packets:2282 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:444956 (434.5 KiB) TX bytes:444956 (434.5 KiB)
Töövõite!
Here's the manual page for busybox's nc implementation.
The correct syntax is
nc -l -p <port>
The issue is, I think, that your version of busybox is compiled without nc listening capabilities. Indeed there's a config option at build time, NC_SERVER, that needs to be enabled to turn that feature on.
Can you build another nc, perhaps from this version, and copy the binary onto your embedded host? You may need to build a cross-compiler environment.

Resources