Pi2 error on login

Just done a fresh install on a Pi2 to test a new Pi cam.

Was working well on wired connection.

I setup a WiFi connection and that was working fine for a while and then I started to get this error on login using WinSCP and then PuTTY:

-bash: /DietPi/dietpi/login: cannot execute binary file: Exec format error.

This happens with wired and wireless connections.

Reflashed the SD and did and set it all up again - all working for a while and then same error ocurred.

Couldn’t find a solution with Google - any ideas?

Hi John,

This could indicate either a incorrect architecture for the bash binary (would be very strange), or, a corrupt filesystem.

Can you try running the following and paste results if it fails:

 /bin/bash /DietPi/dietpi/dietpi-cpuinfo

Edit:
and please paste results of:

echo -e "$PATH"

Hi Fourdee,

/bin/bash /DietPi/dietpi/dietpi-cpuinfo - gives:

/DietPi/dietpi/dietpi-cpuinfo: /DietPi/dietpi/dietpi-cpuinfo: cannot execute binary file

echo -e “$PATH” - gives:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/binecho -e /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/binls

It’s looking like the system is stuffed - I cannot run dietpi-software or the other utils on the home page.

I am wondering about an inadequate power supply - it was good enough for the Pi on its own but add a camera and wifi dongle maybe not so.

I’ll get a better one today and try again.

Hi John,

Looks like the PATH is broken in /etc/profile. Please backup the current file

/bin/mv /etc/profile /etc/profile.bak

Then select all, copy and paste the following code over SSH:

/bin/cat << _EOF_ > /etc/profile
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

if [ "`id -u`" -eq 0 ]; then
  PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
  PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games"
fi
export PATH

if [ "\$PS1" ]; then
  if [ "\$BASH" ] && [ "\$BASH" != "/bin/sh" ]; then
    # The file bash.bashrc already sets the default PS1.
    # PS1='\h:\w\\$ '
    if [ -f /etc/bash.bashrc ]; then
      . /etc/bash.bashrc
    fi
  else
    if [ "`id -u`" -eq 0 ]; then
      PS1='# '
    else
      PS1='\$ '
    fi
  fi
fi

if [ -d /etc/profile.d ]; then
  for i in /etc/profile.d/*.sh; do
    if [ -r \$i ]; then
      . \$i
    fi
  done
  unset i
fi
_EOF_

Reboot the system and let me know if the issue still occurs.

Also, can you paste output of:

/bin/cat /etc/bash.bashrc

Hi Fourdee,

Jumped the gun a bit and decided to reflash and start again - sorry if this has not helped your debugging exercise.

I’ve borrowed a better power supply from another device and so far so good - wifi and cam working.

And the shell login is back as it should be.

Thanks again for your help.

John

Hi John,

No worries, reinstall never fails :smiley:. If it happens again, please let me know, would like to debug it :slight_smile:

Hi Fourdee,

After a few days of trouble free use a similar problem has arisen and now when I login I get:

-bash: /DietPi/dietpi/login: No such file or directory

The dietpi folder is empty.

Any ideas? There is not much on the system so I plan to rebuild on a new SD card - I’ll keep the existing one as is if you want to debug.

John

Hi John,

Very strange. It could be a filesystem corruption (PSU/SD issue).
Yes, worth trying a new card and stable PSU if possible. If you dont have one already, the official RPI PSU’s are extremely good, I use them for all microUSB powered boards and i’ve never had an issue with them. Worth every penny for that peice of mind and stability.

Did you manually install/config any programs on the device? Or solely using dietpi-software?

Hi Fourdee,

All I did was install PHPMyAdmin, MySQL - through your interface.

I suspect the SD card as dietpi has worked very reliably on a Pi 1 and XU4 here.

The PSU is an Apple 10W which I would have thought good enough for a Pi 2 with USB wifi and Pi Cam?

John

Hi John,

The PSU should be fine. As long as it can sustain a stable 5 volts (although 4.8-5.1 range should be fine).

If the issues persist, let me know. I’am just wondering if our daily fstrim cron job might possibly be corrupting files.

Hi Fourdee,

I’m not (as far as I am aware) running fstrim on this (unless it is installed by default on v123?). This is a Pi2 with 8GB SD.

I disabled fstrim on the XU4, which has an SSD, as it didn’t seem to be doing anything.

John

Hi John,

We enabled a automatically daily FStrim in DietPi v121.

I experienced similar issues yesterday:

-bash: /DietPi/dietpi/login: No such file or directory

We also had a few reports from other users with similar issues.

I believe FStrim is the cause and I have disabled it in v125 until we can prove otherwise: https://github.com/Fourdee/DietPi/issues/440

So probably best to do a fresh installation if you can.

I’m up to 125 on both devices so should be OK?

John

Hi John,

Are these from a fresh installation of a DietPi image, or, existing installation and upgraded at a later date?

Hi Fourdee,

The XU4 has been going for several weeks but I can’t remember what version I started on. The Pi2 started on v120 and then auto upgraded. Both now on v125.

John

Hi John,

The XU4 will be fine as FStrim doesn’t work on the device, so running the command had no effect.
RPi will be fine also as it updated during 1st run and disabled the daily FStrim.

Everything should be stable now, if you get any issues, please let me know :slight_smile: