bobafetthotmail / folder2ram

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

systemd service not starting #20

Closed cuthulino closed 2 years ago

cuthulino commented 2 years ago

I try to use folder2ram on a fresh install of Proxmox VE (Debian).

I can manually start with systemctl start folder2ram_startup.service and everything is fine. But it is not starting automatically after a reboot.

It is enabled and is shown on systemctl list-dependencies but the circle is grey. The circle of the shutdown.service ist green and it gets executed on shutdown (entries in syslog).

Any Idea why it is not starting?

bobafetthotmail commented 2 years ago

what does it say if you write systemctl status folder2ram_startup.service just after a reboot (without starting it manually)

cuthulino commented 2 years ago

Output:

folder2ram_startup.service - folder2ram systemd service
  Loaded: loaded (/lib/systemd/system/folder2ram_startup.service; disabled; vendor preset: enabled)  
  Active: inactive (dead)

Edit: It's not like i tried yestertad aprox. 3 hours... I just enabled the service again manually because I wondered about the disable state in the output. Rebooted... and its running. I am really sorry, dont know what happened yesterday.

I will -safe-disablesystemd and try everything again.

bobafetthotmail commented 2 years ago

strange, it looks disabled, and is therefore is not run automatically.

when you write folder2ram -enablesystemd

it's supposed to install the service AND enable it.

https://github.com/bobafetthotmail/folder2ram/blob/master/debian_package/sbin/folder2ram#L1039

can you write

folder2ram -enablesystemd

again and see if it's enabled?

if it does not work, write

systemctl enable folder2ram_startup.service

and see if it prints some errors about why it can't enable it

cuthulino commented 2 years ago

I just tryed everything... i don't get it... folder2ram -enablesystemd changed nothing.

systemctl enable folder2ram_startup.service Did not throw any error.

systemctl start folder2ram_startup.service works without any errors

Only thing i found ist this in dmesg:

[    6.188970] systemd[1]: basic.target: Found ordering cycle on folder2ram_startup.service/start
[    6.188974] systemd[1]: basic.target: Found dependency on blk-availability.service/start
[    6.188975] systemd[1]: basic.target: Found dependency on rbdmap.service/start
[    6.188976] systemd[1]: basic.target: Found dependency on basic.target/start
[    6.188978] systemd[1]: basic.target: Job folder2ram_startup.service/start deleted to break ordering cycle starting with basic.target/start
bobafetthotmail commented 2 years ago

hm, that's interesting.

systemd has found a circular dependency in those system services. To "solve" it decides to delete the last added service (folder2ram)

I have tested this on a proxmox VM (inside a proxmox host) and should work:

edit /lib/systemd/system/folder2ram_startup.service to become

[Unit]
Description=folder2ram systemd service
After=local-fs.target
After=blk-availability.service
DefaultDependencies=no
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/sbin/folder2ram -mountall
[Install]
WantedBy=basic.target

(i.e. delete the "Before=basic.target" line)

then run systemctl daemon-reload and then you can reboot

If you confirm that this fixes the problem, I'm changing this in the folder2ram script too.

cuthulino commented 2 years ago

Many thanks for your work.

Service now starting like it should.