Raspberry pi3 wants to power down easily.
We introduced unionfs-fuse.
The installation and configuration have been completed with reference to several sites.
Once shut down, it won't start.
When I checked the contents of the SD card, all the files were empty.
Implemented as follows:
You have previously configured swap, log, etc. to move to RAM disk.
Package Deployment
$sudo apt-get install unionfs-fuse
Copy Configuration Files
$sudocp/usr/share/doc/unionfs-fuse/examples/S01a-unionfs-fuse-live-cd.sh/etc/init.d/a-unionfs-fuse-live-cd
$ sudo cp/usr/share/doc/unionfs-fuse/examples/rc.local.omit-pid.sh/usr/local/sbin/a-unionfs-fuse-omit-pid.sh
Edit /etc/init.d/a-unionfs-fuse-live-cd
#!/bin/sh
### BEGIN INIT INFO
# Provides —a-unionfs-fuse-live-cd
# Required-Start: mountall-bootclean
# Required-Stop:
# Default-Start: S
# Default-Stop:
# X-Start-Before:procpsudev-mtab urandom
# Short-Description:UnionFS mode
# Description—Shutdown process will not be required
### END INIT INFO
# Copyright: Bernd Schubert <[email protected] >
# BSD license, see LICENSE file for details
FUSE_OPT="-o allow_other, use_ino, suid, dev, noneempty"
CHROOT_PATH="/tmp/unionfs"
UNION_OPT="-ocow, chroot=$CHROOT_PATH, max_files=32768"
UBIN=/usr/bin/unionfs-fuse
cd/boot
file=noprotect
if [-e${file}]; then
echo "${file} exists"
exit0
fi
mount-oremount, ro/dev/mmcblk0p1/boot
mount-t proc proc / proc
mount-tmpfs tmpfs /tmp
mkdir-p$CHROOT_PATH/root
mkdir-p$CHROOT_PATH/rw
mkdir-p/tmp/union
mount -- bind/$CHROOT_PATH/root
$UBIN$FUSE_OPT$UNION_OPT/rw=RW:/root=RO/tmp/union
mount-t proc proc proc / tmp / union / proc
cd/tmp/union
mkdir oldroot
pivot_root.oldroot
mount-o remote, ro/dev/root/oldroot
for in dev run run / lock sys run / shm dev / pts boot
do
mount -- bind/oldroot/$d/$d
done
init q
/usr/local/sbin/a-unionfs-fuse-omit-pid.sh
exit0
Register Script
$sudo update-rc.da-unionfs-fuse-live-cd defaults
Scripting for Switching
$sudo vim/usr/local/bin/noprotect
#!/bin/sh
mount-or-ow, remove/boot
cd/boot
if [-e "protect"; then
rm/boot/protect
fi
if [-e "noprotect"; then
echo "noprotect mode"
else
touch/boot/noprotect
echo "noprotect mode"
fi
mount-oro,remount/boot
$sudovim/usr/local/bin/protect
#!/bin/sh
mount-or-ow, remove/boot
cd/boot
if [-e "noprotect"; then
rm/boot/noprotect
fi
if [-e "protect"; then
echo "protect mode"
else
touch/boot/protect
echo "protect mode"
fi
mount-oro,remount/boot
$sudovim/usr/local/bin/noprotect
#!/bin/sh
mount-or-ow, remove/boot
cd/boot
if [-e "protect"; then
rm/boot/protect
fi
if [-e "noprotect"; then
echo "noprotect mode"
else
touch/boot/noprotect
echo "noprotect mode"
fi
mount-oro,remount/boot
$sudovim/usr/local/bin/protect
#!/bin/sh
mount-or-ow, remove/boot
cd/boot
if [-e "noprotect"; then
rm/boot/noprotect
fi
if [-e "protect"; then
echo "protect mode"
else
touch/boot/protect
echo "protect mode"
fi
mount-oro,remount/boot
Grant execution permission
$sudo chmod a+x/usr/local/bin/noprotect
$ sudo chmod a+x/usr/local/bin/protect
US>Reboot
Unionfs-fuse takes longer to boot than before, but
Boot successfully.
If you shut down or power down, and then look inside the SD card, all the files are gone.
If you know the solution, please take care of it.
raspberry-pi
I encountered the same symptom.
In conclusion, there is a difference between the latest rasbian image as of March 4, 2017 and the information on the unionfs deployment site, so I think unionfs cannot be deployed as it is.
I also looked for a solution, but when the time ran out, I took care of ROMing by rebuilding the kernel with aufs.
Here are the details:
The part I looked up.
That's all.
I became interested in the questioner's question, so
I tried installing it on archlinuxarm instead of raspbian
Install unionfs-fuse first, and
pacman-Sunionfs-fuse
Create two configuration files,
/usr/lib/initcpio/install/unionfs:
#!/bin/bash
build(){
add_binary"/usr/bin/unionfs"
add_binary"/usr/bin/unionfsctl"
add_module "fuse"
add_runscript
}
help(){
cat<<HELPEOF
This hook uses unionfs.
HELPEOF
}
# vim: set ft=shts=4sw=4et:
/usr/lib/initcpio/hooks/unionfs:
#!/usr/bin/ash
unionfs_mount_handler(){
cd/tmp
mkdir-punionfs/root
mount-oro $root unionfs/root
mkdir-p/boot
mount -- fstab unionfs/root/etc/fstab-oro/boot
noprotect = 0
[-e/boot/noprotect] & noprotect = 1
umount/boot
umount unionfs/root
rmdir-punionfs/root
cd/
if [$noprotect=1]; then
default_mount_handler $1
return
fi
cd/tmp
mkdir-punionfs/root
mkdir-punionfs/rw
mount-oro $root unionfs/root
mount-tmpfs none unionfs/rw
unionfs-o allow_other, use_ino, suid, dev, noneempty-ocow, chroot=/tmp/unionfs/rw=RW:/root=RO$1
}
run_hook(){
mount_handler = unionfs_mount_handler
}
Configure /etc/mkinitcpio.conf to load the above and
HOOKS="baseudev autodetect modconf block filesystems keyboard fsck unionfs"
Initramfs image has been created.
mkinitcpio-p linux-raspberrypi
It seems to be moving in general.No matter how many times I reboot, there is no problem.
However, in Denbndb's answer, there was an error in pivot_root, but
US>archlinuxarm uses the command switch_root instead and
Maybe this difference is why I'm doing well in my environment.
When it didn't work well, we did the following research.It's a prerequisite that shell works.
exit
.Init may die and panic, but that's an experience.echo*
instead.mount-t proc proc proc /proc
.cd/proc/PID/cwd
allows you to navigate to the unionfs-fuse current directory.In the first place, raspbian and archlinuxarm seem to be very different, so
I wrote it as an answer in order to be helpful to some extent.
© 2024 OneMinuteCode. All rights reserved.