Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DietPi-System | C1+ | Issue to setup WLAN device #273

Closed
k-plan opened this issue Apr 11, 2016 · 90 comments
Closed

DietPi-System | C1+ | Issue to setup WLAN device #273

k-plan opened this issue Apr 11, 2016 · 90 comments

Comments

@k-plan
Copy link
Contributor

k-plan commented Apr 11, 2016

http://fuzon.co.uk/phpbb/viewtopic.php?f=11&t=368

@Fourdee
Copy link
Collaborator

Fourdee commented Apr 11, 2016

@k-plan
Thanks for the report 👍 Excellent write up.

I've got 2 different WiFi dongles, i will try them on my C1 and see if I get same results. Might be a few days, but i'll set this to v116 so I dont forget :)

@Fourdee Fourdee added this to the v116 milestone Apr 11, 2016
@Fourdee
Copy link
Collaborator

Fourdee commented Apr 11, 2016

@k-plan
Just tried a generic chinatown WiFi adapter. It doesnt appear to work on DHCP. But setting it to static did the trick.

I cant see why this is C1 specific. dietpi-config uses the same code to control the adapters. It may be a bug in the kernel/modules, or even DietPi. I'll do some more testing and see if we can find the cause.

@Fourdee
Copy link
Collaborator

Fourdee commented Apr 11, 2016

@k-plan
What PSU are you using for the C1+?

@k-plan
Copy link
Contributor Author

k-plan commented Apr 11, 2016

@Fourdee

What PSU are you using for the C1+?

I have tried different for testing.

Normally I use: Anker PowerPort 10 (60W 10-Port USB) 5V - 2.4A per Port or 12A total.

For special WiFi adapter testing: HN Power HNP18-050 - 5 V/DC 3 A 15 W

As well tested WiFi adapter with a additionally active powered USB hub Logitech H-UE5 with PSU 5 V/DC 2.5 A

Measurement current draw:

  • C1+ after boot - 0.38 A
  • C1+ after boot with active WiFi adapter - 0.51 A

I cant see why this is C1 specific.

It take a long time, until I have notion, to test it on DietPi Raspberry Pi B+. But with this, it works instantly.

a bug in the kernel/modules ...

😢 ... please no .... 😢

It doesnt appear to work on DHCP. But setting it to static did the trick.

Will test it. You will get response.

Thanks for your help. 👍

@k-plan
Copy link
Contributor Author

k-plan commented Apr 11, 2016

@Fourdee

root@oDroid-C1_plus-test:~# lsusb
Bus 001 Device 003: ID 7392:7822 Edimax Technology Co., Ltd
Bus 001 Device 002: ID 05e3:0610 Genesys Logic, Inc. 4-port hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

root@oDroid-C1_plus-test:~# lsmod
Module                  Size  Used by
nls_cp437               5134  1
8192cu                523594  0
w1_gpio                 3178  0
wire                   20357  1 w1_gpio
aml_gpio                7315  0
fuse                   72461  1
autofs4                22325  2

Set WiFi to static breaks all my network connections ....

Must do a reboot via keyboard.

After this I tried:

root@oDroid-C1_plus-test:~# ifup wlan0
Error for wireless request "Set Power Management" (8B2C) :
    SET failed on device wlan0 ; Operation not permitted.
Error for wireless request "Set Encode" (8B2A) :
    invalid argument "000test-12345".
RTNETLINK answers: File exists
Failed to bring up wlan0.

000test-12345 is my wireless-key (WEP), but my WiFi network only support WPA2 PSK !

root@oDroid-C1_plus-test:~# dmesg
 . . .
[  332.648763] WARN::hc_xfer_timeout:2719: hc_xfer_timeout: timeout on channel 4
[  332.686034] WARN::hc_xfer_timeout:2721:      start_hcchar_val 0x00d88a00
[  332.723060] WARN::hc_xfer_timeout:2726:      chn-4,ep1-IN:type:2,speed:2,len:15360,addr3

[  370.588842] WARN::hc_xfer_timeout:2719: hc_xfer_timeout: timeout on channel 2
[  370.627114] WARN::hc_xfer_timeout:2721:      start_hcchar_val 0x00d88a00
[  370.664335] WARN::hc_xfer_timeout:2726:      chn-2,ep1-IN:type:2,speed:2,len:15360,addr3

Default locale for the system environment:

root@oDroid-C1_plus-test:~# dpkg-reconfigure locales
Generating locales (this might take a while)...
  en_GB.UTF-8... done
Generation complete.

Hmmm ... think I will start from the scratch.

@Fourdee
Copy link
Collaborator

Fourdee commented Apr 12, 2016

@k-plan
Did another test on my Edimax:

Bus 001 Device 003: ID 7392:7811 Edimax Technology Co., Ltd EW-7811Un 802.11n Wireless Adapter [Realtek RTL8188CUS]

Cant get it to connect, but scans fine. Couldn't find anything obvious in dmesg. It seems to fail receiving data during the DHCP request:

root@DietPi:~# ifup wlan0
Error for wireless request "Set Power Management" (8B2C) :
    SET failed on device wlan0 ; Operation not permitted.
Internet Systems Consortium DHCP Client 4.3.1
Copyright 2004-2014 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/wlan0/74:da:38:26:9d:65
Sending on   LPF/wlan0/74:da:38:26:9d:65
Sending on   Socket/fallback
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 4
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 9
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 15
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 7
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 7
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 13
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 6
No DHCPOFFERS received.
No working leases in persistent database - sleeping.

It looks like a possible kernel issue and/or modules. I found this ticket on the Odroid C1 Kernel: hardkernel/linux#179

When I get some time, I will compile the C1 kernel/modules and retest. If you want to try it also, instructions are here: http://odroid.com/dokuwiki/doku.php?id=en:c1_building_kernel

@k-plan
Copy link
Contributor Author

k-plan commented Apr 12, 2016

@Fourdee

Cant get it to connect, but scans fine.

Yes, all my tested adapters do scans fine, but no WiFi link connected.

Error for wireless request "Set Power Management" (8B2C) :
    SET failed on device wlan0 ; Operation not permitted.

You can try (test):
Comment Power Management out in
/etc/network/interfaces

and set up : nano /etc/modprobe.d/8192cu.conf

with following content: options 8192cu rtw_power_mgnt=0 rtw_enusbss=0

now: service networking restart (Link)

When I get some time, I will compile the C1 kernel/modules and retest.

Nice, thanks! I have to waiting for this.
Sorry, but compile "my own kernel" overcharged me. No skill, hardware or software.

Where is also a rtl8192cu-fixes USB WiFi driver, but I can't get it on work.
This hint is form Igor Pečovnik. A well tried his new Odroid C1 Armbian image, but it will not boot for me.

@k-plan
Copy link
Contributor Author

k-plan commented Apr 13, 2016

@Fourdee

don't think it's the module.

