File cleanup force exits the script
Describe the software environment:
- OS & version > OS: 8.0.43-0ubuntu0.24.04.2 (Ubuntu)
- Include platform i.e. physical, virtual, cloud image etc > Hyperv gen2 virtual machine on Windows Server 2022
- List other applications present > just the necesary to make the next ponit work
- List other services or tasks the system also currently provides > wireguard, pihole and cloudflared
- Details any other relevant background context about your OS, its location, method of management or access, firewall settings etc. > No gui, ssh from both termius and windows cmd
- Context > I just do this as a hobby, so no real technical understanding, plase have that in mind, also English is not my main language
When the script deleted the installation files no longer needed at the end of both, “1-setup.sh” and “2-install-guacamole.sh”, for some reason it would say it failed, even though it succeeded in deleting all the trash files and would just cancel the rest of the process. Because of that, I decided to inspect the script and did the following: 1 Ran the download command for “1-setup.sh” (wget https://raw.githubusercontent.com/itiligent/Guacamole-Install/main/1-setup.sh && chmod +x 1-setup.sh && ./1-setup.sh) 2 Cancelled the script when prompted for sudo password 3 Edited “1-setup.sh” and “2-install-guacamole.sh” as follows:
(1-setup.sh)
(2-install-guacamole.sh)
And worked flawlessly… almost The only remaining problem is that it didn’t actually do the /guacamole redirect, but I was able to restrict access to the apache error page by adding a path with cloudflared (so if it gives you the same error with the nginx scripts, I haven’t figured out how to fix that)
Another problem is, after it failed for the first time, it didn’t allow me to run the script again because it had already created the mysql database and user, so in case someone finds this trying to solve the same the same problem, here is how to fix it:
Delete the mysql user and db Confirm the names first
SHOW DATABASES; SELECT user FROM mysql.user;
Delete them (modify if needed)
mysql -u root -p
(enter password)
DROP DATABASE guacamole_db; DROP USER 'guacamole_user'@'localhost';
Verify they are gone
SHOW DATABASES; SELECT user FROM mysql.user;
(exit mysql)
exit
Now let’s delete the installed files
cd /etc
Confirm the name of the directory
ls
By default, the script makes it just “guacamole”, so delete it
sudo rm -rf /guacamole
(enter password) Confirm it is gone
ls
Go back to your home directory
cd
Run the script and follow it to the end
./ 1-setup.sh
Oh, and make sure you run the installation command on the root of your home directory, as the script expects it to be there at the very end to delete it, or it will tell you it failed even though it didn’t.
Hope it helps someone while it gets a fix
Just closing out this this issue after a seond look... It looks like you ran the script from the /etc directory?, (and not a local home dir of place where you have full rights.) With so many potential linux flavours, the script assumes running from a directory you must have full permissions to. $home fits that requirement, but others are also possible. Be aware that using cunnent dir ($pwd) can still break things depending on your current context when running the 1-setup.sh script, as you discovered. If your linux install deviates from standard permissions on $home, or does not include a path for home, you will encounter issues. Its hard to cover every possibilty.