EDIT 2022-10-24
I recently installed Ubuntu 22.04.1 LTS
on my 2GiB Pi4 (as there was finally a "supported" image which would run).
I have adapted most of my gpio code to run on this.
One major difference was /dev/gpiomem
which has permissions crw-rw---- 1 root dialout
- there is NO gpio
group (why is a mystery as it has nothing to do with dialout).
Rather than trying to modify Ubuntu I just included my gpio users in dialout
.
You really haven't provided enough information to make any reasonable deduction.
In particular you haven't said what the permissions of /dev/gpiomem
are.
Changing permissions on a /dev/
doesn't change anything for future boots.
This needs to be set in kernel or Device Tree
I am not familiar with Ubuntu Server, while I have been a Ubuntu user for 20 years, their Pi implementation uses their own kernel which has limitations compared to the Foundation implementation and while the last Server I tried works OK it is a resource hog so I have given up and just use Raspberry Pi OS - which works and strangely is well adapted to the Pi hardware.
It would seem to be unusual for a Server to implement GPIO access.
At least they do seem to have implemented /dev/gpiomem
(which has been in Raspbian since 2015) but not set permissions to make it usable.
Raspberry Pi OS sets groups/ownership to group gpio
using udev
crw-rw---- 1 root gpio 246, 0 2021-04-26 11:46 /dev/gpiomem
See http://wiringpi.com/wiringpi-update-to-2-29/ for an example which you could adapt.
/dev
aren't real files. They only exist in memory, which is to say, when the system is running. When you (re)boot, the kernel creates them appropriately (we hope). So you have to automate the change you want.