LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Reboot without properly unmounting after install (https://www.linuxquestions.org/questions/slackware-14/reboot-without-properly-unmounting-after-install-4175667454/)

Jeebizz 01-10-2020 01:39 PM

Reboot without properly unmounting after install
 
While playing with -Current, I noticed that after the install and when given the option to reboot, the system pretty much almost instantly reboots, which begs the question - does the newly formatted partitions even get properly unmounted? It seems not because when I boot into the new system, JFS runs fsck, and also the kernel complains that the vfat partition (EFI), is now dirty because it was not properly unmounted. So, has anyone else noticed this? Can anyone else duplicate this, and shouldn't the installer unmount the newly created partitions after the install? I thought at one point Slackware has already done this, but now I am not so sure. :scratch:

phantom_cyph 01-10-2020 01:54 PM

Are you doing this on a dual boot system?

Generally I see this error when I am using a dualboot system with Win10 and Win10 failed to "unmount" it's partitions correctly. This usually relates to either a forced shutdown of Windows or it's "fake shutdown" that it has enabled by default. Easiest solution here is to just not boot into Windows what-so-ever, so that's generally the route I take :)

In theory, any other OS which also had that partition mounted and failed to shut down correctly could cause such an issue as well.

BW-userx 01-10-2020 09:32 PM

windows. whenever I am in it, it just pick reboot, and not shutdown. this way it marks its drives read writeable still.

Jeebizz 01-11-2020 12:41 AM

This is not a dual boot, it is just a VM. I will also create another Slackware Current VM (Non EFI), just to see what happens, but I am fairly certain I am correct in that after the install and you say yes to reboot, it just restarts the system without any sort of delay which to me suggests the filesystem (whatever it may be, ext*, JFS, etc) are not properly unmounted - though thats my hypothesis, I plan to retry when I have more time to confirm this or debunk this; but again if anyone else wants to try that would be great, as another pair of eyes would be appreciated on this.

Jeebizz 01-11-2020 11:47 AM

2 Attachment(s)
Non EFI Slackware VM, but it does look like the installer does not properly unmount all filesystems, since JFS runs fsck:

hpfeil 01-11-2020 03:10 PM

I noticed the same behavior on two new slackware-current installs. When you log in as root after the first reboot, just
'umount /dev/sda1' (usually the EFI partition), 'fsck /dev/sda1', 'mount /dev/sda1'. Thereafter, it will umount cleanly with the rest of the mounts during reboot or shutdown. The problem is that the "dirty bit" doesn't get cleaned after setup installs efibootmgr on the EFI partition. No data corruption, safe to ignore. Initrd will fsck it next reboot.

Jeebizz 01-12-2020 01:11 PM

3 Attachment(s)
I haven't retried EFI, this time though using mostly ext4 (XFS for home still), and I am sure that this is proving my theory, it is still not unmounting all fileystems, particularly the / partition, I even tried umount -f prior to rebooting but it refuses (getting fs busy).

Back to EFI, sure you could boot into Windows to maybe repair the EFI partition, but I don't have Windows anymore (or just ignore the error if you don't have OCD), but I also tried fsck.vfat the EFI partition and just got a seek error. I am also having a sense of Déjà vu here as I feel I have made a post about this before, oh well. Still I am fairly confident in my findings; whether or not it warrants any response from BDFL though, who knows - it is just my observations.

ehartman 01-13-2020 01:33 AM

Quote:

Originally Posted by Jeebizz (Post 6077550)
it is still not unmounting all fileystems, particularly the / partition, I even tried umount -f prior to rebooting but it refuses (getting fs busy).

The / partition cannot be UNmounted (it is first mounted by the kernel itself, to get to the init process, not by any mount command) as shutdown itself is running FROM it.
On an installer that shouldn't matter as / is in a ram fs anyway and so after reboot will not be there anymore (the physical disks are NOT mounted on / then).
IN Slackware rc.6 does this:
Quote:

/bin/sync

echo "Remounting root filesystem read-only:"
/bin/mount -v -n -o remount,ro /
before halting or rebooting.

Jeebizz 01-13-2020 01:52 AM

Quote:

Originally Posted by ehartman (Post 6077745)
The / partition cannot be UNmounted (it is first mounted by the kernel itself, to get to the init process, not by any mount command) as shutdown itself is running FROM it.
On an installer that shouldn't matter as / is in a ram fs anyway and so after reboot will not be there anymore (the physical disks are NOT mounted on / then).
IN Slackware rc.6 does this:
before halting or rebooting.

That suggests that Slackware never unmounted a filesystem post install, and issued the reboot command which I am not so sure. Plus AFAIK other distros have from what I have seen properly unmounted filesystems prior to reboot after install.

