:: [devuan-dev] init scripts fail when…
Top Page
Delete this message
Reply to this message
Author: Walter Alejandro Iglesias
Date:  
To: devuan-dev
Subject: [devuan-dev] init scripts fail when /var is in a separate partition
Dear Devuan maintainers,

Yesterday I installed Excalibur. I did something that I hadn't done in
a while on Linux, to create separate partitions for /usr and /var. But
this brought me a problem. The following messages appear at boot:

[...] Cannot persist initramfs fsck.log ... failed!
[...] Checking file systems...Cannot persist the following output on disc ... failed!

They are generated by /etc/init.d/checkroot.sh and
/etc/init.d/checkfs.sh. These scripts fail trying to save the fsck logs
to /var/log/fsck/*. Once the system booted, I check those files and I
get this:

$ cat /var/log/fsck/check*
(Nothing has been logged yet.)
(Nothing has been logged yet.)

I'll tell you what I investigated so far. In /etc/init.d/checkroot.sh
(line 17) you'll find this variable:

FSCK_LOGFILE=/var/log/fsck/checkroot

Further down in this same script, the following conditional:

    if [ -x /sbin/logsave ] && [ -e "${FSCK_LOGFILE}" ]; then
        logsave -s "${FSCK_LOGFILE}" >/dev/null \
            cat /run/initramfs/fsck.log
    else
        log_failure_msg "Cannot persist initramfs fsck.log"
    fi


What fails in that conditional is [ -e "${FSCK_LOGFILE}" ].
The same happens in /etc/init.d/checkfs.sh. In the line 16 you find
something similar:

FSCK_LOGFILE=/var/log/fsck/checkfs

That calls the function logsave_best_effort() in
/usr/lib/init/mount-functions.sh:

  logsave_best_effort() {
          if [ -x /sbin/logsave ] && [ -e "${FSCK_LOGFILE}" ]; then
                  logsave -s "${FSCK_LOGFILE}" "$@"
          else
                  log_failure_msg "Cannot persist the following output on disc"
                  "$@"
          fi
  }


Again, it fails this test in the conditional: [ -e "${FSCK_LOGFILE}" ].

If you remove that check from the conditionals in both scripts, the boot
error messages disappear and the logs are successfully written to
/var/log/fsck/check* files. Besides, I tried the following. First I
created a directory in the root partition:

# mkdir /fsck
# touch /fsck/{checkroot,checkfs}

Then I changed the variables in both scripts to point to those files:

FSCK_LOGFILE=/fsck/checkroot
FSCK_LOGFILE=/fsck/checkfs

I rebooted and it worked. No failure messages at boot and, once the
system booted, I checked those files and the logs were successfully
saved. I did the same test now creating that directory on /usr
(remember that I also put /usr in a separate partition).

# mkdir /usr/fsck
# touch /usr/fsck/{checkroot,checkfs}

This also worked.


Considering all said (and from my limited knowledge of the init process
in Linux,) I think the error lies in that these scripts try to check the
existence of /var/log/fsck/check* files on what initramfs previously
mounted in read-only mode. Since initramfs only mounts the rootfs and
/usr, when /var is in a separate partition it's out of reach.

So far I ignore how to solve the issue.


Greetings.


--
Walter