ubuntu-14.04.3lts-lubuntu-odroid-c1-20151020 => Edimax EW-7612UAn V2 working with dhcp

root@odroid-c1-Plus-test:~# uname -a
Linux odroid-c1-Plus-test 3.10.96-148 #1 SMP PREEMPT Thu Apr 7 10:45:50 BRT 2016 armv7l armv7l armv7l GNU/Linux

root@odroid-c1-Plus-test:~# modinfo 8192cu
filename:       /lib/modules/3.10.96-148/kernel/backports/drivers/realtek/8192cu/8192cu.ko
version:        v4.0.2_9000.20130911
author:         Realtek Semiconductor Corp.
description:    Realtek Wireless Lan Driver
license:        GPL
version:        backported from Linux (next-20150129-0-g828f79f) using backports backports-20150129-0-gdd4a670
srcversion:     92ABD77EE49D06D8157B4F8

DietPi_v109_Odroid-C1-(Jessie) auto updated to v115 => Edimax EW-7612UAn V2 not working with dhcp

root@oDroid-C1-Plus-TEST:~# uname -a
Linux oDroid-C1-Plus-TEST 3.10.80 #1 SMP PREEMPT Sun Mar 13 15:50:53 CET 2016 armv7l GNU/Linux

root@oDroid-C1-Plus-TEST:~# modinfo 8192cu
filename:       /lib/modules/3.10.80/kernel/backports/drivers/realtek/8192cu/8192cu.ko
version:        v4.0.2_9000.20130911
author:         Realtek Semiconductor Corp.
description:    Realtek Wireless Lan Driver
license:        GPL
version:        backported from Linux (next-20150129-0-g828f79f) using backports backports-20150129-0-gdd4a670
srcversion:     92ABD77EE49D06D8157B4F8

@Fourdee
Copy link
Collaborator

Fourdee commented Apr 13, 2016

@k-plan

Comment Power Management out in

Yep, that will prevent the error occurring, but theres no harm in having it there. Its used by some adapters.

All DietPi images having the following:

#wifi dongles
echo -e "options 8192cu rtw_power_mgnt=0" > /etc/modprobe.d/8192cu.conf
echo -e "options 8188eu rtw_power_mgnt=0" > /etc/modprobe.d/8188eu.conf

Prevents those common WiFi modules from going into powersaving mode (up and down, up then down lol).

I'll compile the C1 kernel today. As per you previous post, modules appear identical.

@Fourdee
Copy link
Collaborator

Fourdee commented Apr 13, 2016

Native compile (CC not setup). Can't get uImage to compile:

root@DietPi:~/linux# make uImage
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
make[1]: 'include/generated/mach-types.h' is up to date.
  CALL    scripts/checksyscalls.sh
  CC      scripts/mod/devicetable-offsets.s
  GEN     scripts/mod/devicetable-offsets.h
  HOSTCC  scripts/mod/file2alias.o
  HOSTLD  scripts/mod/modpost
  CHK     include/generated/compile.h
  CHK     kernel/config_data.h
  CC      drivers/amlogic/display/osd/osd_main.o
drivers/amlogic/display/osd/osd_main.c: In function ‘osd_ioctl’:
drivers/amlogic/display/osd/osd_main.c:382:4: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    aml_hwc_addr_t para;
    ^
drivers/amlogic/display/osd/osd_main.c:392:11: error: implicit declaration of function ‘osd_wait_vsync_hw’ [-Werror=implicit-function-declaration]
           osd_wait_vsync_hw();
           ^
cc1: some warnings being treated as errors
scripts/Makefile.build:308: recipe for target 'drivers/amlogic/display/osd/osd_main.o' failed
make[4]: *** [drivers/amlogic/display/osd/osd_main.o] Error 1
scripts/Makefile.build:455: recipe for target 'drivers/amlogic/display/osd' failed
make[3]: *** [drivers/amlogic/display/osd] Error 2
scripts/Makefile.build:455: recipe for target 'drivers/amlogic/display' failed
make[2]: *** [drivers/amlogic/display] Error 2
scripts/Makefile.build:455: recipe for target 'drivers/amlogic' failed
make[1]: *** [drivers/amlogic] Error 2
Makefile:803: recipe for target 'drivers' failed
make: *** [drivers] Error 2
root@DietPi:~/linux# find -name "*Image*"
./arch/powerpc/boot/zImage.lds.S
./arch/powerpc/boot/zImage.coff.lds.S
./arch/powerpc/boot/zImage.ps3.lds.S

Code to compile:

apt-get install build-essential git ncurses-dev lzop u-boot-tools -y

git clone --depth 1 https://github.com/hardkernel/linux.git -b odroidc-3.10.y
cd linux
make odroidc_defconfig

#make menuconfig
make -j $(nproc --all)
make -j $(nproc --all) modules

make modules_install

make uImage

cp arch/arm/boot/uImage /boot/
cp arch/arm/boot/dts/meson8b_odroidc.dts /boot/

@Fourdee
Copy link
Collaborator

Fourdee commented Apr 13, 2016

Restarted from scratch, uImage compiled fine:

Image Name:   Linux-3.10.96
Created:      Wed Apr 13 13:36:17 2016
Image Type:   ARM Linux Kernel Image (lzo compressed)
Data Size:    5466661 Bytes = 5338.54 kB = 5.21 MB
Load Address: 00208000
Entry Point:  00208000
  Image arch/arm/boot/uImage is ready

@Fourdee
Copy link
Collaborator

Fourdee commented Apr 13, 2016

Same issues with WiFi on this kernel.

@k-plan
Copy link
Contributor Author

k-plan commented Apr 13, 2016

@Fourdee

Same issues with WiFi on this kernel.

fu ... 😢 Sorry

Anyway, many thanks for your help and support. 👍

Does cursor work on display with this kernel? If you like, give me your kernel. I will test it for cursor issue.

@Fourdee
Copy link
Collaborator

Fourdee commented Apr 13, 2016

@k-plan
Running headless.

Once I finished this compile (did some testing), i'll upload it.

@Fourdee
Copy link
Collaborator

Fourdee commented Apr 13, 2016

@k-plan
It might be worth trying Meveric's image (which DietPi for C1 is based on). Just to see if we can replicate the issue.
http://forum.odroid.com/viewtopic.php?f=96&t=17542#p114709.

@k-plan
Copy link
Contributor Author

k-plan commented Apr 13, 2016

@Fourdee

yes, I can do so, but really Meveric's image you linked to?
It is: Debian-Jessie-1.0~RC2-20151123-XU3.img.xz

Or do you like : http://forum.odroid.com/viewtopic.php?f=114&t=17569
Debian-Jessie-1.0-20160131-C1.img.xz

Sorry, but only to be sure ...

@Fourdee
Copy link
Collaborator

Fourdee commented Apr 13, 2016

@k-plan
Yep my bad, long day:
http://forum.odroid.com/viewtopic.php?f=114&t=17569

