Freebsd 13.1: Wifi oddity: Need to dual boot linux/freebsd to get my wifi working

Hi everyone,

I have got an old laptop (hp pavillon dv7) on which I am dual booting Linux (artix) and Freebsd 13.1.

My wireless chipset is a Broadcom 4312. I did some researchs on the forum, found all the required information and did my settings accordingly.
The ending result is quite satisfactory.... As in, the wifi works...
Except that in order for the wifi to work I have to first boot on Linux/Artix, then reboot (not restart) the pc, and once grub menu shows, choose Freebsd. If I do that, then wpa-supplicant and dhcp catch up, I have got an Ip address and the wifi works just fine.

If, on the other hand, I start straight on Freebsd the wifi does not work: wpa_supplicant fails and dhcp as a result fails too telling me there is no carrier.

I did some research but have not found anything on the subject.

Could one of you please help me?

Here are my settings:

/etc/rc.conf
Code:
create_args_wlan0="country FR regdomain ETSI"                  
wlans_bwn0="wlan0"                                                   
ifconfig_wlan0="WPA SYNDHCP"

and

/boot/loader.conf
Code:
siba_bwn_load="YES"                                            
if_bwn_load="YES"                                                    
firmware_load="YES"                                                  
bwn_v4_lp_ucode_load="YES"                                           
wlan_ccmp_load="YES"                                                 
wlan_tkip_load="YES"                                                 
wlan_wep_load="YES"

/etc/wpa_supplicant.conf
Code:
network={
        ssid="myssid"
        psk="mypasswd"
        priority=5
}

Thank you.
 
Did you install net/bwn-firmware-kmod from ports? Can you provide kldstat output?
I did indeed as well as pkg b43-fwcutter

this said:

first case scenario: start straight on on Freebsd:
kldstat
Code:
Id Refs Address                Size Name
 1   69 0xffffffff80200000  1f30590 kernel
 2    1 0xffffffff82131000     3728 coretemp.ko
 3    1 0xffffffff82135000   daa818 nvidia.ko
 4    3 0xffffffff82ee0000    32610 linux_common.ko
 5    2 0xffffffff82f13000    8e8c8 linux.ko
 6    1 0xffffffff82fa2000    2e7b0 bwn_v4_lp_ucode.ko
 7    1 0xffffffff82fd1000    4d430 if_bwn.ko
 8    2 0xffffffff8301f000     3e68 siba_bhndb.ko
 9    5 0xffffffff83023000    17a40 bhndb.ko
10   15 0xffffffff8303b000    772b0 bhnd.ko
11    3 0xffffffff830b3000     d720 gpiobus.ko
12    2 0xffffffff830c1000     ccb8 siba.ko
13    2 0xffffffff830ce000     3730 bcma_bhndb.ko
14    2 0xffffffff830d2000     a9a0 bcma.ko
15    2 0xffffffff830dd000     ab08 bhndb_pci.ko
16    2 0xffffffff830e8000     5118 bhnd_pci_hostb.ko
17    3 0xffffffff830ee000     6620 bhnd_pci.ko
18    1 0xffffffff830f5000     43b0 cpuctl.ko
19    1 0xffffffff830fa000     9430 acpi_video.ko
20    1 0xffffffff83520000     3378 acpi_wmi.ko
21    1 0xffffffff83524000     3250 ichsmb.ko
22    1 0xffffffff83528000     2180 smbus.ko
23    1 0xffffffff8352b000    41a78 pf.ko
24    1 0xffffffff8356d000     2a08 mac_ntpd.ko

and

ifconfig wlan0

Code:
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    ether ##:##:##:##:##:##
    groups: wlan
    ssid Myssid channel 6 (2437 MHz 11g)
    regdomain ETSI country FR authmode WPA2/802.11i privacy ON
    deftxkey UNDEF txpower 30 bmiss 7 scanvalid 60 protmode CTS wme
    roaming MANUAL bintval 120
    parent interface: bwn0
    media: IEEE 802.11 Wireless Ethernet autoselect (autoselect)
    status: no carrier
    nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>

Then Shutdown pc, restart, grub, linux, reboot, grub, freebsd

kldstat

