OpenWrt Forum Archive

Topic: Change UCI Path for config

The content of this topic has been archived on 1 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi,

is it possible to change the path for the config files for the uci System? On default it is /etc/config but i need to put my OpenWrt to set on read only so i copy these files into my ram because i still need to do changes on the configs.
I tried such commands like

uci -c/tmp/config set wireless.@wifi-iface.bssid=AA:BB:CC:DD:EE:FF

which does not work. Changing the -c with -P writes this into my config file on /tmp/config 

wireless.cfg033579.bssid='AA:BB:CC:DD:EE:FF'

So at least this writes into my file. But the problem is uci don´t care about this and still choose /etc/config/wirless.
But the wiki says :

-c <path>  set the search path for config files (default: /etc/config)

and

-P <path>  add a search path for config change files and use as default

Did i missunderstand something or why does it not use my files at /tmp/config as default.

Thanks in advance

Patrick

Even if you use alternative configuration files with your command all the scripts / apps in OpenWrt would have to do the same.

Maybe mount a tmpfs as overlay on top of /etc/config instead.

Well but if i put a tmpfs over /etc/config the configs wont be saved or am i wrong?

To describe what i need to do:

Im running a system with several Wifi Clients running Openwrt. Those Clients briging an connection with relayd to another device so it´s reachable via wifi. But these devices aren´t on a static spot so the wifi connectivity changes.
I worte a script to roam in this wifi when the connection is weak. To achive this i write the mac address from the new accesspoint into the wireless config file /etc/config/wireless(option bssid) to connect to the right AP.

But i need the Filesystem to be read-only so i can´t write the bssid into the /etc/config/wireless file so i set up my configurations on first boot and mount the system as read only. After this my idea was to copy the fix config into the ram so i can change the wifi bssid and nothing else. Now i need the uci system to grab on the /tmp/config/wireless file to change to the right AP after restarting wifi.
I thought i can simply change a path variable of the uci system for this.

After thinking about what u wrote after i wrote this text above i guess u could be right i first setup my system and after the setup i can mount the /etc/config as tmpfs.
Are there any instructions for doing this?

If anyone knows a better way solving this problem i am happy to read it here big_smile

Thanks in advance

Patrick

Just checked the code, uci set writes to /tmp/.uci and not /etc/config/.wireless.tmp or such. So your ro root isn't an issue. Just don't uci commit and I think you already get what you want.

Also a client should roam on it's own already if setup/working correctly, me thinks you are overengineering things here. Also just actively disconnecting the client so it connects to the new best AP should do if the client refuses to do so otherwise.

Replace /etc/config/wireless with a link to a file in the RAM disk.

If you don't specify a bssid, a STA mode interface should initially connect to the strongest AP with the SSID.  However if it is mobile you would need to force a reconnect (which should find the new strongest AP) when the signal gets weak.

(Last edited by mk24 on 8 Jun 2017, 15:33)

Hello,

first of all thanks for your answers. Well of course the system works without disconnecting manually and roams itself. But the problem in my system is that i need to secure that the connectivity is strong enough to transfer specific data so i have to read the current signal strengh and disconnect if it is too low. Because most systems wont roam until the connection is fully lost. Next problem why i can´t just disconnect the system and let it search it´s own AP that it´s a system continuously moving in a line up and down and if there are two AP´s having almost the same signal strength the client always connecting between those and so it disconnect unnecessary and reconnect.
My script checks the Signal strength and checks if it is really stronger like 5-10% more than the old one. So i avoid this hopping between two or more AP´s.

@mk24
The problem is i can´t replace the wireless file with a link to the copy in RAM because the RAM file is deleted on reboot and i can´t copy it on the next restart again.

@sera You say if i don´t commit my bssid it´s saved temporarly and when i disconnect the client it should use the /tmp/.uci and not the wireless config? Hmm would be the best way i think i gonna test this

If someone have a better idea let me know and thanks in advance

greetings

Patrick

Ok using the uci command without commit works fine (still have to test it more to be sure).
But i have one question. On my first use of this command the client instandly changed the AP and i had nothing more to do. But on the next try i had to restart my wifi Interface first before it connect to the other AP.
So is there like a timer which waits for reading the file in /tmp/.uci which i can lower or had the first reconnect an other reason?

And thank you very much for ur help

greetings

Patrick

The discussion might have continued from here.