@Fourdee
Copy link
Collaborator

Fourdee commented Apr 13, 2016

@k-plan
Uploaded zip http://dietpi.com/downloads/testing/

Not sure about /boot/uInitrd. It wasn't compiled (check modified date), or mentioned anywhere in the documentation: http://odroid.com/dokuwiki/doku.php?id=en:c1_building_kernel

@k-plan
Copy link
Contributor Author

k-plan commented Apr 14, 2016

@Fourdee

Yep my bad, long day

No problem, here as well.

Debian-Jessie-1.0-20160131-C1.img => downloaded with 64 kb/s !!! (what a mess)

root@odroid-jessie:~# uname -a
Linux odroid-jessie 3.10.80 #17 SMP PREEMPT Sat Oct 31 12:44:33 CET 2015 armv7l GNU/Linux

root@odroid-jessie:~#
Message from syslogd@localhost at Apr 14 18:11:48 ...
 kernel:[  243.938657@1] Kernel panic - not syncing: hung_task: blocked tasks

 [  663.414395] usb 1-1.2: new high-speed USB device number 4 using dwc_otg
[  663.667936] usbcore: registered new interface driver rtl8192cu

Done: "root@odroid-jessie:~# iwlist wlan0 scanning " => works! 👍


Done: " iface wlan0 inet dhcp "

root@odroid-jessie:~# ifup wlan0
Error for wireless request "Set Power Management" (8B2C) :
    SET failed on device wlan0 ; Operation not permitted.
Error for wireless request "Set Encode" (8B2A) :
    invalid argument "Not_Set".
Internet Systems Consortium DHCP Client 4.3.1
Copyright 2004-2014 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/wlan0/74:da:38:23:1c:aa
Sending on   LPF/wlan0/74:da:38:23:1c:aa
Sending on   Socket/fallback
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 8
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 13
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 12
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 18
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 8
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 2
No DHCPOFFERS received.
No working leases in persistent database - sleeping.

👎


Done: " iface wlan0 inet static "

root@odroid-jessie:~# ifup wlan0
Error for wireless request "Set Power Management" (8B2C) :
    SET failed on device wlan0 ; Operation not permitted.
RTNETLINK answers: File exists

👎


All tests as well tested with another WiFi-Roter (Channel 4) to connect => also fail! 👎

.... deleting image: Debian-Jessie-1.0-20160131-C1.img

@k-plan
Copy link
Contributor Author

k-plan commented Apr 14, 2016

Testing kernel with DietPi v115

root@oDroid-C1-Plus-TEST:~# uname -a
Linux oDroid-C1-Plus-TEST 3.10.96 #2 SMP PREEMPT Wed Apr 13 15:35:19 BST 2016 armv7l GNU/Linux

As well missing/invisible cursor on monitor/display !

Cant get it to connect ip via dhcp or static, but scans fine.
As well no connect to second Test WFfi-Router.

result:
forget Wifi, WiFi HotSpot or TOR HotSpot on Odroid C1+ (for the moment)
If you want/need it, better will buy a Raspberry Pi.

@Fourdee
Sad, not to be able to get it on work.
But it is not your fault. Sorry, you have done more than enough.
I have fiddling around with a lot images/distris for Odroid C1 in the past days.
Thus, I can tell you, DietPi is the best and noobs frindly in my hand so far.
Forget WiFi support on C1 for v.116.
Maybe there is another in future, perhaps armbian. We will see.

Not sure about /boot/uInitrd.

You can have a look here, but I don't know if it is helpful. http://forum.odroid.com/viewtopic.php?f=111&t=7965#p61873

root@oDroid-C1-Plus-TEST:~# /etc/kernel/postinst.d/initramfs-tools 3.10.96
update-initramfs: Generating /boot/initrd.img-3.10.96
Image Name:   uInitrd
Created:      Thu Apr 14 18:51:43 2016
Image Type:   ARM Linux RAMDisk Image (uncompressed)
Data Size:    3887133 Bytes = 3796.03 kB = 3.71 MB
Load Address: 00000000
Entry Point:  00000000
/etc/initramfs-tools/scripts/local-top/c1_init.sh: 24: /etc/initramfs-tools/scripts/local-top/c1_init.sh: cannot create /sys/class/ppmgr/ppscaler: Directory nonexistent
/etc/initramfs-tools/scripts/local-top/c1_init.sh: 83: /etc/initramfs-tools/scripts/local-top/c1_init.sh: cannot create /sys/class/net/eth0/queues/rx-0/rps_flow_cnt: Directory nonexistent
/etc/initramfs-tools/scripts/local-top/c1_init.sh: 84: /etc/initramfs-tools/scripts/local-top/c1_init.sh: cannot create /sys/class/net/eth0/queues/rx-0/rps_cpus: Directory nonexistent
/etc/initramfs-tools/scripts/local-top/c1_init.sh: 85: /etc/initramfs-tools/scripts/local-top/c1_init.sh: cannot create /sys/class/net/eth0/queues/tx-0/xps_cpus: Directory nonexistent

@Fourdee
Copy link
Collaborator

Fourdee commented Apr 15, 2016

@k-plan
Found the issue 👍 Always the simple things, cant believe I missed it.
I compared Wifi packages across C1 and C2. Seems we were missing some on the C1 (most importantly the wpasupplicant, iw):

C2

root@DietPi:~# dpkg -l | grep wire
ii  crda                           3.13-1                    arm64        wireless Central Regulatory Domain Agent
ii  firmware-atheros               0.43                      all          Binary firmware for Atheros wireless cards
ii  firmware-brcm80211             0.43                      all          Binary firmware for Broadcom 802.11 wireless cards
ii  firmware-ralink                0.43                      all          Binary firmware for Ralink wireless cards
ii  firmware-realtek               0.43                      all          Binary firmware for Realtek wired and wireless network adapters
ii  iw                             3.17-1                    arm64        tool for configuring Linux wireless devices
ii  wireless-regdb                 2014.11.18-1              all          wireless regulatory database
ii  wireless-tools                 30~pre9-8                 arm64        Tools for manipulating Linux Wireless Extensions
root@DietPi:~# dpkg -l | grep wpa
ii  wpasupplicant                  2.3-1+deb8u3              arm64        client support for WPA and WPA2 (IEEE 802.11i)

Install the following missing packages on your C1, reboot, then try reconnecting wifi

 apt-get install wireless-regdb iw crda wpasupplicant
root@DietPi:~# ifup wlan0
Error for wireless request "Set Power Management" (8B2C) :
    SET failed on device wlan0 ; Operation not permitted.
ioctl[SIOCSIWAP]: Operation not permitted
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWENCODEEXT]: Invalid argument
Internet Systems Consortium DHCP Client 4.3.1
Copyright 2004-2014 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/wlan0/74:da:38:26:9d:65
Sending on   LPF/wlan0/74:da:38:26:9d:65
Sending on   Socket/fallback
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 6
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 9
DHCPREQUEST on wlan0 to 255.255.255.255 port 67
DHCPOFFER from 192.168.0.1
DHCPACK from 192.168.0.1
bound to 192.168.0.101 -- renewal in 686767077 seconds.

