DietPi-PREP/1st boot quirks

Created on 17 Dec 2018  ·  2Comments  ·  Source: MichaIng/DietPi

1

  • DietPi-RAMlog fails to start on 1st boot, properly because it starts before dietpi-fs_partition_resize has finished.

    • This leads to all logs added on 1st initial dietpi-software run will be lost, since dietpi-ramlog 1 is not called anymore.

    • This again leads to e.g. Apache, chosen on 1st setup, will fail to start after reboot, since it's log dir is not present anymore.

  • Properly we should add dietpi-ramlog and maybe even some other services seen in screen above to Before=, to have resizing really done as the first thing, before anything else is starting?
  • Does Before=local-fs.target work?
  • Or better: https://www.freedesktop.org/software/systemd/man/systemd.special.html#local-fs-pre.target

    • Before=local-fs-pre.target

  • Another possibility to solve symptoms only, is not not allow RAMlog to fail. Log error messages, but always exit with 0. Then dietpi-ramlog 1 is always called on shutdown, updating logs on disk.

1

  • Debian login prompt appears on local terminal before even preboot has finished.

    • This leads to all login scripts already run, before init setup has finished, while they are missing, after it has finished, so initial globals load to session etc and most importantly initial dietpi-software start is not done.

Bug PREP Solution available

Most helpful comment

PR init to harden the boot order: https://github.com/Fourdee/DietPi/pull/2357 (WIP!)

All 2 comments

Current state:

Dec 17 00:02:09 DietPi systemd[1]: Reached target Local File Systems (Pre).
Dec 17 00:02:09 DietPi systemd[1]: Mounting /tmp...
Dec 17 00:02:09 DietPi systemd[1]: Mounting /DietPi...
Dec 17 00:02:09 DietPi systemd[1]: Mounting /var/log...
Dec 17 00:02:09 DietPi systemd[1]: Mounted /DietPi.
Dec 17 00:02:09 DietPi systemd[1]: Mounted /tmp.
Dec 17 00:02:09 DietPi systemd[1]: Mounted /var/log.
Dec 17 00:02:09 DietPi systemd[1]: Reached target Local File Systems.
Dec 17 00:02:09 DietPi systemd[1]: Starting Set console font and keymap...
Dec 17 00:02:09 DietPi systemd[1]: Starting Raise network interfaces...
Dec 17 00:02:09 DietPi systemd[1]: Starting Flush Journal to Persistent Storage...
Dec 17 00:02:10 DietPi systemd[1]: Started Flush Journal to Persistent Storage.
Dec 17 00:02:10 DietPi systemd[1]: Starting Create Volatile Files and Directories...
Dec 17 00:02:10 DietPi systemd[1]: Started Create Volatile Files and Directories.
Dec 17 00:02:10 DietPi systemd[1]: Starting Network Time Synchronization...
Dec 17 00:02:10 DietPi systemd[1]: Starting Update UTMP about System Boot/Shutdown...
Dec 17 00:02:10 DietPi systemd[1]: Started Update UTMP about System Boot/Shutdown.
Dec 17 00:02:10 DietPi systemd[1]: Started Network Time Synchronization.
Dec 17 00:02:10 DietPi systemd[1]: Reached target System Initialization.
Dec 17 00:02:10 DietPi systemd[1]: Reached target Basic System.
Dec 17 00:02:10 DietPi systemd[1]: Starting LSB: Lightweight SSH server...
Dec 17 00:02:10 DietPi systemd[1]: Starting DietPi-RAMlog...
Dec 17 00:02:10 DietPi systemd[1]: Starting dietpi-fs_partition_resize...
Dec 17 00:02:10 DietPi systemd[1]: Started Daily Cleanup of Temporary Directories.
Dec 17 00:02:10 DietPi systemd[1]: Reached target Timers.
Dec 17 00:02:10 DietPi systemd[1]: Reached target System Time Synchronized.
Dec 17 00:02:10 DietPi systemd[1]: Started Raise network interfaces.
Dec 17 00:02:10 DietPi systemd[1]: dietpi-ramlog.service: Control process exited, code=exited status=1
Dec 17 00:02:10 DietPi systemd[1]: Failed to start DietPi-RAMlog.
Dec 17 00:02:10 DietPi systemd[1]: dietpi-ramlog.service: Unit entered failed state.
Dec 17 00:02:10 DietPi systemd[1]: dietpi-ramlog.service: Failed with result 'exit-code'.
root@DietPi:~# cat /var/tmp/dietpi/logs/dietpi-ramlog.log
Mon 17 Dec 00:02:10 GMT 2018 | DietPi-RAMlog: Startup - Restoring log folder structure to RAMdisk...
Mon 17 Dec 00:02:10 GMT 2018 | DietPi-RAMlog: Startup failed with exit code 1

Found the reason:

        [[ -d $FP_DIETPI_RAMLOG_SAVE ]] && cp -R -p --attributes-only $FP_DIETPI_RAMLOG_SAVE/. /var/log/
        EXIT_CODE=$?; if (( $EXIT_CODE )); then
  • Leads to EXIT_CODE=1 due to [[ -d $FP_DIETPI_RAMLOG_SAVE ]] "fails", since on my last PREP PR, RAMlog disk storage is not preserved. Easy to fix!

Resolved with: https://github.com/Fourdee/DietPi/commit/e1288c4b1140657eaa8cd4611af9c19183124482

  • But actually it would be best to find a way to force shutdown phase being executed, even if it failed on startup? Otherwise meanwhile created logs lost on shutdown. Otherwise startup phase failed, not all logs from store might be ported to RAM. So on shutdown phase these disk store logs will be lost...
    🈯️ Retest
    1
  • I still think, we should run fs_resize Before=local-fs-pre.target, as early as possible.

Somehow the login prompt issue also did no appear now. Not sure how it is related. Further investigating.

PR init to harden the boot order: https://github.com/Fourdee/DietPi/pull/2357 (WIP!)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Fourdee picture Fourdee  ·  3Comments

Fourdee picture Fourdee  ·  3Comments

Kapot picture Kapot  ·  3Comments

pgferr picture pgferr  ·  3Comments

MichaIng picture MichaIng  ·  3Comments