bobafetthotmail / folder2ram

mount those folders to ram without losing access to their counterpart on disk!
GNU General Public License v3.0
116 stars 22 forks source link

Unit blk-availability.service not found #21

Open kumy opened 2 years ago

kumy commented 2 years ago

I was trying to install and configure this on a raspberry. But it fails when starting the shutdown service.

$ sudo folder2ram -enablesystemd

Created symlink /etc/systemd/system/basic.target.wants/folder2ram_startup.service → /usr/lib/systemd/system/folder2ram_startup.service.
Created symlink /etc/systemd/system/multi-user.target.wants/folder2ram_shutdown.service → /usr/lib/systemd/system/folder2ram_shutdown.service.
systemd services enabled but not started, it is recommended to reboot for a cleaner transition to tmpfs folders
otherwise you can start them now (both services are needed) with 
systemctl start folder2ram_startup.service
systemctl start folder2ram_shutdown.service

$ sudo systemctl start folder2ram_startup.service

$ sudo systemctl start folder2ram_shutdown.service
Failed to start folder2ram_shutdown.service: Unit blk-availability.service not found.

I'm running Raspbian GNU/Linux 10

kumy commented 2 years ago

Debian package lvm2 provides this system unit;

Solved by sudo apt install lvm2

bobafetthotmail commented 2 years ago

folder2ram does not really need that service, it's in the systemd unit because it's supposed to start after it, if it exists. I'll have to check if there is a way to make it required only if existing

ne20002 commented 2 years ago

I have the same problem using folder2ram on a small VPS (it reduces load). I don't think that installing lvm2 on a VPS is a good idea.

The installation of folder2ram_startup works even without blk-availability. But the start of the folder2ram_shutdown fails with unresolved dependency.

bobafetthotmail commented 2 years ago

The folder2ram_shutdown.service is responsible of writing the data back on disk when the system shuts down or reboots, you need to have that active and OK.

if you don't want to install lvm2, you need to edit (as root/sudo) /usr/lib/systemd/system/folder2ram_shutdown.service to remove the following lines After=blk-availability.service BindsTo=blk-availability.service

then run (as root/sudo) systemctl daemon-reload to make systemd notice the changed file then run (as root/sudo) systemctl start folder2ram_shutdown.service to start the service again and should not give errors now.

I'm sorry about this limitation, the main users of this script are on OpenMediaVault (and I use OpenSUSE) where lvm2 is installed by default. I will probably have to implement logic to detect if blk-availability.service service is available on install time so it can write the right systemd service file.