Code:
Id Refs Address                Size Name
 1   69 0xffffffff80200000  1f30590 kernel
 2    1 0xffffffff82131000    4d430 if_bwn.ko
 3    2 0xffffffff8217f000     3e68 siba_bhndb.ko
 4    5 0xffffffff82183000    17a40 bhndb.ko
 5   15 0xffffffff8219b000    772b0 bhnd.ko
 6    3 0xffffffff82213000     d720 gpiobus.ko
 7    2 0xffffffff82221000     ccb8 siba.ko
 8    2 0xffffffff8222e000     3730 bcma_bhndb.ko
 9    2 0xffffffff82232000     a9a0 bcma.ko
10    2 0xffffffff8223d000     ab08 bhndb_pci.ko
11    2 0xffffffff82248000     5118 bhnd_pci_hostb.ko
12    3 0xffffffff8224e000     6620 bhnd_pci.ko
13    1 0xffffffff82255000     9430 acpi_video.ko
14    1 0xffffffff8225f000     43b0 cpuctl.ko
15    1 0xffffffff82265000     3728 coretemp.ko
16    1 0xffffffff82269000    2e7b0 bwn_v4_lp_ucode.ko
17    1 0xffffffff82298000   daa818 nvidia.ko
18    3 0xffffffff83043000    32610 linux_common.ko
19    2 0xffffffff83076000    8e8c8 linux.ko
20    1 0xffffffff83520000     3378 acpi_wmi.ko
21    1 0xffffffff83524000     3250 ichsmb.ko
22    1 0xffffffff83528000     2180 smbus.ko
23    1 0xffffffff8352b000    41a78 pf.ko
24    1 0xffffffff8356d000     2a08 mac_ntpd.ko

and

ifconfig wlan0

Code:
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    ether ##:##:##:##:##:##
    inet 192.168.1.123 netmask 0xffffff00 broadcast 192.168.1.255
    groups: wlan
    ssid Myssid channel 6 (2437 MHz 11g) bssid ##:##:##:##:##:##
    regdomain ETSI country FR authmode WPA2/802.11i privacy ON
    deftxkey UNDEF AES-CCM 2:128-bit txpower 30 bmiss 7 scanvalid 60
    protmode CTS wme roaming MANUAL bintval 120
    parent interface: bwn0
    media: IEEE 802.11 Wireless Ethernet OFDM/54Mbps mode 11g
    status: associated
    nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>

and everything works fine.
 
Are you using SYNCDHCP in your /etc/rc.conf?
Hi Jose,

Here is my /etc/rc.conf

Code:
# Wireless Conf
create_args_wlan0="country FR regdomain ETSI"
wlans_bwn0="wlan0"
#wpa_supplicant_enable="YES"
ifconfig_wlan0="WPA SYNCDHCP"
 
What happens if you run wpa_supplicant manually. What warnings / errors does it give?
(remove / comment out the ifconfig_wlan0="WPA SYNDHCP" from /etc/rc.conf first and restart)

# wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf
 
If you look at /usr/ports/net/bwn-firmware-kmod/Makefile you will notice 3 different firmware modules.
Have you tried them all?
bwn_v4
bwn_v4_lp
bwn_v4_n
 
What happens if you run wpa_supplicant manually. What warnings / errors does it give?
(remove / comment out the ifconfig_wlan0="WPA SYNDHCP" from /etc/rc.conf first and restart)

# wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf
Hi kpedersen

Did uncomment the line in /etc/rc.conf. I did then reboot.

Then

#wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf
Code:
Successfully initialized wpa_supplicant 
ioctl[SIOCS80211, op=20, val=0, arg_len=7]: Invalid argument
ioctl[SIOCS80211, op=20, val=0, arg_len=7]: Invalid argument
ioctl[SIOCS80211, op=103, val=0, arg_len=128]: Operation now in progress
wlan0: CTRL-EVENT-SCAN-FAILED ret=-1 retry=1
ioctl[SIOCS80211, op=103, val=0, arg_len=128]: Operation now in progress
wlan0: CTRL-EVENT-SCAN-FAILED ret=-1 retry=1
ioctl[SIOCS80211, op=103, val=0, arg_len=128]: Operation now in progress
wlan0: CTRL-EVENT-SCAN-FAILED ret=-1 retry=1
ioctl[SIOCS80211, op=103, val=0, arg_len=128]: Operation now in progress
wlan0: CTRL-EVENT-SCAN-FAILED ret=-1 retry=1
ioctl[SIOCS80211, op=103, val=0, arg_len=128]: Operation now in progress
wlan0: CTRL-EVENT-SCAN-FAILED ret=-1 retry=1
ioctl[SIOCS80211, op=103, val=0, arg_len=128]: Operation now in progress
wlan0: CTRL-EVENT-SCAN-FAILED ret=-1 retry=1
ioctl[SIOCS80211, op=103, val=0, arg_len=128]: Operation now in progress
wlan0: CTRL-EVENT-SCAN-FAILED ret=-1 retry=1
ioctl[SIOCS80211, op=103, val=0, arg_len=128]: Operation now in progress
wlan0: CTRL-EVENT-SCAN-FAILED ret=-1 retry=1
ioctl[SIOCS80211, op=103, val=0, arg_len=128]: Operation now in progress
wlan0: CTRL-EVENT-SCAN-FAILED ret=-1 retry=1
ioctl[SIOCS80211, op=103, val=0, arg_len=128]: Operation now in progress
wlan0: CTRL-EVENT-SCAN-FAILED ret=-1 retry=1
ioctl[SIOCS80211, op=103, val=0, arg_len=128]: Operation now in progress
wlan0: CTRL-EVENT-SCAN-FAILED ret=-1 retry=1
ioctl[SIOCS80211, op=103, val=0, arg_len=128]: Operation now in progress
wlan0: CTRL-EVENT-SCAN-FAILED ret=-1 retry=1
ioctl[SIOCS80211, op=103, val=0, arg_len=128]: Operation now in progress
wlan0: CTRL-EVENT-SCAN-FAILED ret=-1 retry=1
ioctl[SIOCS80211, op=103, val=0, arg_len=128]: Operation now in progress
wlan0: CTRL-EVENT-SCAN-FAILED ret=-1 retry=1
ioctl[SIOCS80211, op=103, val=0, arg_len=128]: Operation now in progress
wlan0: CTRL-EVENT-SCAN-FAILED ret=-1 retry=1
qioctl[SIOCS80211, op=103, val=0, arg_len=128]: Operation now in progress
wlan0: CTRL-EVENT-SCAN-FAILED ret=-1 retry=1
^Cwlan0: CTRL-EVENT-DSCP-POLICY clear_all
wlan0: CTRL-EVENT-DSCP-POLICY clear_all
wlan0: CTRL-EVENT-TERMINATING

#ifconfig wlan0 list scan returns nothing.
 
If you look at /usr/ports/net/bwn-firmware-kmod/Makefile you will notice 3 different firmware modules.
Have you tried them all?
bwn_v4
bwn_v4_lp
bwn_v4_n
Hi Phishfry:

Sorry if I'm dumb but
/usr/ports/net/bwn-firmware-kmod/Makefile keeps on returning
Code:
permission denied

likewise

cd /usr/ports/net/bwn-firmware-kmod/make config

Code:
===> No options to configure

Could you please elaborate/explain what I should do?
 
bwn_v4_lp_ucode_load="YES"
Add these to /boot/loader.conf as well. Might need to try one at a time and test wireless or maybe load all three.
You have to build these modules from ports. They are license encumbered.

bwn_v4_ucode_load="YES"
bwn_v4_n_ucode_load="YES"

Also post output from this command:
pciconf -lv | grep -B 3 network
 
#wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf
I don't suppose you saw anything in the kernel / dmesg whilst doing so? (You might not have noticed if running this from X11).

Potentially as Phishfry has mentioned it looks like you have installed the firmware but are maybe not loading it.
 
Kperdersen,
That's right. It's more convenient to deal with that from X11 for when logged in CLI (as in before running startx) a kernel message keeps on coming interferring with pretty much anything I'm trying to do.
This said I have not yet had/taken the time to have a look at Phishfry's point. I'll try to do that a bit latter on today and will come back to you. (with the actual error message to start with...).
 
Kperdersen, here are the messae I was referring to,

dmesg

Code:
wlan0: Ethernet address: 00:21:00:68:6f:9c
lo0: link state changed to UP
bwn0: ucode fw: ucode15
bwn0: firmware version (rev 478 patch 104 date 0x8701 time 0x657)
bwn0: ucode fw: ucode15

and Phishfry

pciconf -lv | grep B -3 network

Code:
bwn_pci0@pci0:2:0:0:    class=0x028000 rev=0x01 hdr=0x00 vendor=0x14e4 device=0x4315 subvendor=0x103c subdevice=0x137d
    vendor     = 'Broadcom Inc. and subsidiaries'
    device     = 'BCM4312 802.11b/g LP-PHY'
    class      = network