@Fourdee
Copy link
Collaborator

Fourdee commented Apr 15, 2016

@k-plan
Ran a 2nd test to confirm, working fine.
The missing packages will be installed during the patch in the v116 update.

If you can confirm the issue is resolved for you also, let me know so we can close this ticket 👍

@k-plan
Copy link
Contributor Author

k-plan commented Apr 15, 2016

@Fourdee (Coding Beast 😄 )

Found the issue 👍 Always the simple things, cant believe I missed it.

Will it be so easy? I can't believe.
Clean automate install from the scratch is running now.
But http://oph.mdrjr.net/ is so slow (max. 64 kB/s)

Yes, I have tested before to install iw and same other wireless/wifi packages without success.

On Meveric's image I have to install, iw, usb-tools, wireless-tools and same more, to get scanning on work.

wireless-regdb , crda I have never install. I will test it.

@k-plan
Copy link
Contributor Author

k-plan commented Apr 15, 2016

@Fourdee

  • Install v.109 from the scratch.
  • install all packages you propose: apt-get install wireless-regdb iw crda wpasupplicant
  • Plugged in the WiFi dongle, no detection with lsusb, then kernel panic and freeze. Must do a power cycle.

Because it is v.109, configuration with keyboard and monitor as infrastructure wifi network with dhcp.

root@oDroid-C1-Plus-Test:~# ifup wlan0
Error for wireless request "Set Power Management" (8B2C) :
    SET failed on device wlan0 ; Operation not permitted.
Error for wireless request "Set Encode" (8B2A) :
    invalid argument "test-12345".
ioctl[SIOCSIWAP]: Operation not permitted
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWENCODEEXT]: Invalid argument
Internet Systems Consortium DHCP Client 4.3.1
Copyright 2004-2014 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/wlan0/74:da:38:23:1c:aa
Sending on   LPF/wlan0/74:da:38:23:1c:aa
Sending on   Socket/fallback
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 3
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 3
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 6
DHCPREQUEST on wlan0 to 255.255.255.255 port 67
DHCPOFFER from 192.168.88.1
DHCPACK from 192.168.88.1
bound to 192.168.88.50 -- renewal in 233 seconds.

it works! 👍


Update to v.116:

root@oDroid-C1-Plus-Test:~# dietpi-update

After reboot configuration wifi with dhcp via dietpi-config and scanning:

160415-0001

It works! 😄 👍

root@oDroid-C1-Plus-Test:~# ifup wlan0
Error for wireless request "Set Power Management" (8B2C) :
    SET failed on device wlan0 ; Operation not permitted.
Error for wireless request "Set Encode" (8B2A) :
    invalid argument "test-12345".
ioctl[SIOCSIWAP]: Operation not permitted
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWENCODEEXT]: Invalid argument
Internet Systems Consortium DHCP Client 4.3.1
Copyright 2004-2014 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/wlan0/74:da:38:23:1c:aa
Sending on   LPF/wlan0/74:da:38:23:1c:aa
Sending on   Socket/fallback
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 3
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 3
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 6
DHCPREQUEST on wlan0 to 255.255.255.255 port 67
DHCPOFFER from 192.168.88.1
DHCPACK from 192.168.88.1
bound to 192.168.88.50 -- renewal in 233 seconds.


Configuration wifi with static IP via dietpi-config and scanning:

160415-0002

root@oDroid-C1-Plus-Test:~# ifdown wlan0
ifdown: interface wlan0 not configured

root@oDroid-C1-Plus-Test:~# ifup wlan0
Error for wireless request "Set Power Management" (8B2C) :
    SET failed on device wlan0 ; Operation not permitted.
Error for wireless request "Set Encode" (8B2A) :
    invalid argument "test-12345".
ioctl[SIOCSIWAP]: Operation not permitted
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWENCODEEXT]: Invalid argument
Error: an inet prefix is expected rather than "Adresse:192.168.88.100/Maske:255.255.255.0".
Failed to bring up wlan0.

😢 👎

@k-plan
Copy link
Contributor Author

k-plan commented Apr 15, 2016

@Fourdee

Now installed DietPi WiFi HotSpot. Tested. Works! 😄 👍

5254115160

Installed DietPi Tor WiFi Hotspot. Tested. Works! 😄 👍

160415-0003

Should I test some of the other USB Wireless adapters?

@Fourdee
Copy link
Collaborator

Fourdee commented Apr 15, 2016

@k-plan

Thanks for the results 👍

Configuration wifi with static IP via dietpi-config and scanning:
https://cloud.githubusercontent.com/assets/17237601/14573615/64fa46fa-0356-11e6-9390-7536ab7ee562.gif

Looks like a possible locale + grep issue we might need to fix. Static addresses shouldn't be pulling in any text, just the IP. Can you set this to static, apply, exit, then paste results of /etc/network/interfaces.

Also, what locale are you running? (eg: en_GB, de_DE)

@Fourdee
Copy link
Collaborator

Fourdee commented Apr 16, 2016

@k-plan
Did some testing, appears we need to apply the same fix we did here: https://github.com/Fourdee/DietPi/issues/233#issuecomment-196413520.

By forcing en_GB, all our grep parsing (which is based on English) should work regardless of system locale.

#!/bin/bash
LANG=en_GB.UTF-8
ifconfig

test(){

ifconfig
date
}

test

So I'am going to look at adding LANG=en_GB.UTF-8 to all the DietPi scripts.

@Fourdee
Copy link
Collaborator

Fourdee commented Apr 26, 2016

@k-plan

ifup - ifdown , it will not switch the route.

I'll run some tests tomorrow, how are you testing the route, traceroute? I'd like to replicate your tests.

@k-plan
Copy link
Contributor Author

k-plan commented Apr 26, 2016

@Fourdee

ping -s 1500 192.168.0.100 wlan0 and eth1 ping -s 1500 192.168.0.200 ip of C1 from router/PC and ping simultaneously from C1 to ping -s 1500 dietpi.com. (example)

But simple test:

  • allow-hotplug eth1 dhcp or static ip (active and working)
  • auto wlan0 dhcp (active and working)
  • test if ifup / ifdown eth1andwlan0 is working. ping must going on with a short break.

-> poweroff

-> unplug Ethernet cable

-> power on the device

Can you now connect to wlan0 ip per ssh?
Look on you access-point. wlan0 MAC-address is registered and connected.

This should be the scenario user wanted to have working, if I don't got it all wrong.

@Fourdee
Copy link
Collaborator

Fourdee commented Apr 27, 2016

@k-plan
Thanks for the info 👍

I couldn't get round to this today, so apologies for that. I'll give it a spin first chance I get tomorrow.

