Deshabilitant el Wifi i el Bluetooth a una Raspberry Pi 4 sense monitor

Deshabilitant el Wifi i el Bluetooth a una Raspberry

En aquest article t'explique com deshabilitar temporalment o permanentment aquestos dos serveis al sistema operatiu Raspbian quan, per exemple en el meu cas, no els necessite per a res.

Si fem ifconfig veurem una interfície anomenada wlan0:


# ifconfig
eth0: flags=4163  mtu 1500
        inet 192.168.1.143  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 2a0c:5a87:d510:2700:7110:8bba:bfd5:a842  prefixlen 64  scopeid 0x0
        inet6 fe80::fb36:428e:8185:4a4b  prefixlen 64  scopeid 0x20
        ether d8:3a:dd:66:d5:db  txqueuelen 1000  (Ethernet)
        RX packets 30811  bytes 2459393 (2.3 MiB)
        RX errors 0  dropped 2660  overruns 0  frame 0
        TX packets 6957  bytes 8118327 (7.7 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
.
lo: flags=73  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 48  bytes 4350 (4.2 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 48  bytes 4350 (4.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
.
wlan0: flags=4099  mtu 1500
        ether d8:3a:dd:66:d5:dc  txqueuelen 1000  (Ethernet)
        RX packets 1276  bytes 241404 (235.7 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 711  bytes 93953 (91.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Ara aprendrem a habilitar-ho o deshabilitar-ho de diverses maneres, i a configurar la nostra Raspberry Pi per a que tinga sempre el wifi o que no el tinga habilitat encara que reiniciem la màquina.

PRIMERA OPCIÓ: DESHABILITANT TEMPORALMENT EL WIFI AMB IFCONFIG
Podem deshabilitar el wifi amb:


#sudo ifconfig wlan0 down

I tornar a habilitar-ho amb:


#sudo ifconfig wlan0 up

SEGONA OPCIÓ: DESHABILITANT WIFI I BLUETOOTH TEMPORALMENT AMB RFKILL
Veurem l'estat del Bluetooth o del Wifi amb:


# rfkill
ID TYPE      DEVICE      SOFT      HARD
 0 bluetooth hci0   unblocked unblocked
 1 wlan      phy0   unblocked unblocked
 

Deshabilitem el wifi amb:


# rfkill block wifi

# sudo rfkill
ID TYPE      DEVICE      SOFT      HARD
 0 bluetooth hci0   unblocked unblocked
 1 wlan      phy0     blocked unblocked 

Podrem tornar a habilitar el wifi en el futur amb:


rfkill unblock wifi

DESHABILITANT PERMANENTMENT EL BLUETOOTH I WIFI, ENCARA QUE REINICIEM

Mirarem el nom de com es diu aquest overlay:


# ls /boot/overlays/*wifi*
/boot/overlays/disable-wifi.dtbo  /boot/overlays/disable-wifi-pi5.dtbo

I per al bluetooth:


$ ls /boot/overlays/*bt*
/boot/overlays/disable-bt.dtbo      /boot/overlays/fbtft.dtbo
/boot/overlays/disable-bt-pi5.dtbo  /boot/overlays/miniuart-bt.dtbo

Editarem el fitxer que s'executa a l'arranc de la Raspberry Pi:


# sudo vi /boot/firmware/config.txt

I afegim (encara que ja exista el paràmetre dtoverlay, afegirem aquestes noves línies):


# Deshabilitem el Wifi
dtoverlay=disable-wifi
#
# Deshabilitem el Bluetooth
dtoverlay=disable-bt

Finalment, reiniciarem la Raspberry:


# sudo shutdown -r now

I a la pròxima vegada que accedim veurem que ja no tenim el Wifi actiu:


$ ifconfig
end0: flags=4163  mtu 1500
        inet 192.168.1.143  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 2a0c:5a87:d510:2700:60a6:9784:af2f:f521  prefixlen 64  scopeid 0x0
        inet6 fe80::a5a4:5ecd:8b80:a1d6  prefixlen 64  scopeid 0x20
        ether d8:3a:dd:66:d5:db  txqueuelen 1000  (Ethernet)
        RX packets 65  bytes 11330 (11.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 102  bytes 15697 (15.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
.
lo: flags=73  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 16  bytes 2014 (1.9 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 16  bytes 2014 (1.9 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

O si provem amb l'ordre rfkill veurem que tampoc tenim el bluetooth:


$ rfkill 
joan@allsky2:~ $ 

Ara ja tenim una Raspberry més lleugera que no fa servir serveis innecesaris per a nosaltres.

Doncs bé això és tot, espere que trobes útil aquest article i que et motive a compartir els teus trucs, els teus coneixements i els teus experiments amb el Programari Lliure. Pensa-ho, va, que la Comunitat del Programari Lliure va creixent gràcies a la documentació, el disseny, la formació o la programació, sigues part de la Comunitat :-)

La cultura i la lliure circulació de les idees és l'arma més efectiva contra les dictadures del pensament i contra la ignorància.

Utilitats

NAVEGACIÓ SENSE RATOLÍ

- Tab següent enllaç.
- Shift+Tab anterior enllaç.
- Enter activa l'enllaç.
- Alt+esquerra anar arrere.

CONTRAST DE COLORS

Accessibilitat - Color Negre
Accessibilitat - Color Groc
Accessibilitat - Color Verd

Accessibilitat - Color Blau
Accessibilitat - Color Crema
Accessibilitat - Color Blanc

 

PORTADES ALTERNATIVES