Jeebizz 01-13-2020 11:20 AM

3 Attachment(s)
Under EFI, I tried syncing but still would not let me unmount although this time I was able to run fsck on the EFI partition and repair it. Still at this point I think I have proven that the installer does not unmount partitions post install prior to reboot - I take it there is no way to remedy this though? :scratch:

Didier Spaier 01-13-2020 03:37 PM

Quote:

Originally Posted by Jeebizz (Post 6077913)
Still at this point I think I have proven that the installer does not unmount partitions post install prior to reboot

No. All not yet unmounted filesystems but proc are unmounted by this command in /etc/inittab in the installer, executed just before rebooting or halting it:
Code:

::shutdown:/bin/umount -a -r >/dev/null 2>&1

volkerdi 01-13-2020 05:08 PM

Quote:

Originally Posted by Didier Spaier (Post 6078005)
No. All not yet unmounted filesystems but proc are unmounted by this command in /etc/inittab in the installer, executed just before rebooting or halting it:
Code:

::shutdown:/bin/umount -a -r >/dev/null 2>&1

Well... that's how it used to work, but the behavior of busybox's "reboot" changed at some point. The first symptom was that reboot simply quit working. It was replaced with a shell script that added the -f option, and that led to a fast reboot without unmounting (possibly without syncing).

The last installer rebuild fixed all this, and it should be working now. Jeebizz got a thanks in source/installer/ChangeLog.txt for it.

Thanks again! If there's still a problem, let me know.

Jeebizz 01-14-2020 01:01 AM

Quote:

Originally Posted by volkerdi (Post 6078035)
Well... that's how it used to work, but the behavior of busybox's "reboot" changed at some point. The first symptom was that reboot simply quit working. It was replaced with a shell script that added the -f option, and that led to a fast reboot without unmounting (possibly without syncing).

The last installer rebuild fixed all this, and it should be working now. Jeebizz got a thanks in source/installer/ChangeLog.txt for it.

Thanks again! If there's still a problem, let me know.

So it is ready to test? The installer source is updated but I don't see anything on the changelog itself (main changelog)

Also does it handle all conditions (that I can think of)
  • Selecting Yes to reboot on the Installer menu
  • Selecting No to reboot, being dropped in prompt and issuing reboot command
  • Selecting No to reboot, being dropped in prompt and issuing ctr+alt+del keystroke

Jeebizz 01-15-2020 03:02 AM

Resolved!
 
5 Attachment(s)
1st case, choosing yes to restart
Attachment 32294Attachment 32295
2nd case, issuing reboot command in prompt
Attachment 32296Attachment 32297
3rd case, ctrl+alt+delete
Attachment 32298

It looks like it is now resolved, thank you Pat for fixing this! :)

Didier Spaier 01-15-2020 04:37 AM

And here's the magic in build_installer.sh:
Code:

# Hack reboot to call reboot -f:
rm -f $PKG/$ARCH-installer-filesystem/sbin/reboot
( cd $PKG/$ARCH-installer-filesystem/bin ; ln -sf busybox reboot )
cat << EOF > $PKG/$ARCH-installer-filesystem/sbin/reboot
#!/bin/sh
echo "Sending all processes the SIGTERM signal."
/sbin/killall5 -15
/bin/sleep 2
echo "Sending all processes the SIGKILL signal."
/sbin/killall5 -9
/bin/sleep 2
echo "Syncing filesystems."
sync
echo "Unmounting filesystems:"
# Try to unmount these bind mounts first to prevent them from blocking unmount of the target /:
umount /mnt/dev 2> /dev/null
umount /mnt/proc 2> /dev/null
umount /mnt/sys 2> /dev/null
/bin/umount -v -a -t no,proc,sysfs,devtmpfs,fuse.gvfsd-fuse,tmpfs
sync
echo "Rebooting."
if [ -z "\$*" ]; then
  /bin/reboot -f
else
  /bin/reboot \$*
fi
EOF
chmod 755 $PKG/$ARCH-installer-filesystem/sbin/reboot

Thanks Pat and sorry for my misunderstanding.

PS
Quote:

Originally Posted by Jeebizz (Post 6078154)
So it is ready to test? The installer source is updated but I don't see anything on the changelog itself (main changelog)

This is mentioned in the installer's changelog:
Code:

Sun Jan 12 20:36:57 UTC 2020
  /sbin/reboot: Attempt to kill running processes and sync/umount/sync
  filesystems before rebooting. Thanks to Jeebizz.
+--------------------------+



All times are GMT -5. The time now is 12:14 AM.