Howto autostart ssh
-
@chris_bavaria said in Howto autostart ssh:
Maybe this is a issue with the port of VollaPhone22?
You can ask here : https://github.com/HelloVolla/ubuntu-touch-beta-tests/issues
-
The same on Pixel 3a (OTA24)
$sudo systemctl enable ssh Synchronizing state of ssh.service with SysV init with /lib/systemd/systemd-sysv-install... Executing /lib/systemd/systemd-sysv-install enable ssh update-rc.d: error: Device or resource busy
Why is device or resource busy?
-
In the user guide about how to start ssh for 16.04, there is nothing about the
systemctl
command. I don't recall to use such command when enabled ssh on my FP2 a long time ago (it works after reboots). Does Vollaphone handle it differently? -
@jezek
Yes, this is correct, there is nothing aboutsystemctl
.
Enabled ssh is after reboot disabled on VollaPhone, same on Pixel 3a with 20.04 (2022-W51).
Is there a solution to turn ssh service on, while booting? -
@chris_bavaria said in Howto autostart ssh:
Is there a solution to turn ssh service on, while booting?
Hmm... if there is
systemctl
, then there has to besystemd
, am I right? And if there is a systemd, then you can write a user service, which will run at boot.If there is no
systemd
, then it is using upstart and you can make it run script on boot.If everything fails try cron job on boot.
-
@jezek
Thanks for the explanation.
I've now read deeper and found the command for ssh in runlevel3.
This points to /etc/init.d. This is the script that starts the "OpenBSD Secure Shell server" at boot time.
According to my research, the settings for the autostart are made in /etc/init.
Since I don't want to change the script, but just want to start the service, I've included
sudo update-rc.d ssh defaults
enabled the shh service (again).
After that I got this output with the following command:phablet@ubuntu-phablet:~$ service --status-all ... [ + ] apparmor [ + ] isc-dhcp-server [ - ] keyboard setup ... [ + ] network manager [ + ] networking ... [ - ] rc.local ... [ + ] ssh [ + ] udev ...
Although ssh is shown as an active here, I can't access UbuntuTouch 16.04 from my client.
ssh: connect to host 192.168.188.50 port 22: Connection refused
In the systemctl I found the ssh.socket with the following command. However, this ssh.socket is not executable.
$systemctl list-unit-files --type=socket UNIT FILE STATE ... ssh.socket enabled ... systemd-networkd.socket disabled ...
I need to run the
sudo service ssh start
command manually to get access via ssh.I found the startup script for ssh.service under /lib/systemd/system and it already exists.
When I run the existing ssh.service command to enable it, I get the following error:root@ubuntu-phablet:/lib/systemd/system# systemctl enable ssh.service Synchronizing state of ssh.service with SysV init with /lib/systemd/systemd-sysv-install... Executing /lib/systemd/systemd-sysv-install enable ssh update-rc.d: error: Device or resource busy root@ubuntu-phablet:/lib/systemd/system# systemctl status ssh Failed to get properties: No such interface ''
I see the problem in the following line:
update-rc.d: error: Device or resource busy
Is this service locked in UbuntuTouch?
After the reboot I still getssh stop/waiting
fromsudo status ssh
. Am I missing something here?
A manualsudo service ssh start
results inssh start/running, process 7838
.
Can someone confirm that the ssh service doesn't start automatically?I'll try it now with cron job on boot, hopefully it works. But it's not such a clean solution.
( upstart works together with systemd > https://crunchify.com/systemd-upstart-respawn-process-linux-os/)
-
@chris_bavaria I have an FP2. I've enabled ssh long time ago, using the documentation mentioned above. The only trouble I have with ssh, is that when I enable wifi on the phone and want to connect to it (from notbook using ssh), many times the connection doesn't get through. I have to reconnect the wifi on the phone (by tapping on the connected wifi name in wifi notification area) and than it connects. No need to start service in the phone terminal.
-
@jezek
Is ssh automatically activated when the phone starts? -
Hi, it's probably a botched job. I'm sorry.
SSH does not start automatically on Pinephone and Vollaphone 22. It may happen on more devices, I don't know.
To solve it I created this "thing" when I played with Pinephone.
Script enabledSSH.sh
#!/bin/bash ### Enable SSH at startup in UT ### echo "#!/bin/bash" > startssh.sh echo "### Iniciar SSH ###" >> startssh.sh echo "exec service ssh start" >> startssh.sh sudo chmod +x startssh.sh sudo mount -o remount,rw / sudo cp startssh.sh /etc/init.d/ sudo rm startssh.sh sudo update-rc.d startssh.sh defaults sudo reboot
Then execute:
bash enabledSSH.sh
P.S. Rerun only when changing channels.
-
@bolly
THANK YOU SO MUCH !
Now runs after a reboot and is also available without unlocking the home screen.
This is a real work simplification.Great work!
-
-
-
-
I'm new, also running UbuntuTouch 16.04 as of this morning.
I'm wondering why this doesn't work 'out of the box', we have a
/etc/init.d/ssh
and it's active for the run levels we want. I've spent some time trying to trace this, without luck.The standard hack is to put stuff in
/etc/rc.local
, so that's what I did in the end (service ssh start
).