re0@pci0:5:0:0:    class=0x020000 rev=0x02 hdr=0x00 vendor=0x10ec device=0x8168 subvendor=0x103c subdevice=0x30f4
    vendor     = 'Realtek Semiconductor Co., Ltd.'
    device     = 'RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller'
    class      = network
 
Code:
wlan0: Ethernet address: 00:21:00:68:6f:9c
lo0: link state changed to UP
bwn0: ucode fw: ucode15
bwn0: firmware version (rev 478 patch 104 date 0x8701 time 0x657)
bwn0: ucode fw: ucode15
Hmm, darnit. It looks like the firmware is indeed loading correctly so it possibly isn't that causing the issue.

I am a little bit out of ideas then unfortunately. So I am going to chuck some random ideas around.

Possibly you could try copying the known working firmware files from Linux and see if that works.

It looks like someone else was struggling with this exact version:
http://daemonforums.org/showthread.php?t=10361
https://forums.freebsd.org/threads/bcm4312-fatal-dma-error.62233/

From that latter one I saw: https://www.freebsd.org/cgi/man.cgi?bwn(4)
hw.bwn.usedma

Perhaps this /boot/loader.conf tunable can do *something*?

Finally, it seems there is a "low power" version of the firmware which seems to be the one you are using (bwn_v4_lp_ucode_load="YES"). Possibly try the non-low power version. Phishfry's post has that command:

https://forums.freebsd.org/threads/...bsd-to-get-my-wifi-working.86004/#post-577198
 
Hi Kperdersen,

Thank you for your time and help. I do appreciate.

I have to double check but I think I have already come across and tried the "hw.bwn.ysedma" to no avail I'm afraid. Maybe combine with what Phishfry mentionned?

I am going to try that and the other ideas you gave me. (I don't know yet how to copy the firmware from linux to freebsd but I'm going to have look at that.)

It's a bit of shame to see that I'm not that far but at the same time not there yet.
 
#wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf
Code:
Successfully initialized wpa_supplicant
ioctl[SIOCS80211, op=20, val=0, arg_len=7]: Invalid argument
ioctl[SIOCS80211, op=20, val=0, arg_len=7]: Invalid argument
ioctl[SIOCS80211, op=103, val=0, arg_len=128]: Operation now in progress
wlan0: CTRL-EVENT-SCAN-FAILED ret=-1 retry=1
...

I am seeing the same endless loop here, same values, with an elderly usb rum device.
I found a workaround in setting scan_ssid=1 in wpa_supplicant.conf.
 
Thank you, I did try, and it was a bit counterproductive. If it does help in the case of a cold freebsd start, preventing the loop you describing, it does not when rebooting after a linux session (in this case I cannot have a connection). So I commented it.

I have to admit that I gave up a bit.

I have tried to understand the difference in settings between let's call it, wpa_supplicant-Linux and wpa-Freebsd in an attempt to get why one works where this other doesn't.
It seems, as far as I understand, that there is a kind of a "good-for-all-bad-for-none/fit-all-situation" setting on Linux in regards to the regdomain whereas on freebsd, the debug mode, is US. So one has to choose the one setting for one's particular Country. But having said that I'm not even sure that it's where the problem lies for, having selected my regdomain and country according to my current location, If I do a scan, my access point is recognized... So the settings seem to be good.

I have to say that I don't know enough to decipher the result of the:

wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf -d

and get where the things "screw up". (pardon my French).

edit:typos
 
no it's not "unfortunately".

At the present time I do not have the knowledge/time needed to investigate the matter futher. On top of that, I am not without any solutions: Should I need the wifi to work I just need to start Linux and reboot after. It's not ideal, but at least it works.
 
To add to my confusion:

I have tried the following things.

I did a cold start on Freebsd. Once logged, I did not have any wifi as expected. I was not associated as explaiined above.

So I tried with wpa_cli

wpa_cli
scan
>
scan_results
>
add_network
>1
set_network 1 ssid "myssid"
set_network 1 psk "psk"
enable_network 1


To my surprise I ended up associated with my box. But could not surf the web.

So I did renew my dhcp lease:
#service dhclient restart wlan0

But despite that was still not enable to surf the web or reach the repo to update pkg.

So I did reboot and the add wifi. (just like after a reboot following a linux session)

Hello darkness my old friend....
 
Back
Top