Backup from S905X2 to S905X4 fails on SSH

Hello good afternoon,

I have a X96max with S905X2, 4G and Gigabit and Coreelec 20.1 installed. I have bought a Vontar X4 with S905X4, 4G and Gigabit.
I have booted Coreelec 20.1 in this new Vontar, from USB, tested ssh connection and everything perfect.

Then, I have done a backup from coreelec in X96max(snapshots excluded), imported to Vontar and restored from coreelec. It has rebooted and I have all the addons, configs, everything fine.
One thing that is not included in backup is fixed IP but this is not a big deal, so no problem.
I have tested SFTP connection and OK
Buuuut, the issue comes when I try to connect via SSH. It gets connected but in less than a second, Coreelec closes the connection. I have tried connecting from android phone, from windows, from putty, … and with the same result so, my thinking is that because of the backup, Coreelec detects that Isomething has changed, and closes the SSH connection as soon as it gets established.
I have tried with “ssh root@IP -v” and this is what console shows after establishing the connection (before, what it shows is the same than with my old device when there is no problem so I am not pasting it):

#                  CoreELEC                  #
#              #

CoreELEC (official): 20.1-Nexus (Amlogic-ne.arm)
      Machine model: Amlogic
     CoreELEC dt-id: sc2_s905x4_4g_1gbit

debug1: client_input_channel_req: channel 0 rtype exit-signal reply 0
debug1: client_input_channel_req: channel 0 rtype reply 0
debug1: channel 0: free: client-session, nchannels 1
Connection to closed.
Transferred: sent 1976, received 2988 bytes, in 0.2 seconds
Bytes per second: sent 11854.1, received 17925.1
debug1: Exit status -1

Could anyone help me? I would like to not start from scratch setting up all the addons. Thanks in advance :slight_smile:

Yeah. Had that problem with nightly . Easy fix.

Create q file called .profile with contents


Save it in /storage .

You can do that using the ssh root@ip “vi /storage/.profle”

The reason behind it that somehow login shell did not properly update while doing a system upgrade .
Mine is a workaround solution .

Hello, I have tried this with no success.
Initially I have use the command ssh root@ip “vi /storage/.profile” but this creates just an empty file.
So, I transfered this file (because SFTP is working well) from coreelec to my computer, I have editted it and added:


Then, saved file and transferred back to coreelec. Rebooted the coreelec just in case and I have still the same ssh issues :frowning:
I have tried, in addition, to copying this file to /storage/.config/ but same result.
(I am booting Coreelec from USB stick, it is not installed on internal memory)
Thanks for trying anyway… do you think there is something else I can try? Thanks again!

No idea why it does not work.

Can you try to do a
ssh root@YOURIP “/bin/bash”

it should log you in.
it won’t output the shell. it will look weird but you should be logged in.
If that does not work then you have another problem.

On mine:

cenas@lock-Air ~ % ssh root@ “/bin/sh”
root@’s password:


cat .profile

also check permissions

ls -lastrh /storage/.profile
4 -rw-r–r-- 1 root root 15 Jun 17 00:58 /storage/.profile

also check your passwd file:

grep root /etc/passwd
root:x:0:0:Root User:/storage:/bin/sh

Hello and thanks for answering again.
You are right, with ssh root@YOURIP “/bin/bash” I am in, it looks weird at all, I thought I was not in and computer was “thinking” but not, I am in with that command.
So this is a workaround but I think is the only thing I can get now … hopefully, this will totally get fixed by upgrading to Coreelec 21.0.
Thanks a lot !!!

now that you are in… delete the .profile you transferred via sftp and create it locally using vi.
Maybe it fixes your issue. Mine did not fix with CoreELEC 21.0 nightly update.
Now that I got time to write one potential reason for this behaviour would be if you had switched root’s shell (e.g. to bash) before, as sysupgrading will (and must) remove additionally installed binaries during the upgrade, leaving you with your old configuration override to use /bin/sh as root’s shell, without the shell being installed or having proper permissions. So, something messed up your default shell on paswd file. if you create the profile it will force it to use bash binary.

