Dietpi-preboot.service Fails to start

Hi,

Just setup a fresh install of DietPi then installed PiHole & PiVPN however I have rebooted and gone to login again and I was getting command not found for all dietpi command such as dietpi-config.

After looking at the journalctl i see that the dietpi-preboot.server is failing to start and i cant find much information elsewhere on next steps to try and resolve this before i just start from scratch again.

Any help would be much appreciated.

Oct 10 08:30:58 DietPi systemd[320]: dietpi-preboot.service: Failed to execute /boot/dietpi/preboot: Exec format error
Oct 10 08:30:58 DietPi systemd[320]: dietpi-preboot.service: Failed at step EXEC spawning /boot/dietpi/preboot: Exec format error
Oct 10 08:30:58 DietPi systemd[1]: dietpi-preboot.service: Main process exited, code=exited, status=203/EXEC
Oct 10 08:30:58 DietPi systemd[1]: dietpi-preboot.service: Failed with result 'exit-code'.
Oct 10 08:30:58 DietPi systemd[1]: Failed to start DietPi-PreBoot.
Oct 10 08:30:58 DietPi systemd[1]: Dependency failed for DietPi-PostBoot.
Oct 10 08:30:58 DietPi systemd[1]: dietpi-postboot.service: Job dietpi-postboot.service/start failed with result 'dependency'.

Welcome to our community.

hmm that seems the program is corrupted. can you try to execute manually as user root.

/boot/dietpi/preboot

if that is not working, can you show content of the script

cat /boot/dietpi/preboot

Thanks for the quick reply Joulinar,

Just tried that and got the same error when manually running and something is off with the preboot file, it looks empty when running that command.

Output below

root@DietPi:~# /boot/dietpi/preboot
-bash: /boot/dietpi/preboot: cannot execute binary file: Exec format error
root@DietPi:~# cat /boot/dietpi/preboot
root@DietPi:~#

let’s have a look to the directory

ls -la /boot/dietpi/

Output below, I should also mention I modified the dietpi.txt file based on your comments in this thread auto update setting - #17 by manilx around enabling auto updates by changing the line “CONFIG_CHECK_APT_UPDATES=2”

root@DietPi:~# ls -la /boot/dietpi/
total 1173
drwxr-xr-x 4 root root   3072 Oct 10 08:38 .
drwxr-xr-x 4 root root   3072 Jan  1  1970 ..
-rwxr-xr-x 1 root root    577 Jul 31 17:27 .dietpi-services_include_exclude
-rwxr-xr-x 1 root root    363 Oct  9 22:59 .hw_model
-rwxr-xr-x 1 root root      2 Oct  9 22:34 .install_stage
-rwxr-xr-x 1 root root     79 Oct  9 22:34 .installed
-rwxr-xr-x 1 root root     15 Jul 31 17:24 .prep_info
-rwxr-xr-x 1 root root    112 Oct  9 22:28 .version
-rwxr-xr-x 1 root root  11511 Oct  6 20:25 dietpi-autostart
-rwxr-xr-x 1 root root  24254 Oct  6 20:25 dietpi-backup
-rwxr-xr-x 1 root root   8121 Oct  6 20:25 dietpi-bugreport
-rwxr-xr-x 1 root root  14521 Oct  6 20:25 dietpi-cleaner
-rwxr-xr-x 1 root root  43539 Oct  6 20:25 dietpi-cloudshell
-rwxr-xr-x 1 root root 140799 Oct  6 20:25 dietpi-config
-rwxr-xr-x 1 root root   5262 Oct  6 20:25 dietpi-cpuinfo
-rwxr-xr-x 1 root root   9386 Oct  6 20:25 dietpi-cron
-rwxr-xr-x 1 root root  16699 Oct  6 20:25 dietpi-ddns
-rwxr-xr-x 1 root root  74265 Oct  6 20:25 dietpi-drive_manager
-rwxr-xr-x 1 root root   7219 Oct  6 20:25 dietpi-explorer
-rwxr-xr-x 1 root root   3960 Oct  6 20:25 dietpi-launcher
-rwxr-xr-x 1 root root   4991 Oct  6 20:25 dietpi-led_control
-rwxr-xr-x 1 root root  21334 Oct  6 20:25 dietpi-letsencrypt
-rwxr-xr-x 1 root root   9003 Oct  6 20:25 dietpi-login
-rwxr-xr-x 1 root root   6789 Oct  6 20:25 dietpi-morsecode
-rwxr-xr-x 1 root root  35339 Oct  6 20:25 dietpi-services
-rwxr-xr-x 1 root root 672886 Oct  6 20:25 dietpi-software
-rwxr-xr-x 1 root root   7345 Oct  6 20:25 dietpi-survey
-rwxr-xr-x 1 root root  17082 Oct  6 20:25 dietpi-sync
-rwxr-xr-x 1 root root  22531 Oct  6 20:25 dietpi-update
-rwxr-xr-x 1 root root  21069 Oct  6 20:25 dietpi-vpn
drwxr-xr-x 2 root root   2048 Oct  6 20:25 func
drwxr-xr-x 2 root root    512 Oct  6 20:25 misc
-rwxr-xr-x 1 root root   2426 Oct  6 20:25 postboot
-rwxr-xr-x 1 root root   1393 Oct  6 20:25 preboot
root@DietPi:~#

at least the file has a size, strange that nothing seems to be inside. Anyway, let’s appley the last update aging. This should download all DietPi scripts.

dietpi-update -1

When i try to run that i get a command not found error(Output below). I have tried dietpi-config as well and get the same thing which i presume is because the preboot service cant start.

root@DietPi:~# dietpi-update -1
-bash: dietpi-update: command not found
root@DietPi:~#

Try using full path

/boot/dietpi/dietpi-update -1
reboot

That got the command running but recieved the following error

 APT update                                                 │
│  - Command: apt-get -y update                              │
│  - Exit code: 100                                          │
│  - DietPi version: v8.8.0 (MichaIng/master) | HW_MODEL: 3 | HW_ARCH: 3 | DISTRO: 6│
│  - Image creator: DietPi Core Team                         │
│  - Pre-image: from scratch                                 │
│  - Error log:                                              │
│ E: Syntax error /etc/apt/apt.conf.d/97dietpi:1: Extra junk at end of file  

Looks like there is more corruption on your drive. You are using SD card?

Theoretically you could try to fix some of these file system errors.

> /forcefsck
reboot
# then after reboot
journalctl -t systemd-fsck

If possible, create a backup of your system beforehand.

It could be SD Card problems. I ended up just formatting the SD card and starting from scratch. I have a spare SD card that I will use if i have the same problem again after wiping the SD card.

Thanks for taking the time to help.

I always create a alias in .bashrc to when I type ll (lowercase L L) it does
alias=‘ls -lah --color=auto’
quicker to see the directories and in human readable format

Just a tip, not a solution for the above problem…sory