@Fourdee
Copy link
Collaborator

Fourdee commented Apr 27, 2016

@k-plan
I've also been meaning to post this picture for the last week lol:
img_20160416_171545

@xenfomation
Copy link
Contributor

^ looks my lab, but no complaints as it took long enough to get back into free time!

@Fourdee
Copy link
Collaborator

Fourdee commented Apr 28, 2016

@k-plan

But simple test:
allow-hotplug eth1 dhcp or static ip (active and working)
auto wlan0 dhcp (active and working)
test if ifup / ifdown eth1andwlan0 is working. ping must going on with a short break.
-> poweroff
-> unplug Ethernet cable
-> power on the device
Can you now connect to wlan0 ip per ssh?

eth = dhcp
wlan = static
Unplugged eth and rebooted. I can ping wlan fine. As far as I can see, implementing ifmetric has no negative effects.

Is there any more tests you can think of that can replicate any issues?

@xenfomation
Copy link
Contributor

Hehehe - try and bond the two interfaces (no, seriously DO NOT).

@k-plan
Copy link
Contributor Author

k-plan commented Apr 29, 2016

@Fourdee

eth1 and wlan are connected to same Layer2 Network (e.g 192.168.0.0/24)

Ethernet

allow-hotplug eth1
iface eth1 inet static
metric 0


Wifi

auto wlan0
iface wlan0 inet dhcp
metric 1

  • ping ip address eth1 (from router or PC => work)
  • ping ip address wlan0 (from router or PC => work)
  • ping dietpi.com (from C1 => work) packets goes over eth1
  • ifdown eth1
  • ping dietpi.com (from C1 => work) packets goes over wlan0
  • ping ip address eth1 (from router or PC => do not work)
  • ping ip address wlan0 (from router or PC => work)
  • ifup eth1
  • ping dietpi.com (from C1 => work) packets goes over eth1
  • ping ip address eth1 (from router or PC => do not work)
  • ping ip address wlan0 (from router or PC => work)
  • poweroff

-> unplug Ethernet cable
-> switch on power supply
-> boot up C1 complete

  • ping ip address eth1 (from router or PC => do not work)
  • ping ip address wlan0 (from router or PC => do not work)
  • ping dietpi.com (from C1 console => do not work)

-> plugin Ethernet cable

  • ping ip address eth1 (from router or PC => work)
  • ping ip address wlan0 (from router or PC => work)
  • ping dietpi.com (from C1 console => work) packets goes over eth1

@k-plan
Copy link
Contributor Author

k-plan commented Apr 29, 2016

@Fourdee

eth1 and wlan are connected to same Layer2 Network (e.g 192.168.0.0/24)

Ethernet

auto eth1
iface eth1 inet static
metric 0


Wifi

auto wlan0
iface wlan0 inet dhcp
metric 1

  • ping ip address eth1 (from router or PC => work)
  • ping ip address wlan0 (from router or PC => work)
  • ping dietpi.com (from C1 => work) packets goes over eth1
  • ifdown eth1
  • ping dietpi.com (from C1 => work) packets goes over wlan0
  • ping ip address eth1 (from router or PC => do not work)
  • ping ip address wlan0 (from router or PC => work)
  • ifup eth1
  • ping dietpi.com (from C1 => work) packets goes over eth1
  • ping ip address eth1 (from router or PC => do not work)
  • ping ip address wlan0 (from router or PC => work)
  • poweroff

-> unplug Ethernet cable
-> switch on power supply
-> boot up C1 complete

  • ping ip address eth1 (from router or PC => do not work)
  • ping ip address wlan0 (from router or PC => do not work)
  • ping dietpi.com (from C1 console => do not work)

-> plugin Ethernet cable

  • ping ip address eth1 (from router or PC => work)
  • ping ip address wlan0 (from router or PC => work)
  • ping dietpi.com (from C1 console => work) packets goes over eth1

@k-plan
Copy link
Contributor Author

k-plan commented Apr 29, 2016

@Fourdee

eth1 and wlan are connected to same Layer2 Network (e.g 192.168.0.0/24)

Ethernet

auto eth1
iface eth1 inet static
metric 0


Wifi

auto wlan0
iface wlan0 inet dhcp
metric 1

  • ping dietpi.com (from C1 => work)
root@oDroid-C1-TEST:~# ifdown eth1

root@oDroid-C1-TEST:~# dmesg
. . .
[  311.539637] NET DMA is stopped, ETH_DMA_Status=8502!
[  311.596153] eth1: closed

root@oDroid-C1-TEST:~# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.0.1     0.0.0.0         UG    1      0        0 wlan0
192.168.0.0     *               255.255.255.0   U     1      0        0 wlan0

root@oDroid-C1-TEST:~# ifup eth1

root@oDroid-C1-TEST:~# dmesg
 . . .
