Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iVentoy Autostart #4

Open
MelonicOverlord opened this issue Jul 9, 2023 · 10 comments
Open

iVentoy Autostart #4

MelonicOverlord opened this issue Jul 9, 2023 · 10 comments

Comments

@MelonicOverlord
Copy link

As far as I can tell, there is no realistic way of launching iVentoy at boot as of right now. In my case, and likely in many other people's case, my server goes down overnight to save energy, and when it comes up in the morning I have no way of starting iVentoy other than to SSH in, and then go to the webpanel to start the DHCP. It would be cool to see the integration of a SystemD and OpenRC script which can automatically start the iVentoy service and DHCP server. This would also make it handy if any servers go offline at any point, and when they come back online the PXE services do not have to be started again manually.

Not really an issue, more of a suggesdtion but still.

@ventoy
Copy link
Owner

ventoy commented Jul 9, 2023

You can integrate the following cmd in any autostart script.

bash iventoy.sh -R start

with -R option, it will auto start the service with last saved parameters.

Or you can send command by curl to emulate the web behavior, you can refer:
https://forums.ventoy.net/showthread.php?tid=2496

@MelonicOverlord
Copy link
Author

Ah, thanks - I did not see that anywhere on the website's documentation. Am I also purely limited to 20 devices or is there a way of resetting that/having them overwrite each other?

@Starbase12
Copy link

Saved my day. I was able to configure automatic boot within linux:

  • Be root

  • Make sure "/opt/iventoy" points to the extracted folder. In my case "iventoy" is a symbolic link to "/opt/iventoy-1.0.19/"

  • Create a file: vi /root/iventoy-helper.sh (don't forget to make it executable before trying to execute it!)
    #!/bin/bash cd /opt/iventoy sh ./iventoy.sh -R start

  • Create the cronjob: crontab -e
    @reboot sleep 10 && sh /root/iventoy-helper.sh

@104ru
Copy link

104ru commented Feb 17, 2024

Nothing prevents you from writhing a systemd service unit for iventoy yourself. Here is what I came up with:

# /etc/systemd/system/iventoy.service
[Unit]
Description=iVentoy PXE Booter
Documentation=https://www.iventoy.com
Wants=network-online.target

[Service]
Type=forking
Environment=IVENTOY_API_ALL=1
Environment=IVENTOY_AUTO_RUN=1
Environment=LIBRARY_PATH=/path/to/iventoy/lib/lin64
Environment=LD_LIBRARY_PATH=/path/to/iventoy/lib/lin64
ExecStart=/path/to/iventoy/lib/iventoy
WorkingDirectory=/path/to/iventoy
Restart=on-failure

[Install]
WantedBy=multi-user.target

Of course, replace /path/to/iventoy with a real location of iventoy directory on your system.

@jeffshead
Copy link

jeffshead commented Mar 3, 2024

Nothing prevents you from writhing a systemd service unit for iventoy yourself. Here is what I came up with:
...
Of course, replace /path/to/iventoy with a real location of iventoy directory on your system.

Using your code for running as a service on AlmaLinux doesn't fully work for me. It starts and I'm able to access the webpage but the IP address is not detected.

2024-03-02_23-27-31

Is there a fix for this?

@104ru
Copy link

104ru commented Mar 3, 2024

Evidently the error you are getting has nothing to do with the systemd unit since the service has started and running. Otherwise you won't see a web interface. The machine you are running iventoy on must have a wired connection to the network. iVentoy believes that your machine does not.

@jeffshead
Copy link

jeffshead commented Mar 3, 2024

@104ru - It's wired. I do not have this issue when I disable the service and start iVentoy with the script ./iventoy.sh -R start

Only happens when I try to run iVentoy as a service, using the code that you provided. Wonder why it works for your system but not mine? My system is an AlmaLinux 9.3 VM. Maybe Wants=network-online.target is not sufficient for AlmaLinux???

@jeffshead
Copy link

So far, changing from Wants=network-online.target to After=network-online.target seems to have fixed the issue with the service.

@MelonicOverlord
Copy link
Author

MelonicOverlord commented Apr 2, 2024

Hi,

Just an update - have added this startup service on my server and it is doing the same as jeff's system and not detecting the NIC anymore, but strangely only after a fresh reboot/start of the server. It worked just fine initially starting the script after adding it.

I'm running OpenMediaVault (basically just Debian underneath) since it is easier for management of the drives on my NAS.

Changing Wants to After has fixed the issue for me as well.

I also have an issue where dnsmasq is occupying the DHCP port before iVentoy can get to it, meaning the actual service doesn't start automatically still. But this must be a configuration issue somewhere else my end. Dnsmasq was pulled in by I believe qemu and even though I have removed it, somehow it is still finding a way to start. Maybe I just need to properly reinstall dnsmasq and change the port it's using.

@MelonicOverlord
Copy link
Author

The dnsmasq issue appears to be libvirt using its own built-in version of dnsmasq to supply the virtual networks. Since I rarely use the VM on this server, the virtual network can just be set to not load on boot and need to be manually activated.

Can now confirm that everything is starting on system boot - but it is no longer recognising the interface again. If I manually reload the service it does get the IP Configuration. Strange

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants