Sysctl kernel parameters on RPI Uubuntu core image

Hey folks,

I tried making an ubuntu core image for an RPI, and tried to set on the gadget snap a few “net” parameters, as mentioned in the gadget static kernel params docs :

kernel-cmdline:
  append:
    - net.ipv4.conf.all.arp_filter=1
  allow:
    - net.ipv4.conf.all.arp_filter=1

And after seeding the image, the parameter was not set, I also tried the dynamic kernel parameters, but that didn’t work either:

$ snap get system -d system.kernel.cmdline-append
{
        "system.kernel.cmdline-append": "net.ipv4.conf.all.arp_filter=1"
}
$ cat /proc/sys/net/ipv4/conf/all/arp_filter
0

I also tried setting the the cmdline.txt file directly, and while it appears in the kernel arguments, it does not apply it:

$ sudo cat  /run/mnt/ubuntu-seed/piboot/ubuntu/pi-kernel_14.snap/cmdline.txt
dwc_otg.lpm_enable=0 rng_core.default_quality=700 vt.handoff=2 modules_load=libcomposite net.ifnames=0 console=tty1 console=ttyAMA0,115200 snapd_recovery_mode=run net.ipv4.conf.all.arp_filter=1
$ cat /proc/cmdline
coherent_pool=1M 8250.nr_uarts=1 snd_bcm2835.enable_headphones=0 bcm2708_fb.fbwidth=0 bcm2708_fb.fbheight=0 bcm2708_fb.fbswap=1 smsc95xx.macaddr=E4:5F:01:BC:DF:32 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000  dwc_otg.lpm_enable=0 rng_core.default_quality=700 vt.handoff=2 modules_load=libcomposite net.ifnames=0 console=tty1 console=ttyAMA0,115200 snapd_recovery_mode=run net.ipv4.conf.all.arp_filter=1
$ cat /proc/sys/net/ipv4/conf/all/arp_filter
0

The only way that did work and made it persistently was:

$ echo 'net.ipv4.conf.all.arp_filter=1' | sudo tee /etc/sysctl.d/99-custom-network.conf
$ cat /proc/sys/net/ipv4/conf/all/arp_filter
1

Is there another way I can do this without modifying system-files or with a snap with network-control interface ??

cmdline doesn’t work as RPI is not using GRUB.

You answered your question, that is the recommended way, network-control would give broader permissions.

hey @gairepravesh , Thank you for confirming the gadget snap documentation only works for GRUB systems, we wanted to avoid using network-control but we will use it moving forward.