[  345.341681] eth1: opened (irq 40).
[  349.338586] [adjust link] -> eth: full-duplex
[  349.345851] [adjust link] -> eth: phy_speed <> priv_speed)
[  349.353250] [adjust link -> eth: am_adjust_link state change (new_state=true)
[  349.360977] libphy: 0:01 - Link is Up - 1000/Full

root@oDroid-C1-TEST:~# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.0.1     0.0.0.0         UG    0      0        0 eth1
default         192.168.0.1     0.0.0.0         UG    1      0        0 wlan0
192.168.0.0     *               255.255.255.0   U     0      0        0 eth1
192.168.0.0     *               255.255.255.0   U     1      0        0 wlan0
  • ping dietpi.com (from C1 => work all the time!)

  • ping dietpi.com (from C1 => work)

-> unplug Ethernet cable

root@oDroid-C1-TEST:~# dmesg
 . . .
[ 1070.500226] libphy: 0:01 - Link is Down


root@oDroid-C1-TEST:~# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface



  • ping dietpi.com (from C1 => do not work)

-> plugin Ethernet cable

root@oDroid-C1-TEST:~# dmesg
 . . .
[ 1092.498852] [adjust link] -> eth: full-duplex
[ 1092.527414] [adjust link] -> eth: phy_speed <> priv_speed)
[ 1092.555618] [adjust link -> eth: am_adjust_link state change (new_state=true)
[ 1092.584081] libphy: 0:01 - Link is Up - 1000/Full

root@oDroid-C1-TEST:~# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.0.1     0.0.0.0         UG    0      0        0 eth1
default         192.168.0.1     0.0.0.0         UG    1      0        0 wlan0
192.168.0.0     *               255.255.255.0   U     0      0        0 eth1
192.168.0.0     *               255.255.255.0   U     1      0        0 wlan0

  • ping dietpi.com (from C1 => work)

@k-plan
Copy link
Contributor Author

k-plan commented Apr 29, 2016

@Fourdee

eth1 and wlan are connected to same Layer2 Network (e.g 192.168.0.0/24)

Ethernet

allow-hotplug eth1
iface eth1 inet static
metric 0


Wifi

auto wlan0
iface wlan0 inet dhcp
metric 1

  • ping dietpi.com (from C1 => work)
root@oDroid-C1-TEST:~# ifdown eth1

root@oDroid-C1-TEST:~# dmesg
. . .
[ 1895.492057] NET DMA is stopped, ETH_DMA_Status=8502!
[ 1895.553041] eth1: closed

root@oDroid-C1-TEST:~# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.0.1     0.0.0.0         UG    1      0        0 wlan0
192.168.0.0     *               255.255.255.0   U     1      0        0 wlan0

root@oDroid-C1-TEST:~# ifup eth1

root@oDroid-C1-TEST:~# dmesg
 . . .
[ 2266.065803] eth1: opened (irq 40).
[ 2270.058998] [adjust link] -> eth: full-duplex
[ 2270.088858] [adjust link] -> eth: phy_speed <> priv_speed)
[ 2270.118935] [adjust link -> eth: am_adjust_link state change (new_state=true)
[ 2270.149272] libphy: 0:01 - Link is Up - 1000/Full

root@oDroid-C1-TEST:~# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.0.1     0.0.0.0         UG    0      0        0 eth1
default         192.168.0.1     0.0.0.0         UG    1      0        0 wlan0
192.168.0.0     *               255.255.255.0   U     0      0        0 eth1
192.168.0.0     *               255.255.255.0   U     1      0        0 wlan0
  • ping dietpi.com (from C1 => work all the time!)

  • ping dietpi.com (from C1 => work)

-> unplug Ethernet cable

root@oDroid-C1-TEST:~# dmesg
 . . .
[ 2306.178909] [adjust link -> eth: am_adjust_link state change (new_state=true)
[ 2306.209903] libphy: 0:01 - Link is Down

root@oDroid-C1-TEST:~# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface



  • ping dietpi.com (from C1 => do not work)

-> plugin Ethernet cable

root@oDroid-C1-TEST:~# dmesg
 . . .
[ 2350.239068] [adjust link] -> eth: full-duplex
[ 2350.269896] [adjust link] -> eth: phy_speed <> priv_speed)
[ 2350.300790] [adjust link -> eth: am_adjust_link state change (new_state=true)
[ 2350.332345] libphy: 0:01 - Link is Up - 1000/Full

root@oDroid-C1-TEST:~# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.0.1     0.0.0.0         UG    0      0        0 eth1
default         192.168.0.1     0.0.0.0         UG    1      0        0 wlan0
192.168.0.0     *               255.255.255.0   U     0      0        0 eth1
192.168.0.0     *               255.255.255.0   U     1      0        0 wlan0

  • ping dietpi.com (from C1 => work)

@k-plan
Copy link
Contributor Author

k-plan commented Apr 29, 2016

@Fourdee

allow-hotplug is no solution.

There are some more packets:
https://packages.debian.org/jessie/ifupdown-extra
https://packages.debian.org/jessie/ifupdown-multi

@Fourdee
Copy link
Collaborator

Fourdee commented Apr 30, 2016

@k-plan

Thanks for the test reports, great stuff 👍 . I'll replicate your tests today and see if there is anything we can do about it :)

@Fourdee
Copy link
Collaborator

Fourdee commented Apr 30, 2016

Ethernet
auto eth0
iface eth1 inet static
metric 0

Wifi
auto wlan0
iface wlan0 inet dhcp
metric 1

  1. ifdown eth0 = WiFi ok
  2. Unplug eth = Also kills WiFi connection
  3. Plug in eth, run systemctl restart networking.service = Works fine.

Ethernet
auto eth0
iface eth1 inet static
metric 0

Wifi
auto wlan0
iface wlan0 inet dhcp
metric 1

  1. ifdown wlan0 = eth ok
  2. Unplug wlan = eth ok
  3. Plug in wlan, run systemctl restart networking.service = Works fine.

Ethernet
allow-hotplug eth0
iface eth1 inet static
metric 0

Wifi
allow-hotplug wlan0
iface wlan0 inet dhcp
metric 1

  1. unplug eth = Kills both connections
  2. Plug eth back in = WiFi and Eth working fine.

Ethernet
allow-hotplug eth0
iface eth1 inet static
metric 0

Wifi
allow-hotplug wlan0
iface wlan0 inet dhcp
metric 1

  1. unplug wlan = Eth working fine
  2. Plug wlan back in = WiFi and Eth working fine.

So issues are :

  1. if metric 0 device is unplugged, kills other device connections.
  2. allow-hotplug reduces the need for running systemctl restart networking.service after physical disconnect/reconnect.

What i'am going to do about (1.):

As far as i'am aware, there's nothing much we can do as this is all controlled by the kernel.
We can only hope when our users have both eth and wlan enabled, they run systemctl restart networking.service after unplugging and replugging eth. Or, if we roll out allow-hotplug, just plug eth back in.

What i'am going to do about (2.):

I'am going to consider rolling out allow-hotplug, as standard to all DietPi systems. This will allow users to physically disconnect/reconnect with no need for running systemctl restart networking.service.

Generally speaking.

We expect our users to only use 1 network device, unless they are running WiFi hotspot. Enabling both devices should be a temporary procedure to allow users to configure the other device over SSH, before dropping the other device and its connection.

@k-plan
Copy link
Contributor Author

k-plan commented Apr 30, 2016

@Fourdee

Sorry, but I think, we talk at cross-purposes. (the language barrier)

  1. if metric 0 device is unplugged, kills other device connections.

    As far as i'am aware, there's nothing much we can do as this is all controlled by the kernel.

No and yes. If a state of any interface change, it must have to run throughifdown and ifup .
Nothing more do systemctl restart networking.service. Have a look in cat /etc/init.d/networking
After this, route will set correctly and routing is working proper.
metric defined the preferred, in this case the faster interface, generally ethx.

The possible solution are:

1.) Use a "network-manager" with or without a GUI (the modern network configuration)

" They allow us to configure network independent of the legacy ifupdown package "

But I think, it is not what you want to do. It's to heavy and not like "diet". So there would be a lot of work at your really well working scripts.

2.) Using some "packets" which do it for you and stay on "The basic network configuration with ifupdown (legacy)

or

or

All packets are available for armel, armhf, arm64:
https://packages.debian.org/jessie/ifmetric
https://packages.debian.org/jessie/ifplugd
https://packages.debian.org/jessie/netplug
https://packages.debian.org/jessie/ifupdown-extra

It is your choice, which way you like or prefer.
ifplugd and netplugd run as services in background and have to be configured.

example:

Linux already supports plugging in and configuring the likes of
Cardbus network interfaces, in the form of the hotplug subsystem.
Netplug provides the corresponding support for plugging and unplugging
cables into network interfaces.

When an Ethernet-style network interface on a host is plugged into a
powered-up switch, hub, or other host, the two use a carrier signal to
establish that the link is alive. The Linux kernel makes this
information available through its netlink interface.

