From d82b12868d7970b713b849748c004606409f8770 Mon Sep 17 00:00:00 2001 From: Dhanya122 Date: Mon, 23 Jun 2025 13:34:26 +0530 Subject: [PATCH 1/3] Optimise and Clean up --- idv-services/README.md | 45 ++++++++++++++++++++++------ idv-services/copy_files.sh | 3 -- idv-services/intel-idv-services.spec | 4 --- idv-services/rpm-packaging-guide.md | 4 +-- 4 files changed, 38 insertions(+), 18 deletions(-) diff --git a/idv-services/README.md b/idv-services/README.md index 0553c24..9936e28 100644 --- a/idv-services/README.md +++ b/idv-services/README.md @@ -3,14 +3,16 @@ This file contains steps to launch virtual machines using a system service. ## Table of Contents -- [Virtual machine configuration file](#virtual-machine-configuration-file) -- [Modify VM configuration](#modify-vm-configuration) -- [Run IDV services via an RPM package](#run-idv-services-via-an-rpm-package) -- [Manual steps to run IDV service](#manual-steps-to-run-idv-service) - - [Run script to copy necessary files to `/opt` directory](#step-1-run-script-to-copy-necessary-files-to-opt-directory) +1. [Virtual machine configuration file](#virtual-machine-configuration-file) +2. [Modify VM configuration](#modify-vm-configuration) +3. [Run IDV services via an RPM package](#run-idv-services-via-an-rpm-package) +4. [Manual steps to run IDV service](#manual-steps-to-run-idv-service) + - [Run script to copy necessary files to `/usr/bin` directory](#step-1-run-script-to-copy-necessary-files-to-usrbin-directory) - [Enable and start `idv-init` service](#step-2-enable-and-start-idv-init-service) - [Enable and start `idv-launcher` service](#step-3-enable-and-start-idv-launcher-service) -- [Troubleshooting](#troubleshooting) +5. [Enable auto-login for the `guest` user](#enable-auto-login-for-the-guest-user) +6. [Post-Reboot Instructions](#post-reboot-instructions) +7. [Troubleshooting](#troubleshooting) ## Virtual machine configuration file @@ -44,12 +46,11 @@ This file contains steps to launch virtual machines using a system service. - If you prefer not to use the RPM package, follow these steps: - ## Step 1: Run script to copy necessary files to `/opt` directory + ## Step 1: Run script to copy necessary files to `/usr/bin` directory - - Navigate to the `idv` directory and run the `copy_files.sh` file with superuser privileges using the following command + - Run the `copy_files.sh` file with superuser privileges using the following command ```bash - cd idv sudo chmod +x copy_files.sh sudo ./copy_files.sh ``` @@ -101,6 +102,32 @@ This file contains steps to launch virtual machines using a system service. ``` **Note**: Once the idv-launcher service starts, all the VMs should be launched in respective monitors. +## Enable auto-login for the `guest` user + +- To, enable auto-login for the `guest` user, place the [autologin.conf](autologin.conf) file in the `/etc/systemd/system/getty@tty1.service.d` directory. Run the following command from the `idv-services/` directory - + + ```bash + # Create `getty@tty1.service.d` if it doesn't exists + sudo mkdir /etc/systemd/system/getty@tty1.service.d + sudo cp autologin.conf /etc/systemd/system/getty@tty1.service.d/ + ``` + + **Note**: When autologin is enabled for the `guest` user, they will be automatically logged in after each reboot. + +## Post-Reboot Instructions + +- If the machine is rebooted, navigate to the `idv-services/` directory and run the following command to reset permissions: + + ```bash + sudo ./setup_permissions.sh + ``` + - Once this script is executed, the IDV services (idv-int.service and idv-launcher.service) should start automatically. Verify their status using: + + ```bash + systemctl --user status idv-int.service + systemctl --user status idv-launcher.service + ``` + ## Troubleshooting - If the `idv-init` service fails to start, check the service logs using the following command: diff --git a/idv-services/copy_files.sh b/idv-services/copy_files.sh index dbe073a..f7ab49f 100755 --- a/idv-services/copy_files.sh +++ b/idv-services/copy_files.sh @@ -14,9 +14,6 @@ username=$(getent passwd 1000 | cut -d: -f1) # create/copy launcher files sudo cp -r launcher /usr/bin/idv/ -sudo touch /usr/bin/idv/launcher/start_all_vms.log -sudo chmod +x /usr/bin/idv/launcher/start_all_vms.log -sudo chown $username:$username /usr/bin/idv/launcher/start_all_vms.log # create/copy init files sudo cp -r init /usr/bin/idv/ diff --git a/idv-services/intel-idv-services.spec b/idv-services/intel-idv-services.spec index 63c7cf0..2cc71de 100644 --- a/idv-services/intel-idv-services.spec +++ b/idv-services/intel-idv-services.spec @@ -38,10 +38,6 @@ install -m 644 idv-launcher.service %{buildroot}%{_userunitdir}/idv-launcher.ser mkdir -p %{buildroot}%{_sysconfdir}/systemd/system/getty@tty1.service.d install -m 644 autologin.conf %{buildroot}%{_sysconfdir}/systemd/system/getty@tty1.service.d/autologin.conf -# Default presets for user -mkdir -p %{buildroot}%{_prefix}/lib/systemd/user-preset -install -m 644 %{SOURCE1} -t %{buildroot}%{_prefix}/lib/systemd/user-preset/ - %files /usr/bin/idv/* /usr/lib/systemd/user/idv-*.service diff --git a/idv-services/rpm-packaging-guide.md b/idv-services/rpm-packaging-guide.md index 610e848..0cc6c37 100644 --- a/idv-services/rpm-packaging-guide.md +++ b/idv-services/rpm-packaging-guide.md @@ -143,7 +143,7 @@ sudo ./setup_permissions.sh ### Post-Reboot Instructions -- If the machine is rebooted, navigate to the `idv/` directory and run the following command to reset permissions: +- If the machine is rebooted, navigate to the `idv-services/` directory and run the following command to reset permissions: ```bash sudo ./setup_permissions.sh @@ -173,6 +173,6 @@ sudo ./setup_permissions.sh You can also check the journalctl logs for errors using the command: ```bash - sudo cat journalctl -t idv-services + sudo journalctl -t idv-services ``` Ensure that the `vm.conf` file is correctly configured and all required files (e.g., firmware and qcow2 files) are present and the file paths are valid. From 4f01a59b6c76f388f790bd33a8bd1162ecabb241 Mon Sep 17 00:00:00 2001 From: Dhanya122 Date: Mon, 23 Jun 2025 13:39:11 +0530 Subject: [PATCH 2/3] Change cooment --- idv-services/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/idv-services/README.md b/idv-services/README.md index 9936e28..31ec56c 100644 --- a/idv-services/README.md +++ b/idv-services/README.md @@ -107,7 +107,7 @@ This file contains steps to launch virtual machines using a system service. - To, enable auto-login for the `guest` user, place the [autologin.conf](autologin.conf) file in the `/etc/systemd/system/getty@tty1.service.d` directory. Run the following command from the `idv-services/` directory - ```bash - # Create `getty@tty1.service.d` if it doesn't exists + # Create `getty@tty1.service.d` if it doesn't exist sudo mkdir /etc/systemd/system/getty@tty1.service.d sudo cp autologin.conf /etc/systemd/system/getty@tty1.service.d/ ``` From 9897537695e670bec3ac4a88f105fcac0afb3178 Mon Sep 17 00:00:00 2001 From: Dhanya122 Date: Mon, 23 Jun 2025 17:34:31 +0530 Subject: [PATCH 3/3] add delay of 3 secs before enumerating VFs to avoid issues --- idv-services/etc/systemd/user/idv-init.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/idv-services/etc/systemd/user/idv-init.service b/idv-services/etc/systemd/user/idv-init.service index 0cf7767..dfd8b34 100644 --- a/idv-services/etc/systemd/user/idv-init.service +++ b/idv-services/etc/systemd/user/idv-init.service @@ -7,7 +7,7 @@ Type=simple Environment=DISPLAY=:0 ExecStartPre=-/bin/bash -c 'cd /usr/bin/idv/init && /usr/bin/sudo ./setup_display.sh' ExecStart=/usr/bin/sudo /usr/bin/X -ExecStartPost=/bin/bash -c 'cd /usr/bin/idv/init && /usr/bin/sudo ./setup_sriov_vfs.sh' +ExecStartPost=/bin/bash -c 'sleep 3 && cd /usr/bin/idv/init && /usr/bin/sudo ./setup_sriov_vfs.sh' ExecStartPost=/usr/bin/xhost + ExecStartPost=/bin/bash -c 'openbox &' Restart=on-failure