New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New command /usr/bin/iiab-remoteit to quickly obtain a new Claim Code for https://remote.it (allows remote connections to manage an IIAB) #3161
Conversation
|
||
if grep -q '^remoteit_installed:' /etc/iiab/iiab_state.yml; then | ||
sed -i "s/^remoteit_installed:.*/remoteit_installed: True/" /etc/iiab/iiab_state.yml | ||
else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_installed: True are the only entries found in iiab_state, if !
and just the echo if missing seems more appropriate, does away with the unneeded sed alteration shorting the code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense.
(Unless /etc/iiab/iiab_state.yml
hypothetically changes in future, to store other kinds of state...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other new states sure I can see that, I doubt you are refactoring every role to drop is defined for any reason other than code churn.
The forced reinstall is a pretty big hammer and might be able to go away. I've discovered that removing /etc/remoteit/config.json and then restarting connectd results in a new config.json with a different 'id' & 'claim' being generated, looks like 'name' is generated from the hostname of the machine.
Just to clarify, the current logic in iiab-support that skips using ansible relies on ansible being run at least once to install the role otherwise ansible will be used used to install openvpn to place all the template files in to their correct locations. |
Aside; It appears remote.it is hardly bug-free on Raspberry Pi. If so this is unfortunate and a bit surprising, as the company has a very long history working with Raspberry Pis. Still, let's try to get more feedback from more implementers to see what many different people's experiences are in coming weeks and months. |
It's a good question as to why this in fact works without stalling from scripts and from Ansible. I'd love to know the answer — as this happens in other situations too — specifically: such scripts do consistently work even on graphical desktop OS's, e.g. when invoked from a script or from Ansible, instead of from a graphical command-line. (Possibly this has something to do with the particular environment variables or similar, within a graphical [I meant interactive] terminal, [versus non-interactive scripts] ?) |
This is very promising. I've seen 1 instance where this did not work, but it would seem to work a vast majority of the time. |
This was from a ssh session with no desktop installed.
no graphics just a cmdline over ssh |
Indeed. I should not have said a literal graphical desktop (in the style of X Windows, etc). Certainly it works from scripts/Ansible. But I don't know the exact dynamics. I (suspect?) it has something to do with shell environment variables — that somehow establish whether it's an interactive session or not. Likewise: The |
You still have to tab over to OK and then enter to proceed when using /usr/bin/iiab-remoteit, same as doing a |
#3011 (comment) additional inspiration for this PR.
Think the only time this won't work if there is a /etc/remoteit/registration file present. |
Heavily tested on Ubuntu 22.04 pre-release (VM). Time to push this and seek out broader community feedback as more people bang on this and use it in many different ways. Many thanks to @jvonau whose insight into deleting (Hopefully this undocumented feature[*] will remain working as part of remote.it Device Packages for years to come, if we're lucky!) [*] Hinted at within https://support.remote.it/hc/en-us/articles/360061228252-Oops-I-cloned-an-SD-card- |
Thanks to @jvonau's ideas at #3158 and building on:
This PR also overhauls and dramatically simplifies the installation of remote.it's Device Package, using their official 1-line installer ("curl -L https://downloads.remote.it/remoteit/install_agent.sh") as recommended by their 2022-01-24 document "Streamlined installation for Linux and Raspberry Pi platforms".
Note that
apt purge remoteit*
is regrettably necessary at this time [prior to running remote.it'sinstall_agent.sh
],in order to get a new Claim Code in many corner cases, andfor several reasons. One of those reasons is that the Device Package .deb files (same thing you get at https://remote.it/download/) are oddly each built in slightly different ways. Without going into all the ugly details, the situation and its resolution are summarized here:https://github.com/holta/iiab/blob/5854ab7c619b3c01446951f925c5f27eb37ed077/roles/remoteit/templates/iiab-remoteit#L32-L34
FYI this PR intentionally avoids Ansible, so that the
/usr/bin/iiab-remoteit
command runs as quickly and resiliently as possible, quite similar to/usr/bin/iiab-support
with OpenVPN.This PR is tested on the latest pre-release of Ubuntu Desktop 22.04, with more testing ongoing on other OS's too, including 32-bit and 64-bit RasPiOS on Raspberry Pi 4.