The netplug daemon listens for carrier detection and loss messages
from the kernel's netlink subsystem. When a carrier signal is
detected on an interface, it runs a script to bring the interface up.
When carrier is lost, netplug runs a script to bring the interface
down.

ifplugd is a Linux daemon which will automatically configure your ethernet device when a cable is plugged in and automatically unconfigure it if the cable is pulled. This is useful on laptops with onboard network adapters, since it will only configure the interface when a cable is really connected.

ifplugd interfaces with your distribution's native network configuration utilities.

Some features:

Uses your distribution's native ifup/ifdown programs.
Supports the Linux SIOCETHTOOL (newer, aka ethtool API), SIOCGMIIREG (older, aka mii-diag/mii-tool API) and SIOCDEVPRIVATE (oldest, aka mii-tool API) ioctl()s for getting link status. Release 0.24 introduces support for link detection with the IFF_RUNNING interface flag.
Syslog support
Small program - the binary is just 25 KB (plus 16 KB for libdaemon).
Multiple ethernet interface support
Can be configured to ignore short "unplugged" periods (-d option) or short "plugged" periods(-u option)
Support for wireless networking. Whenever an association to an AP is detected the network is configured. Have a look on waproamd if you need a facility to configure WEP keys before AP associations succeed.
Compatibility mode for network devices which do not support cable detection (-F option)

Sorry for the numerousness of links, but better you read it in one's own right.
It's a difficult subject.
Or may I write it in german? 😄


I'am going to consider rolling out allow-hotplug, as standard to all DietPi systems. This will allow users to physically disconnect/reconnect with no need for running systemctl restart networking.service.

Hmm ... , it will/can not help/fix in all possible use cases. http://natisbad.org/dyn-net/index.html

But will not keep quiet about possible side effect, please see advisement above.
We have to do some test e.g. with DNS, WiFi and TOR HotSpot, PiHole, VPN etc.
Or kick out the feature of having both eth/wlan active iface at the same time, because it's not proper working in every circumstances.

What we want to do as next step?

@k-plan
Copy link
Contributor Author

k-plan commented Apr 30, 2016

@Fourdee

a quick test:

  • ping ip address eth1 (from router or PC)
  • ping ip address wlan0 (from router or PC)
  • ping -s 1400 dietpi.com (from C1+)

Ethernet
allow-hotplug eth0
iface eth1 inet static
metric 0

Wifi
allow-hotplug wlan0
iface wlan0 inet dhcp
metric 1

root@oDroid-C1-TEST:~# apt-get install netplug
The following NEW packages will be installed:
  iproute netplug

root@oDroid-C1-TEST:~# service netplug stop

root@oDroid-C1-TEST:~# cat /etc/netplug/netplugd.conf
eth*
wlan*
root@oDroid-C1-TEST:~# service netplug start

root@oDroid-C1-TEST:~# service netplug status
● netplug.service - LSB: Brings up/down network automatically
   Loaded: loaded (/etc/init.d/netplug)
   Active: active (running) since Sat 2016-04-30 22:55:17 CEST; 3s ago
  Process: 5300 ExecStop=/etc/init.d/netplug stop (code=exited, status=0/SUCCESS)
  Process: 7618 ExecStart=/etc/init.d/netplug start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/netplug.service
           └─7895 /sbin/netplugd -p /var/run/netplugd.pid

Apr 30 22:55:17 oDroid-C1-TEST systemd[1]: Started LSB: Brings up/down network automatically.
Apr 30 22:55:17 oDroid-C1-TEST netplugd[7896]: /etc/netplug/netplug eth1 in -> pid 7896
Apr 30 22:55:17 oDroid-C1-TEST netplugd[7897]: /etc/netplug/netplug wlan0 in -> pid 7897
Apr 30 22:55:17 oDroid-C1-TEST netplugd[7895]: eth1: state INNING pid 7896 exited status 0
Apr 30 22:55:17 oDroid-C1-TEST netplugd[7895]: wlan0: state INNING pid 7897 exited status 0
  • Start = WiFi and Eth working fine
  1. Unplug eth = Wifi is working
  2. Plug eth back in = WiFi and Eth working fine
  3. Unplug wlan = Eth working fine
  4. Plug wlan back in = WiFi and Eth working fine
  • ping -s 1400 dietpi.com (from C1+) = working all along

To see what is going on (some debugging):

root@oDroid-C1-TEST:~# service netplug stop

root@oDroid-C1-TEST:~# cat eth1-wlan0
eth1
wlan0


root@oDroid-C1-TEST:~# netplugd -F -c eth1-wlan0

Repeat testing (unplug/plug eth/wlan in)


Will you please test ifplugd on your device?

@Fourdee
Copy link
Collaborator

Fourdee commented May 1, 2016

@k-plan

Will you please test ifplugd on your device?

Looks promising 👍 , i'll run some tests today and report back.

@Fourdee
Copy link
Collaborator

Fourdee commented May 1, 2016

@k-plan
ifplugd has same issues (no effect):

root@DietPi:~# service ifplugd status
● ifplugd.service - LSB: Brings up/down network automatically
   Loaded: loaded (/etc/init.d/ifplugd)
   Active: active (running) since Sun 2016-05-01 15:03:24 BST; 8s ago
   CGroup: /system.slice/ifplugd.service
           ├─5528 /usr/sbin/ifplugd -i eth0 -q -f -u0 -d10 -w -I
           └─5543 /usr/sbin/ifplugd -i wlan0 -q -f -u0 -d10 -w -I

Ethernet
allow-hotplug eth0
iface eth1 inet static
metric 0

Wifi
allow-hotplug wlan0
iface wlan0 inet dhcp
metric 1

unplug eth = Kills both connections
Plug eth back in = WiFi and Eth working fine.

I'll try netplug

@k-plan
Copy link
Contributor Author

k-plan commented May 1, 2016

@Fourdee

ifplugd has same issues (no effect):

Hmm ... have you done dpkg-reconfigure ifplugd after installation?

@Fourdee
Copy link
Collaborator

Fourdee commented May 1, 2016

@k-plan

Hmm ... have you done dpkg-reconfigure ifplugd after installation?

Yes:
auto
all
None for suspend mode

@Fourdee
Copy link
Collaborator

Fourdee commented May 1, 2016

@k-plan

Netplug working 👍

cat << _EOF_ > /etc/netplug/netplugd.conf
eth*
wlan*
_EOF_

Also tested with WiFiHotspot installation.

Netplug looks like the winner 👍

EDIT:
I'll roll it out to v117 for testing. Aiming to get this released today, v117 is well overdue.

@Fourdee
Copy link
Collaborator

Fourdee commented May 1, 2016

@k-plan

I'll roll it out to v117 for testing. Aiming to get this released today, v117 is well overdue.

Netplug is now in the testing branch: Fourdee@2e19a57