I has not success… what I have done/typed in console while ssh established:

cd /storage (even I was already there)
rm .profile
touch .profile
echo "#!/bin/sh" > .profile
echo bash >> .profile

But I am suffering the same connection closed :frowning:

Your command do not work.
! Needs to be escaped to work like that but \ won’t work.

you need to use single quotes like this :

echo ‘#!/bin/sh’ > .profile
echo ‘bash’ >> .profile

Why not use vi ? Much easier

I have tried what you wrote and no success either.
I am not using directly “vi” because when I do, it shows “odd characters” in the console.
For example, with an existing .profile file, this happens when I do it directly:

PS C:\Users\user> ssh root@ "vi .profile"
root@'s password:
e[?1049he[999;999He[6ne[He[Je[1;1H#!/bin/she[2;1Hbashe[3;1H~e[4;1H~e[5;1H~e[6;1H~e[7;1H~e[8;1H~e[9;1H~e[10;1H~e[11;1H~e[12;1H~e[13;1H~e[14;1H~e[15;1H~e[16;1H~e[17;1H~e[18;1H~e[19;1H~e[20;1H~e[21;1H~e[22;1H~e[23;1H~e[1;1He[24;1He[K- .profile 1/2 50%e[1;1H:q!
e[24;1He[K:q!e[1;1He[1;1He[24;1He[K- .profile 1/2 50%e[1;1He[24;1He[Ke[?1049l
PS C:\Users\user>

If I do what you told me about workaround, with a non existing file for example:

PS C:\Users\user> ssh root@ "bash"
root@'s password:
vi whatever.txt
e[?1049he[999;999He[6ne[He[Je[2;1H~e[3;1H~e[4;1H~e[5;1H~e[6;1H~e[7;1H~e[8;1H~e[9;1H~e[10;1H~e[11;1H~e[12;1H~e[13;1H~e[14;1H~e[15;1H~e[16;1H~e[17;1H~e[18;1H~e[19;1H~e[20;1H~e[21;1H~e[22;1H~e[23;1H~e[1;1He[24;1He[K- whatever.txt 1/1 100%e[1;1H

I do not know if came to this point wait for an update could fix this or if I should give up on loading a “coreelec backup” from a different device… and is a “shit” because everything else is working as it was in the other device, so thinking about starting over and install repositories, addons, configurations … ufff

I really doubt that.
I saw same issue some time back but can’t find what my findings were.

If you use putty or some other ssh client same issue happens?

And did you have entware installed?

Do you have a windows machine?

Hook up the x2 bix to pc
Through network n windows explorer make a cooy of the ADDONS folder in CoreELEC.

Save to desktop or wherever…

You are done with x2 box.

Do a clean install on vontar x4 box
Through network n windows explorer open up addons folder in x4 CoreELEC

Copy n paste saved addons from x2 box you saved.
Depending on items can take 3 mins…

After reboot
Since you did not Install from repository or from zip they will be disabled.

Go to addons and enable

Yes us slow n caveman like
But works

Happy Testing

I just noticed you are using windows power shell.

So, some things behave differently using ssh and single or double quotes.
Can’t help you much on that as I do not use windows shell. You can try and install Cygwin64 and do all the commands from there for better compatibility.

That weird chars are ANSI control codes. powershell does not support that. so you will get weird codes with powershell and very weird representation of everything. You have better output using a normal windows shell instead of powershell (cmd.exe). Probably you are creating the files incorrectly because of that.

I do recall there was a one liner that could help fixing the locale that helped with login issues also (actually I think the one line came from @vpeter ) Maybe you can try it on Cygwin

ssh DEVICE_IP_ADDRESS ‘/usr/bin/sed -e “s|^export LANG=(.)|#export LANG=\1|g" -e "s|^export LC_ALL=(.)|#export LC_ALL=\1|g” -i /opt/etc/profile’

also share the contents of /opt/etc/profile after running the command.

Hello to everyone… it came out that yesterday I did a clean install of coreelec to avoid this issue…
So, the day I receive more answers is the day I decided to give up on this…
Sorry, and thank you all :slight_smile:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.