Hi,
I am using OSMC that I installed back in June 2015 on my raspberry Pi 2.
Here is the scenario.
Raspberry Pi 2 is connected to Wifi network A no ethernet cable connected.
I am connected to it via SSH terminal through my computer.
There is no visual access no hdmi connected.
How can I change Wifi Configuration of OSMC via terminal/SSH so that it now connects to a Wifi Network B ?
using connmanctl when I type
connect wifi_blah_psk
it disconnects my existing remote connection ( SSH remote terminal ) but also does not connect to the network B, because that is password protected and I have no chance to type in the password.
connect does not take wifi password as argumentā¦
The whole point of question is that I am accessing it remotely via SSH using network A and want to switch Wifi connection of OSMC to wifi network, whatever the solution is I will have to provide password and wifi information all at onceā¦
You will need to ensure you have the agent on, run āagent onā, but I am not sure what to advise about disconnection. Is there no way you can do this locally, possibly via My OSMC?
This is an interesting problem thatās why I though I would mention it at the very outset that I do not have ethernet connection just wifi connection and the same connection has to be switched to a different wifi network.
If I could update the configuration directly in the file where it stores the WIFI information then probbaly that would do, for example following information is applicable on raspbian. You can edit following file
But osmc does not have this .conf file anywhere in the wpa_supplicant folderā¦
I may well do it by physically attaching HDMI and display but, that will not solve the problem as I normally use it remotely and would prefer to solve it via SSH
The way connman works you wonāt be able to configure and connect to a second wifi network when controlling connmanctl via SSH over the first wifi network, because you will lose your first connection before completing the second connection, thus losing control of the connmanctl session.
connman doesnāt support āpre-configuringā wifi networks, to configure/save a network you must actually connect to it, and only once you have disconnected from the old network and connected to the new network will the network be saved.
Sorry but thatās just the way connman works, and yes, what you are trying to do is a bit of an unusual use case - OSMC is a mediacenter designed to be controlled with an onscreen GUI after all.
Actually this is doable. I could configure OSMC WiFi with connman via wired ethernet and have both interfaces up at the same time, then disconnect the wired interface and stay connected via wifi.
This is a great resource:
To pre-configure the wifi secret, see the section āWrite config file for connecting to secure AP:ā
Then when you bring up the interface with āconnmanctl connect ā¦ā it will just connect and not prompt for a password. In my case, it didnāt disconnect Ethernet either,
My problem is the following, and I would like to know if it is possible to do it using OSMC.
The thing is completely related to this topic, so I thought it would be better not to open a new thread but continue this one (maybe, with the new versions that have been released of OSMC now it is possible to achieve this).
I would like to give my raspberry with OSMC installed to a friend, who is not tech savvy. He has passed me the SSID and password of his network so I would like to give it to him pre-configured. I would prefer to give him the system pre-installed with some plugins (he doesnāt know how to install them) so it canāt be the first installation.
I have thought that I could change temporarilly my homeās SSID and password and maybe it could work but I would like to know if there is a better way.
I know how to do it in a raspbian or other distros not based on connman, but not how to do it in OSMC.
In the link posted by htpcero, the section āWrite config file for connecting to secure AP:ā could be the solution to my question but the problem is, for the line ā[service_wifi__managed_psk]ā I do not know the hash, I have not access to the Wifi and only know the SSID and password.
Searched for a little bit of information about the preseeder. Found this:
I supposed (no reason in particular) that that file was used only in the first boot for installing the o.s, not in every boot when all was installed and working.
Thank you! Thatās exactly what I need. I will test it next week.
In order to test the solution, I changed the SSID of my network to a new one and also the password. Then I connected some devices to that SSID to check it worked correctly.
And booted the pi to try it, but it didnāt connect. The gateway is correct and the IP is not used by other devices in the network.
Anything I am probably doing wrong? Do I have to forced it someway to read the preseed.cfg file?
Is there a way of using āSSID With Spacesā in the preseed.cfg file?
I know there were problems with those spaces, I do not know if they have been solved.
When I reverted the changes (changed again the SSID in the router to the original one and wrote the original preseed.cfg configuration) which was:
d-i target/storage string sd
d-i network/interface string wlan
d-i network/auto boolean true
d-i network/ssid string SSID2_Without_Spaces
d-i network/wlan_keytype string 1
d-i network/wlan_key string passphrase2
It worked. In order to test if I had done something wrong or if it just isnāt reading the preseed.cfg and taking the configuration that works (which is stored somewhere), I wrote a false SSID and a wrong password in the preseed.cfg and put the original SSID and original password in the router. The connection worked.
So the only think that occurs to me is that it isnāt reading the preseed with the changes. Could that be possible?
Itās just that in my original comment I said āI would prefer to give him the system pre-installed with some plugins [ā¦] so it canāt be the first installationā so I guessed that what was answered worked not only for the first boot.
If it is impossible to give to a friend a system pre-installed with some plugins ā¦ ok, itās just a pity.