@k-plan
Copy link
Contributor Author

k-plan commented May 1, 2016

@Fourdee

ifplugd has same issues (no effect):

no, it will work

Yes:
auto
all
None for suspend mode

auto
( no entry for hotplugged interface)
arguments: -q -f -u0 -d2 -w -I -b
suspend behaviour: Stop


a quick test (starting from a fresh install v117 testing):

  • ping ip address eth1 (from router or PC)
  • ping ip address wlan0 (from router or PC)
  • ping -s 1400 dietpi.com (from C1+)

Ethernet
allow-hotplug eth0
iface eth1 inet static
metric 0

Wifi
allow-hotplug wlan0
iface wlan0 inet dhcp
metric 1

root@RPi-3-test:~# apt-get install ifplugd
The following extra packages will be installed:
  libdaemon0
The following NEW packages will be installed:
  ifplugd libdaemon0

root@oDroid-C1-TEST2:~# dpkg-reconfigure ifplugd

160501-0009

160501-0010

160501-0005

160501-0006

root@oDroid-C1-TEST2:~# cat /etc/default/ifplugd
# This file may be changed either manually or by running dpkg-reconfigure.
#
# N.B.: dpkg-reconfigure deletes everything from this file except for
# the assignments to variables INTERFACES, HOTPLUG_INTERFACES, ARGS and
# SUSPEND_ACTION.  When run it uses the current values of those variables
# as their default values, thus preserving the administrator's changes.
#
# This file is sourced by both the init script /etc/init.d/ifplugd and
# the udev script /lib/udev/ifplugd.agent to give default values.
# The init script starts ifplugd for all interfaces listed in
# INTERFACES, and the udev script starts ifplugd for all interfaces
# listed in HOTPLUG_INTERFACES. The special value all starts one
# ifplugd for all interfaces being present.
INTERFACES="auto"
HOTPLUG_INTERFACES=""
ARGS="-q -f -u0 -d2 -w -I -b"
SUSPEND_ACTION="stop"
root@oDroid-C1-TEST2:~#

root@oDroid-C1-TEST2:~# ps -fC ifplugd
UID        PID  PPID  C STIME TTY          TIME CMD
root     11531     1  0 17:25 ?        00:00:00 /usr/sbin/ifplugd -i eth1 -q -f -u0 -d2 -w -I -b
root     11546     1  0 17:25 ?        00:00:00 /usr/sbin/ifplugd -i wlan0 -q -f -u0 -d2 -w -I -b
  • Start = WiFi and Eth working fine
  1. Unplug eth = Wifi is working
  2. Plug eth back in = WiFi and Eth working fine
  3. Unplug wlan = Eth working fine
  4. Plug wlan back in = WiFi and Eth working fine
  • ping -s 1400 dietpi.com (from C1+) = working all along

Working! 😄 👍

*Difference: *

  • if you plug wlan back in, it takes a little bit longer until ping over WiFi will working again.
  • ifplug needed to run a process per interface, so here are twice.

Netplug looks like the winner

😄 👍

Also tested with WiFiHotspot installation.

Nice 😄

I'll roll it out to v117 for testing.

... another fresh install .... 😢 😢 ... not tested connected with two different broadcast domains

Aiming to get this released today, v117 is well overdue.

💯 posting to resolve a issue 😆

But I'm really unsure, if it is a good idea to use allow-hotplug for all interfaces ...
Some distributions have done it in the past, but all deviate later ...

@Fourdee
Copy link
Collaborator

Fourdee commented May 1, 2016

@k-plan

But I'm really unsure, if it is a good idea to use allow-hotplug for all interfaces ...
Some distributions have done it in the past, but all deviate later ...

I can't see any negative effects of this across DietPi at the moment. I will keep an eye on it.

Interesting results for ifplugd, although I think we will stick with netplug for now, seems to work a treat.

With allow-hotplug ifmetric and netplug, all the issues listed in this ticket have now been resolved. Great work on this K-plan 👍

... another fresh install .... 😢 😢 ... not tested connected with two different broadcast domains

After installing DietPi, do a dietpi-backup 1. Then when you want to test something new run dietpi-backup -1 && reboot to restore.

You can also run the following to update from testing branch:

echo 116 > /DietPi/dietpi/.version
dietpi-update
reboot

I've been testing netplug (and all these changes in the ticket) on the C2 and RPi's today, no issues.
I'll mark this ticket (lengthy lol) completed and closed. Please reopen if required.

@Fourdee Fourdee closed this as completed May 1, 2016
@Fourdee Fourdee mentioned this issue May 1, 2016
Fourdee referenced this issue May 1, 2016
v117
(01/05/16)

New Device:

DietPi image for VirtualBox (x64) is now available: http://dietpi.com/phpbb/viewtopic.php?f=8&t=390&p=1683#p1683. Many thanks to Xenformation (JK) for implementing this image.

Changes / Improvements / Optimizations:

DietPi-Software | Added DietPi optimized installation for Mumble VoIP server: http://dietpi.com/phpbb/viewtopic.php?f=8&t=5&p=1691#p1691

DietPi-Config | Added display resolution profiles for Odroid VU7+.

DietPi-BugReport | Max filesize limit of bug report uploads capped at 10MB.

General | All fuzon.co.uk links have now been replaced with dietpi.com. This completes the recent server move: https://github.com/Fourdee/DietPi/issues/294

General | Begin script optimizations.  This will most likely extend over the next several releases.
Networking | allow-hotplug has now been rolled out as default for all DietPi systems. Previously, this was set to auto. This basically means you can psyhically unplug/plug the device on the fly, without the need for restarting the networking service: https://github.com/Fourdee/DietPi/issues/305

Bug fixes:

DietPi-Config | Resolved an issue where IP details would not show on WiFi, when using both adapters at the same time, and setting wlan static: https://github.com/Fourdee/DietPi/issues/273#issuecomment-213951519

DietPi-Software | Resolved an issue where Oracle Java would fail to install: https://github.com/Fourdee/DietPi/issues/298

DietPi-Software | Resolved an issue where WiFi hotspot would not function on the Odroid C2. arm64 binary has been compiled with RTL drivers enabled: https://github.com/Fourdee/DietPi/issues/303

DietPi-Set_Soundcard | Resolved an issue where changing addon RPi soundcards failed to enable the chosen card.

DietPi-Update | Resolved an issue where the server version would return "invalid": https://github.com/Fourdee/DietPi/issues/301

DietPi-Software/Config | Resolved an issue where noip would not run on Odroid C2: https://github.com/Fourdee/DietPi/issues/302
General | Resolved an issue with WPA-PSK wireless connections failing to connect on the Odroid XU4.

Networking | Resolved an issue where unplugging eth would also kill any active wlan connections. Many thanks to K-plan for his assistance on this one: https://github.com/Fourdee/DietPi/issues/273#issuecomment-215996025.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants