If you have a fresh new, shiny Ubuntu focal installed and you are thinking to set up wifi sharing (an Access Point) in the part of your apartment that computer is located in installing and starting the wifi-ap snap is a great way to do so.
Especially if you, like me have installed it without a graphical desktop, so setting up an AP using the Network Manger GUI is now straightforward.
Make sure you have snap:
sudo apt install snapd
Then install wifi-ap:
snap install wifi-ap
Theoretically an automated setup will make it work straight after install, you can check that with:
wifi-ap.status
This did not work on my box, because I do not have a wlan0 interface, instead I had to configure it with:
wifi-ap.config set wifi.interface=wlp1s0
Configuring is very easy as far as you can live with the few options it gives you:
root@XXXXX:~# wifi-ap.config get
debug: false
dhcp.lease-time: 12h
dhcp.range-start: 10.0.60.2
dhcp.range-stop: 10.0.60.199
disabled: false
share.disabled: false
share.network-interface: enp3s0
wifi.address: 10.0.60.1
wifi.channel: 1
wifi.country-code: SG
wifi.hostapd-driver: nl80211
wifi.interface: wlp1s0
wifi.interface-mode: direct
wifi.netmask: 255.255.255.0
wifi.operation-mode: g
wifi.security: wpa2
wifi.security-passphrase: XXXXXXXXXX
wifi.ssid: XXXXXXXXXX
You can turn off the snap and back on with:
wifi-ap.config set disabled=true
wifi-ap.config set disabled=false
And restart with:
wifi-ap.status restart-ap
After these my hostapd was running but the few settings above did not allow me to set the settings to the
optimal speed with the tuning options in
hostapd.conf I have already experimented with earler:
ht_capab=[HT40+][SHORT-GI-20][SHORT-GI-40][DSSS_CCK-40][TX-STBC][RX-STBC1]
And editing
/var/snap/wifi-ap/355/hostapd.conf does not help as the snap regenerates it upon every startup in
/snap/wifi-ap/355/bin/ap.sh which is a read-only mounted squashfs:
root@XXXXXX:~# mount |grep snap
/var/lib/snapd/snaps/wireless-tools_7.snap on /snap/wireless-tools/7 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/core_9665.snap on /snap/core/9665 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/wifi-ap_355.snap on /snap/wifi-ap/355 type squashfs (ro,nodev,relatime,x-gdu.hide)
So I have turned to this page on how to unmount and unpack the squashfs, modify the generating script
https://askubuntu.com/questions/1046606/cannot-edit-system-file-snap-phpstorm-even-with-root-account-in-ubuntu-18-04/1046677:
cd ~
sudo umount /snap/wifi-ap/355
sudo unsquashfs /var/lib/snapd/snaps/wifi-ap_355.snap
This is when you modify anything you want in the
squashfs-root directory except I could not unmount because the service process was still using the mount point. I figured out the PID for it with:
fuser -m /snap/wifi-ap/355
And killed it with:
kill -9
Then added the above config line to the config generation part of the script just before the wmm_* section, recreated the squasfs, backed up the old snap image and placed the newly generated there:
sudo mksquashfs squashfs-root wifi-ap_355.snap
sudo mv /var/lib/snapd/snaps/wifi-ap_355.snap /var/lib/snapd/snaps/wifi-ap_355.snap.backup
mv ~/wifi-ap_355.snap /var/lib/snapd/snaps/wifi-ap_355.snap
Not very elegant but then I just restarted my computer instead of figuring out how to restart the service I have killed.
I had everything in order, hostapd running in the wifi-ap snap with the updates options.
So long, and thanks for all the fish!