Friday, January 17, 2025

flash drive errors

Tried many different ways to try and fix a 500 GB flash drive's errors, finally gave up as probably hardware fault. Details below.

Trying robocopy to copy large files, when a simple copy command fails - From
to
to


Accidentally set this drive to offline in windows disk management - using the diskpart method did not work. The object is not found. No solutions for me from this link. Finally got it online again from the settings app, Right-click on the Start button and select Settings >
Navigate to System > Storage > Advanced storage settings > Disk & volumes >
 Properties button of a disk (except the system disk or Windows disk) > Status section >
Online/Offline button


chkdsk f: /f /r /x

Free space verification is complete.
 Phase duration (Free space recovery): 10.42 minutes.
An unspecified error occurred (6e74667363686b2e 164d).

Again, formatting fails.

badblocks (on Linux) - recommends using badblocks via e2fsck, but e2fsck does not support ntfs. (on rpi).
So, plan is to repartition into 5 100 GB partitions, and try format f: etc on Windows. Partitioned OK, but formatting the partitions fails. So, gave up as hardware fault.



robots.txt syntax to exclude specific bots

 https://stackoverflow.com/questions/56049660/how-to-exclude-all-robots-except-googlebot-and-bingbot-with-both-robots-txt-and

So for allowing googlebot and bingbot and nothing else, the syntax would be:

User-agent: *
Disallow: /

User-agent: Bingbot
Disallow:

User-agent: Googlebot
Disallow:

Thursday, January 16, 2025

CMS - Unable to open assets

Our CMS, which runs google apps scripts in an iframe, was not loading documents, known as "assets" - I thought maybe that the google apps script is not running? Or seems to be returning a blank page?

But the next day, it was fine. (In fact, when I tested the previous day, I had logged in to multiple accounts, which is probably why it didn't work. We need to be logged in to only one google account for the google apps script to work correctly. So, opened in a private window today, and it works.)

Sunday, January 12, 2025

preventing Moodle time-outs

 Copy-pasting from an email I sent out:

 ...  doing bulk actions on the Moodle instances can cause timeout failures if the action takes more than a minute or so to complete. So, actions should be done in small batches. For example,

1. Deleting users - first start with deleting one user, see how long it takes, and then scale to as many as possible to complete in one minute. A detailed post about automating this process is at 

https://hnsws.blogspot.com/2024/10/moving-multiple-moodle-instances-from.html#deleting-users

2. Deleting courses - you may need to delete module by module, checking how long each process takes, as above. 

3. Running ad-hoc queries - please filter for small result sets and optimize code so that the query completes within a minute or two.

Similarly, when designing the course pages, please use themes / modules / etc in such a way that only a limited number of images and or other content loads on a single page - otherwise, the site will be experienced as slow to load, slow to edit, etc. A rule of thumb would be to limit the scrolling to two screen heights, and not more than that.

In general, if you experience timeout errors (which usually will be displayed as "gateway error" if using cloudflare), you can simply close and re-open your browser after a couple of minutes, login again, and the site should load.


manually editing kodi playlists

Following up on the use of Kodi for theatre playouts - the previous posts below,
Work Stuff: optimizing kodi for planetarium projection


the playlists are located on the SDCARD and not on the USB drive containing the video files - 
Path to the video playlists is
STORAGE > .kodi/userdata/playlists/video

The editing has to be done as root, as no access otherwise.

Can't use UI, since gksudo is removed,
and other methods also don't work,

The entries in the m3u files are of the form
#EXTINF:0,3002Fade-out Lights.avi
/var/media/NTFS500GB/CommonFiles/3002Fade-out Lights.avi
so we need to remember to edit the filename on two lines.

Saturday, January 11, 2025

Zoom out to the edge of the observable universe

A fulldome video made with OpenSpace - details as in my previous post.

The OpenSpace recordings are shared at 
openspace-scripts/user/recordings/ToEdgeofU

The 4K (4096x4096) full resolution videos are available from archive.org -  
Zoom out to the edge of the observable Universe



format_onetopic plugin backwards compatibility

 Copy-pasting from an email, regarding the onetopic plugin's version for Moodle 4.5 and compatibility with older (3.x?) versions - 

I'm updating the format_onetopic plugin on all our Moodle instances. When doing that, it notified me of a new setting, backward compatibility with old styles, which it says will be removed soon.

 Currently I have enabled it, but if possible, please check the courses which use format_onetopic to see if they can be migrated to use the format_onetopic new style editor. The setting for format_onetopic is at

/admin/settings.php?section=formatsettingonetopic

 - the 2nd option, 

"Use legacy style controls. This option is only available for compatibility with older versions of the plugin and will be removed in the future in favor of using only the new style editor." 

Most probably, the way to do this would be:

1. check if the course is displayed correctly

2. go to admin/settings.php?section=formatsettingonetopic and uncheck the "Use legacy style controls"

3. check again if the course is displayed correctly

4. make some edit to the course, check again if the course is displayed correctly

5. If displayed OK, then you can revert the edit, and leave the check box unchecked.

6. If not displayed OK, please let me know.

If you find that unchecking this box does not create any problems for some course which uses format_onetopic, please uncheck the box for all the instances.

Site Administration > Plugins > Plugins Overview > Onetopic_format Settings

Friday, January 10, 2025

plugin updates not prompted by Moodle

Noting the conversation with the developer of the format_onetopic Moodle plugin, https://github.com/davidherney/moodle-format_onetopic/issues/204

Today I've been notified of a new plugin update by Moodle, so changing the Maturity level (by the developer, from Beta to Mature) seems to have fixed the "not being notified by Moodle about new updates" issue.

free up disk space on Github runner

While building OpenSpace on a github action, the github runner was running out of disk space. Fortunately, there is an action to clear up disk space - 
    - name: Free Disk Space (Ubuntu)
      uses: jlumbroso/free-disk-space@main
      with:
        # this might remove tools that are actually needed,
        # if set to "true" but frees about 6 GB
        tool-cache: false
        
        # all of these default to true, but feel free to set to
        # "false" if necessary for your workflow
        android: true
        dotnet: true
        haskell: true
        large-packages: false
        docker-images: true
        swap-storage: false

Here, true means remove. Since we need some of the large packages and we do need the swap space, I set those to false, and that solved the problem.

Thursday, January 09, 2025

trying out ai video generation

 Inspired by

SSSHSS || Karunyamatanvate || Drama Trailer 2025 ||

Tried out via

ai generated video for free duckduckgo search

imagine.art

(not very good)


Same prompt, "big bang which started the universe evolving into millions of galaxies", gave a 4 minute + documentary with commentary but watermarked, using invideo.io

https://ai.invideo.io/watch/sCKIn5VJQDE

Uploaded to youtube and embedded below. Though what I wanted was a visualization of the Big Bang and this is not what I wanted, as a mediocre youtube video, this is OK.



Tuesday, January 07, 2025

errors in apache logs

Copy-pasting from an email - 

While checking the error log on the server for clues on the 'password reset' causing server errors, I found that there were thousands of errors being logged by various plugins and pages on the various Moodle installations.

Apparently there are some outdated plugins on the Moodle installation which did not get upgraded automatically. One example seems to be the onetopic format plugin. Manually updating it seems to have worked. But there are some more. One example is the "Edwiser Reports" plugin, which does not seem to be available any more, no Moodle 4.5 support available as far as I can see, and not updated since 2022.

Deleted this plugin from all our instances, to get rid of errors like this:

[Sat Jan 04 09:37:35.671230 2025] [php:notice] [pid 1416984] [client 11.22.33.34:26126] Debugging: Invalid $required parameter value: '' .\n                It must be either VALUE_DEFAULT, VALUE_REQUIRED, or VALUE_OPTIONAL in \n* line 53 of /lib/external/classes/external_description.php: call to debugging()\n* line 47 of /lib/external/classes/external_value.php: call to core_external\\external_description->__construct()\n* line 47 of /local/edwiserreports/classes/external/get_plugin_config.php: call to core_external\\external_value->__construct()\n* line ? of unknownfile: call to local_edwiserreports\\external\\api::get_plugin_config_parameters()\n* line 110 of /lib/external/classes/external_api.php: call to call_user_func()\n* line 186 of /lib/external/classes/external_api.php: call to core_external\\external_api::external_function_info()\n* line 83 of /lib/ajax/service.php: call to core_external\\external_api::call_external_function()\n, referer: https://oneofourservers.org/mod/hvp/view.php?id=20118

Monday, January 06, 2025

updating copyright year in Moodle footer

Wanted to check if we can use php to automatically change the copyright year in Moodle footer, using the Moove theme. For example,

https://natclark.com/tutorials/php-automatic-copyright-notice/

<?php echo date('Y'); ?>

But no, when we add this to the footer via the Moove theme's UI, the footer displays the code instead of allowing php to parse it. So, updated manually.

pillars of creation, Hubble or Webb deep field, 3d model

 Thought about doing a render of the "pillars of creation" in Blender or something like that, using some 3d model available online.

https://hubblesite.org/contents/media/videos/2024/020/01J0KSWQV7N2ZC4JEKE2Q0RCJ8

has the video and

https://hubblesite.org/contents/media/images/2024/020/01HZ7KZ85WKVG3H46A8B7GCEV8?app=true&news=true

has the 3d model, STL model for 3D printing

https://webbtelescope.org/contents/media/products/01HZ7M91P8DY5J5JFQJ28WQ72X

But then, found this "zoom in" video was quite nice, needn't spend too much time on Blender,

zoom into pillars of creation

https://www.youtube.com/watch?v=lj3t_gjuXWk

https://esahubble.org/videos/heic1501f/

UHD download.

---------------------------------------------------------------------------

Similarly, for Hubble Deep Field, Extreme Deep Field, etc - there are some resources online,

https://hubblesite.org/contents/media/videos/2012/37/718-Video.html?news=true

extreme deep field flythrough

(On the dome, the video provided by Lionel Ruiz looks nicer.)

There's a Blenderkit HDRI,

blenderkit james webb deep field hdri

https://www.blenderkit.com/asset-gallery-detail/6973dec9-f137-47da-9c5b-7bc9fa6780df/

Hubble ultra deep field animation in 3d

https://www.youtube.com/watch?v=oAVjF_7ensg

720p

(link to hubblesite in description is dead)

And HD download at

Across the Universe: The Hubble Ultra Deep Field

https://svs.gsfc.nasa.gov/30687

Friday, January 03, 2025

Going around Mount Fuji

More fulldome videos made with OpenSpace - details as in my previous post. Inspired by the Digital Earth Volcanos video - https://www.youtube.com/watch?v=HEIE8V2sbFE&t=2354s


Needed to use the ESRI Wayback 2020 images to get a view of snow-capped Fuji - https://github.com/OpenSpace/OpenSpace/tree/master/data/assets/scene/solarsystem/planets/earth/layers/colorlayers/esri_world_imagery_wayback - these images load very slowly for me, unlike ESRI hosted image tiles.

The 4K (4096x4096) full resolution videos are available from archive.org - 
https://archive.org/details/fuji-side
https://archive.org/details/zoom-in-to-fuji-nvenchevc







nvidia accelerated video encoding with ffmpeg

Following this page,

https://docs.nvidia.com/video-technologies/video-codec-sdk/12.0/ffmpeg-with-nvidia-gpu/index.html

the following encoding went at around 21 fps with the NVidia 1060 graphics card - 

ffmpeg -r 30 -start_number -003875 -f image2 -i "OpenSpace%06d.png" -c:v h264_nvenc ../filename.mp4

Using h265_nvenc gave codec not found error, but hevc_nvenc worked. That went at around 23 fps. Without acceleration, when using the "lossless" parameter, it was taking several seconds per frame. 0.2 fps or so.

Edit - apparently full hardware transcode with NVDEC and NVENC:

ffmpeg -hwaccel cuda -hwaccel_output_format cuda -i input.mp4 -c:v h264_nvenc -preset slow output.mp4

But apparently lower quality - https://stackoverflow.com/questions/44510765/gpu-accelerated-video-processing-with-ffmpeg

Thursday, January 02, 2025

mini-review of adult diapers

From the wide selection available on Amazon, among tape-style diapers, 

  • Super Seni - expensive, most comfortable, but not for overnight. Over Rs. 90 each.

  • Karein - plasticky, but good for overnight. Rs. 35-40 each. This is our current overnight pick.

  • CIR - not stretchy. But less & better plastic than Friends Easy - and so CIR is currently our non-overnight pick. Rs. 26 each.

  • Dignity premium - material is soft, not plasticky - but more expensive than CIR at Rs. 35-40 each.

  • Bonbon - bad. Rs. 30-36 each.

  • Lyfcare - not as bad as bonbon, but not worth Rs. 24-50 each

Sunday, December 29, 2024

appimage issue and solution

There was a problem running the v1.60 appimage of OCVvid2fulldome, created in mid-2020 on Ubuntu 18.04, when trying to run on Linux Mint 22 (based on Ubuntu 24.04). 

AppImage: symbol lookup error: /lib/x86_64-linux-gnu/libgio-2.0.so.0: undefined symbol: g_module_open_full

Probably this is related to

So, opened an issue. But found that simply creating an appimage with Ubuntu 20.04 solves the problem. 

Wednesday, December 25, 2024

'verify your account' emails from google cloud platform

We keep receiving emails from CloudPlatform-noreply@google.com asking us to verify "your google cloud account" followed by a number. But clicking on the Verify button leads to a "not found" page on google cloud console. Clicking on the "Support" link at the bottom of the email, I came to the link for "interactive billing assistant" at

which led to

That "AI assistant" suggested that this may be a message to verify the billing account payment method. I see that a billing account with payment method had been created in the past, but we're not currently using any paid services. 

The accounts dept verified the payment method with credit card, but we still get these messages. Probably due to some other account which was used to create google assistant action? Perhaps.

Tuesday, December 24, 2024

exFAT vs FAT32

I thought that exFAT was just the new name for FAT32. But apparently exFAT does not have the 4 GB file size limit, and can be read by MacOS natively (though not by all devices which can read FAT32) - https://superuser.com/questions/440509/getting-around-the-fat32-4-gb-file-size-limit


notes on backing up Azure blob storage folder to local external hard drive

Copy-pasting from an email exchange - 

As the message says, a few thousand files did not download properly, there were errors. Most probably due to bad internet connection. Would need to retry again and again until all are downloaded. Or, use a better internet connection - for eg, I use home BSNL fiber (100 Mbps) when I need to download large files. Another option is Airtel 5G, for one-time downloads. 

When I downloaded on BSNL Fiber using Azure explorer, the download went at around 50 Mbps, 111 GB in 17605 sec or just below 5 hours.

Copying from one hard disk to another showed another possible reason for the previous download to fail - the external hard disk was corrupted, leading to file copy failure - repaired the file system and the file copy worked OK.

If needed again, can explore rclone on the RPi.

Monday, December 23, 2024

server error 500 on trying to reset password in Moodle

A Moodle admin reported internal server error 500 on trying to reset the password for another user. And confirmed that the same error occurs even when resetting his own account's password from the profile field. But the password reset via the login page works.

So, perhaps there is some setting in Moodle which prevents anyone from changing passwords except via the password reset page
or
maybe there's a bug
or
there's some issue which prevents updating of user records.

I could reset the password using the commandline,
https://docs.moodle.org/405/en/Administration_via_command_line#Reset_user_password

which in our case is

sudo -u www-data /usr/bin/php admin/cli/reset_password.php
# this prompts for the username and then for the new password. 

 

 

Saturday, December 21, 2024

Let's Encrypt certificate expiry emails

Not sure if there is any way to tell letsencrypt that these certs are no longer required - or maybe certbot delete will do it?

certbot delete --cert-name mywebsite.com


Anyway, in this case, I have already de-allocated the old server, so will just ignore the emails after checking that the current certificates have a validity date beyond what is specified in the emails. 

chroma keying tutorial etc - for "one zoom" masking of white

In order to project the onezoom.org video on the dome, without all the white background dazzling viewers, looked for ways to convert the white background to black background.


But we might not be able to use that? Maybe if we make the clip green?

Green screen tutorial - Ryan King Art

Finally ended up using inverted Y images (video) as mask, then increased contrast 3x with Multiply 3x.

capturing the screen in 4K resolution without a 4K monitor - with an NVidia graphics card on Linux

There's a very pretty visualization of all life on Earth - tree of life - on onezoom.org and I wanted to capture videos of zooming in and out.


Next, I wanted to see if I can do a 4K capture without needing to change the existing monitor, which runs on 1920x1080

Exploring the "NVidia X Server Settings", found a ViewPortIn setting after hitting the Advanced button under X Server Display Configuration. After setting it to 3840x2160, gpu-screen-recorder could still capture the screen at 60fps without any fuss. 


The Apply button worked, but the Save to X Configuration File did not - most probably due to some difference in the path. But an issue faced after making this change was that after every boot, the display would come back to this 4K setting, which made everything on the HD display too small for daily use. Even after changing back the ViewPortIn to HD, the Panning to HD, and Apply, the change would not remain after rebooting. The solution, which persisted across reboots, seemed to be to change the Scale from 2x to 1x in Display settings - 



Friday, December 20, 2024

preliminary work - tree of life from onezoom.org

 Onezoom.org has this beautiful visualization of the "tree of life" - zooming in and out of the "homo sapiens" entry - captured using GPU Screen Recorder at 60 fps, and slowed down to 15 fps without any motion compensation etc using avidemux.


The original video is also shared on archive.org

Monday, December 16, 2024

outages of our Moodle instances

There were a couple of outages - at around 8 am on 16th when the database server became unresponsive, and around 2.45 pm when the web server became unresponsive. Rebooting fixed the issues on both occasions. I believe these could have been due to a kernel update? 

Sunday, December 08, 2024

Azure AD graph retirement

 There was an email from Microsoft Azure, "Migrate Service Principals from the retiring Azure AD Graph APIs to Microsoft Graph" - clicking through, the recommendation only showed the id of the function or resource using the deprecated API, and did not provide any other information.

After an internet search, this faq showed how to identify it - 
https://learn.microsoft.com/en-us/graph/migrate-azure-ad-graph-faq#as-an-it-admin-how-do-i-identify-apps-in-my-tenant-that-use-azure-ad-graph

(It was not an application which I had created, it says the owner is "Power Virtual Agents Service" - so no action was taken. More info - https://techcommunity.microsoft.com/blog/azure-ai-services-blog/use-your-own-data-to-create-a-power-virtual-agent-with-azure-openai-service/3891860 )

automating user preferences modifications on Moodle - SikuliX

We had to change a large number of users' forum preferences in Moodle as noted in the previous post. Checking the database for changes when such changes were made, it appeared that new entries would be added to prefix_user_preferences table, with 
name = message_provider_mod_forum_digests_enabled
value = popup
and so on.

Since this was not as straightforward as just changing a flag in a user preferences table, I thought it would be safer to do it via the Moodle UI instead of messing around with database changes. 

To automate the task of changing 200+ users' preferences, I once again took the help of SikuliX. Once again, I chose the simplistic method of making SikuliX scripts with hard-coded Location(x,y) values. Using the 'Run in slow motion' mode, which shows the Location with a red cross-hair, I used moveMouse commands to find the x and y co-ordinates of the points where I wanted the clicks to happen. Unfortunately, the points were not directly 1:1 corresponding to x and y co-ordinates of my 1920x1080 fullscreen capture - Locations based on those co-ordinates threw up errors that the co-ordinates did not correspond to any location (being out of range). 

With the Edge browser screen set to approx. 80% zoom in order to show all the elements we needed on the single screen, the two scripts to update the Moodle preferences pages were as follows.

Documents > notifpref.sikuli > notifpref.py

from time import sleep

sleeptime=0.5
sleeptillpageload=2.0
urlbar=Location(925,64)
test1=Location(1300,746)
test2=Location(1405,564)
webpref=Location(1180,746)
emailpref=Location(1300,746)
id=126

while (id<345): 
  click(urlbar)
  sleep(sleeptime)
  sleep(sleeptime)
  click(urlbar)
  #type(BACKSPACE 3 times)
  type("\b")
  type("\b")
  type("\b")
  type(str(id))
  #type ENTER
  type("\n")
  #mouseMove(test1)
  popup("waiting for no error")
  #sleep(sleeptime)
  #mouseMove(test2)
  mouseMove(webpref)
  #sleep(sleeptime)
  click(webpref)
  #mouseMove(emailpref)
  #sleep(sleeptime)
  click(emailpref)
  id=id+1
  #popup("waiting for no error")

Documents > forumprefs.sikuli > forumprefs.py

from time import sleep

sleeptime=0.5
sleeptillpageload=2.0
urlbar=Location(925,64)
subjectonly=Location(700,525)
test2=Location(505,704)
savebutton=Location(505,704)
emailtype=Location(700,446)
id=4362
url="https://ourserver.org/user/forum.php?id="

while (id>4135): 
  click(urlbar)
  #select all
  type("a",KeyModifier.CTRL)
  #type(paste the url already copied)
  type("v",KeyModifier.CTRL)
  type(str(id))
  #type ENTER
  type("\n")
  popup("waiting for no error")
  click(emailtype)
  sleep(sleeptime)
  click(subjectonly)
  id=id-1
  mouseMove(test2)
  click(savebutton)
  popup("waiting for no error")

  



  

Moodle database server overloaded - fixes

Since I'd set up CPU and disk space monitoring emails on some of our servers, I started getting CPU usage alert emails regularly from the mysql database server VM which served some of our Moodle instances. CPU usage kept going up, not declining even during night hours. 

Troubleshooting - 

  1. Checked 'currently running tasks' in all Moodle instances - Site administration > Server > Tasks > Tasks running now. Deleted the 3 tasks seen to be running for over an hour (delete modules) in the database table - since these were adhoc tasks, from the {task_adhoc} table based on adhoc taskid.

  2. Checked task logs, filtered for tasks taking longer than 3 seconds, and changed the scheduled tasks settings inside those Moodle instances to reduce the frequency of those tasks. Did this for all five Moodle instances. On the newest instance, changed the following in
    Site Administration > Server > Tasks > Scheduled tasks
    • \enrol_category\task\enrol_category_sync -  */5 instead of * (once every five minutes instead of every minute)

    • \local_edwiserreports\task\send_scheduled_emails 05 instead of */5 (once an hour instead of once a minute)

    • \local_edwiserreports\task\update_course_progress_data 39 instead of */5

    •  \mod_customcert\task\issue_certificates_task (once a day instead of every minute)

    •  \mod_forum\task\cron_task (once an hour instead of every minute)
    • \core\task\search_index_task */47 instead of */30 

  3. The newest instance had thousands of errors being generated by mod_forum - failed to send notifications - and also another instance had thousands of errors from 'failed to send login notifications' at the time of migration in May. Deleted all these failed adhoc tasks from prefix_task_adhoc for both these instances. (For deleting the rows, since the number of rows were so large, it was much faster to create a query like 
    delete from our_db.prefix_task_adhoc where classname like '%send_user_notif%' (24k rows)
    instead of deleting via the DBeaver GUI.

  4.  I had tried various options to prevent mod_forum from throwing errors for 'failed to send notifications'. Finally, the options which worked seemed to be:
    + Enable mobile notifications in Site Administration > General > Notification settings

    + Enable Subscribed forum posts notifications for Web and Mobile, also in Site Administration > General > Notification settings, default notification preferences

    + Enable Subscribed forum digests notifications for Web, Mobile and Email

    + Go to each user and change their forum notification preferences to Digest instead of No digest (each post separate email) - I'll write a separate post on how I automated this - Site Administration > Users , find the user, click on the user profile, Administration > Preferences and there, change forum preferences and notification preferences as above. 


GMail rate limiting and Moodle

Some of our Moodle instances which used XOAUTH to send emails via smtp.gmail.com had issues with temporary authentication failures. Apparently GMail's smtp servers have started rate limiting after approx 100 emails were sent in 3 minutes by Moodle. Mostly mod_forum email digests.

Since Moodle itself doesn't seem to have any provision for rate limiting, we need to set up some mail relay which can retry mails which get throttled.  

SSMTP which is currently installed on the server, doesn't seem to support any advanced features like rate limiting. 

Since I'm familiar with Postfix, looked up ways to send emails from Postfix through google's smtp servers - https://computingforgeeks.com/configure-postfix-to-relay-emails-using-gmail-smtp/

After setting up postfix as above, and changing the outgoing mail configuration on our Moodle instances to the default values (which would use the server default, ie postfix), emails seem to be going out fine. 

For checking the postfix logs for errors, 

journalctl -t postfix/smtp | more
journalctl -t postfix/smtp -f # for tailing the logs

With the postfix config with a single relayhost, there are a few errors once in a while "Network unreachable" but a second later, the mail gets sent. So, use of postfwd or extra config was not needed. If needed in future, multiple postfix instances or the use of multiple relay hosts based on authentication might be options.

Currently sending two large instances' emails through these, 250 emails have gone out last night with no problems as seen via the gmail interface in the sent folder.

 

limiting download speeds with trickle

Running Sheepit render farm in the background on one of our machines, I wanted to limit the download speed of the Sheepit client, since office bandwidth was limited. 

First tried wondershaper and tc - did not work - finally ended up with trickle. Modified the desktop shortcut launcher I use to the command

trickle -s -d 1024 -u 1024 java -jar sheepit-client-ver.jar

Earlier tries and misses, and links for reference - 

https://securitynetworkinglinux.com/how-to-shape-traffic-using-wondershaper-on-ubuntu-20-04-cli/

https://askubuntu.com/questions/1523362/server-24-04-only-starts-a-single-interface-on-boot

https://superuser.com/questions/1053003/what-is-the-difference-between-eth1-and-eno1
We have eno1 instead of eth0.

Used git clone instead of the apt version as per
https://github.com/magnific0/wondershaper

Then, syntax has changed. But errors,
sudo ./wondershaper -a eno1 -d 1024
Error: Exclusivity flag on, cannot modify.
Error: Exclusivity flag on, cannot modify.
Error: Exclusivity flag on, cannot modify.
RTNETLINK answers: File exists

Trying tc with this syntax from
https://superuser.com/questions/1598721/adding-both-delay-bandwidth-restrictions-via-tc

sudo tc qdisc add dev eno1 root netem rate 10mbit
no errors shown
sudo tc qdisc add dev eno1 root netem rate 1mbit
Error: Exclusivity flag on, cannot modify.

The 2nd command above was with protonvpn on.

sudo systemctl restart systemd-networkd
sudo tc qdisc add dev eno1 root netem rate 1mbit
Error: Exclusivity flag on, cannot modify.
 
https://www.cyberciti.biz/faq/linux-restart-network-interface/
sudo ifdown eno1
ifdown: command not found.

sudo systemctl restart systemd-networkd
 
sudo tc qdisc add dev eno1 root netem rate 5mbit
no errors,
but when running protonvpn, this has no effect - download is running at 2.4MB/s
 
trickle -s -d 1024 firefox
Command 'trickle' not found, but can be installed with:
sudo apt install trickle

sudo apt install trickle
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package trickle is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'trickle' has no installation candidate


https://ubuntu.pkgs.org/22.04/ubuntu-universe-amd64/trickle_1.07-11_amd64.deb.html
 
wget http://archive.ubuntu.com/ubuntu/pool/universe/t/trickle/trickle_1.07-11_amd64.deb
Installed OK.

But man trickle says,
Furthermore, trickle will not work with statically linked executables, nor with setuid(2) executables.
 
Also available from source, https://github.com/mariusae/trickle
 
 

Tuesday, December 03, 2024

some blender ideas I have not yet tried

Shortcut to creating rocket scene - from https://sketchfab.com/3d-models/gslv-mk3-0426922358b4444f9887bcd551d3a5cb - zoom in the view, take screenshots, then composite it with Earth background.

Editing Blender Image Texture with Gimp - How to Link Blender with any External Image Editor! (youtube.com) - as of now, only directly edited the png texture file(s) by loading them into Gimp outside Blender.

How to make millions of bodies - https://www.youtube.com/watch?v=CQ9VmCN2EsE - How to Render Millions of Objects in Blender.

Rigid bodies physics - falling etc https://www.youtube.com/watch?v=nHVYYMG3QVY

DNA in Blender in one minute - nicely explained - https://www.youtube.com/watch?v=xgPlgiOQWPA

Biochemistry L12: Building Bacteria (E. coli) in Blender - https://www.youtube.com/watch?v=XoDDNCWyziI - that channel has lots of Molecules, Chemistry, proteins, petri-dish etc Blender tutorials. @LuminousLab, "Blender for Scientists".

Smart UV project - for easier uv unwrapping of simple objects - https://www.youtube.com/watch?v=qa_1LjeWsJg - UV > Smart UV project - https://youtu.be/qa_1LjeWsJg?feature=shared&t=820 - This did not seem to work for the cubes - would always turn out sideways for some cube faces. Did rotation and rescaling of the uv mesh manually.

Idea for Swami video composition - or a sequence of stills - 5 stills left to right, come at 1 sec intervals, 4 stills above that (found in testing that one layer of stills looks better than 2 layers.) Each frame changes every second? May not be required - could have new frames appearing every second, then after 5 seconds, the first frame changes, etc. Change would be like a page turn? - or not - quick fade to black and change also works. Another option: A large photo album, with pages turning. Each page has 2 + 2 photos? This might need animation. So, earlier option might be easier. Page turn tutorial - https://www.youtube.com/watch?v=K3lfNXAZblA

Keyframe the multiply factor, to change the speed of clips - to slowly speed up or slow down clips - https://docs.blender.org/manual/en/latest/video_editing/edit/montage/strips/effects/speed_control.html - as of now, used only the "stretch" method, which is the default for the Speed Control effect, which is easy to use. We can cut clips with Shift-K and apply different speeds etc.

Privacy blur mask in Blender VSE - https://www.youtube.com/watch?v=v0qoIRKNtnE

Set active camera - animate camera smoothly - https://www.youtube.com/watch?v=a7qyW1G350g

How to use google colab to render blender files - Speed Up Your Blender Renders with Free Google Colab- using Sheepit Render Farm instead as of now.

3d text in Blender - Add a text object, choose the font in the object's properties. 3D Text in Blender: Everything You Need to Know! - but has problems with Hindi rendering etc


Monday, December 02, 2024

human body anatomy - using the free z-anatomy blender model

Led on by this video, though the model was not found in the link in the description of the video, found it with a github search at Z-Anatomy/The-blend: Z-Anatomy blender template

As mentioned in the video, importing single collections like skeletal system takes a minute or so, importing multiple collections or opening the entire blend file takes a bit longer.

To import the whole thing and then save-as, deleting those features which we don't want - 

  • to delete text labels, we can select all text labels by going to Object menu, Select all by type and choosing Text

  • Rendering in eevee or cycles causes a cut-away view, while workbench rendering engine gives a whole face. This is probably due to some "hide" setting somewhere, but I just went with workbench rendering instead of trying to troubleshoot.

  • to turn on visibility for all objects in a collection, we have to Alt-left-click on the render / viewport icon as required. ALT clicking is the trick.

  • to move camera to current view, the shortcut is Ctrl+Alt+Numpad 0. Or can change the shortcut on machines which don't have the numpad, in File > User Preferences > Input, search for camera, the pref is 'align camera to view'. For Blender 4.2, the menu is Edit > Preferences > Keymap

  • to prevent camera being deleted with lasso select, just hide it - select the object in object mode, Object menu > Show/Hide > Hide selected (or H is the shortcut key, Shift H to unhide after the delete operations are done.)

  • Working with objects inside a collection - simply selecting the collection and deleting it does not delete the objects inside the collection. To select all objects in a collection - right-click the collection and choose Select objects. Then, Del key or x or object menu > delete
  •  

Saturday, November 30, 2024

ffmpeg commands - image sequence to mp4

Listing some of the ffmpeg commands used in my previous post

ffmpeg -r 30 -start_number 1326 -f image2 -i "OpenSpace_%06d.png" -vcodec libx264 -crf 15  -pix_fmt yuv420p mars-valley-2.mp4

#and for reverse,
ffmpeg -r 60 -start_number -3037 -f image2 -i "OpenSpace%06d.png" -c:v libx265 -x265-params lossless=1 zoom-in-to-psn-lossless.mp4

and today,
ffmpeg -r 30 -i "%04d.png" -c:v libx265 -x265-params lossless=1 bloodcells.mp4
and 
ffmpeg -r 30 -i "%04d.png" -c:v libx264  ../bloodcellsx264.mp4

Wednesday, November 27, 2024

why it is a bad idea to have other people's product name in the name of your product/service

 Copy-pasting from an email exchange, when a well known name was proposed to be used for one of our servers - 

Why it is a bad idea to have other people's product name in the name of your product/service - though legally permissible, it is generally regarded as being due to incompetence or due to malfeasance (trying to scam people to get more traffic.)

https://www.nolo.com/legal-encyclopedia/question-trademark-infringement-use-company-name-28198.html

and so, we should choose another name.

Tuesday, November 26, 2024

upgrade Moodle 4.4 to 4.5

Since the theme for some of our Moodle instances was "Moove" and this theme had some updates which would work on 4.5 only after upgrading the theme, first changed the theme to the built-in theme "Boost" from the UI, completed the upgrade, upgraded the plugins including the Moove theme, changed back to Moove theme, OK.

The upgrade itself was 

screen
cd /var/www/theLMSgit
sudo -u www-data /usr/bin/php admin/cli/maintenance.php --enable
git config core.filemode false
#git branch --track MOODLE_405_STABLE origin/MOODLE_405_STABLE - this was done earlier.
git checkout MOODLE_405_STABLE
git pull
sudo chown -R azureuser:www-data .
sudo chmod -R 775 .
sudo -u www-data /usr/bin/php admin/cli/upgrade.php

Sunday, November 24, 2024

Activity dashboard in google docs

 There was a request from a user that he wanted activity to be turned on - 

he is not able to see who all opened the document through the shared link.

Copy-pasting from my reply - 

There is a misunderstanding about what the 'Activity Dashboard' does do and does not do.


Even though the "Activity Dashboard Settings" is set to ON, the activity will be visible only during the time the viewer is viewing the document, and not later. 







The (relevant) document pdf seems to be shared as "Anyone on the internet with the link". So, even at the time when someone is viewing it, if not logged in, that person will be shown as some anonymous name. For example, "Anonymous Squirrel" in this case - 




Also, the activity dashboard will not show anything until some user edits the document, it will show only the following info:






linux desktop shortcut to open a directory in terminal

Following https://unix.stackexchange.com/questions/62197/how-to-make-a-desktop-shortcut-that-opens-the-terminal-but-under-a-different-d

in our case, xfce4-terminal --working-directory=/the/relevant/directory

Friday, November 22, 2024

blender rendering settings

 By trial and error, for neuronDuplicated scene, fast rendering with acceptable quality - Blender Cycles render:

Noise threshold Off

Max time 1 seconds, 

1024 max samples, 

denoise on - seems to be fastest with good results.


For 3 cubes with video textures

0.5 noise threshold

4096 max samples

Max time 1 sec

denoise off

seems to be fastest with good results.

show the rules for creating username on Moodle - email based signup

There was a request for a method to show the rules for creating usernames (shouldn't have spaces, should be only lowercase) for new users registering on Moodle. 

While a help message is provided for the password, similar information is not provided for username...


My reply was:

https://our.moodle.server/admin/settings.php?section=manageauths
There is an "instructions" field available at the above link, which you can use to provide instructions to the people logging in. Maybe that might help you.

(Another option is to remove the option for users to enter Username, and instead only use Email address as username. But I'm not sure how to do that.)  

With this "instructions" field the problem seems to be mitigated - these instructions are shown on the login screen itself.

animating visibility for neurons scene in Blender

Creating this neurons scene

Shift selected to select multiple neurons, then Alt D to duplicate, move mouse to move, R to rotate etc.

In Blender, for keyframing visibility of objects - https://blender.stackexchange.com/questions/115526/trying-to-hide-object-during-animation

has screenshots. "Show in" > Viewports or Renders



Thursday, November 21, 2024

recaptcha and Moodle

Moodle has a feature of enabling Recaptcha for email-based registration. But when I tried it with the v3 version of the google captcha, it did not work. V2 works. So, go to recaptcha site, click through the options, choose v2 and not v3

(Moodle seems to have issues with v3? or was it that I did not wait a sufficient amount of time for the changes to propagate?)

modifications to activity completion report

We've had multiple requests for modifications to Moodle's activity completion report - 31 Aug 2023, the request was to add a cohort id, for which I replied (copy-pasting from email exchange)

Need help. In the activity completion report, we do not get cohort id /name. Could you please modify this system report to include cohort id?

Within my current limited understanding of moodle, I don't think this is possible. 

We can write some sort of ad-hoc report to have the contents of the activity completion report with cohort being one of the fields, but that would end up being
very complicated, because of the different numbers and names of activities over different courses.

A simpler option might be to filter inside google sheets or Excel based on users in the cohort you desire, after importing the csv of activities as one sheet, 
and the list of users + cohort in another sheet. An example is shown here,

 progress-trainer-coordi... (link to google sheet removed)


In the Method1 sheet, the last field EZ has been filtered to include only Our_Cohort_2_2023

There is one complication. Each user can appear in more than one cohort. I've used the LOOKUP function to map user to cohort,
=LOOKUP(B27,Cohortusers!D27:Cohortusers!D3199,Cohortusers!A27:Cohortusers!A3199)
but I think the LOOKUP function returns only the last cohort to which the user belongs. 
A better option might be, if you know which cohort you want, to use a function like
=IF(COUNTIF(OnlyOurCohortusers!$D$2:OnlyOurCohortusers!$D$87, B2)>0,"Yes","No")

This has been implemented in the Method2 sheet of the same spreadsheet file.

For some reason, both these methods seem to return 137 rows, even though the OnlyOurCohort sheet has only 85 rows of data.
I'm not sure why.

I have obtained the cohort users using a "custom report", Site Administration > Reports > (Report builder) > Custom reports
User id by cohort (link removed)

-----------------

Then, in Nov 2024, the users wanted a volunteer to modify the code to add a column 'group' to the activity completion report. Again copy-pasting from an email exchange,

Some additional info to what [the volunteer] has written -

1. Activity completion report plugin is part of moodle core, hence will be updated every time Moodle has an update - which would be approx 3-4 times a year. So, any modified version in, say,
reportmodified/completion/index.php
may need to be edited / checked / corrected after each Moodle update. If it works, no problems. But if it doesn't work, code modifications would be needed.

2. Also, running queries on very large number of users has the possibility to make the database time out. Hence, filtering by smaller groups is advisable.

3. Due to 1 & 2, I would strongly recommend filtering by group, exporting to csv, and then if necessary, aggregating via Google sheets / Microsoft excel etc. 

4. The next best option would be to use ad hoc reports. Again, (2.) is a consideration, ad hoc reports can easily cause system lockups if not executed with care.

5. If (2.) is not an issue - that is, if the activity completion report of all users does not slow down the system, and if you can live with (1.) - that is, have the modified code work for now, but potentially break after a month or so, following which [the volunteer] would again need to check and re-modify the code, only then would I suggest asking him to modify the code and create a modified version of the activity completion report.

And the response was,
As of now the team is convinced that they can generate individual group wise reports. Presently there are about 10 groups. If the number of groups increases, we may need to think of a solution.

- meaning that as of now, no modified version is being used.

Wednesday, November 20, 2024

brain and neuron modeling in blender

How To Make a Brain in Blender

Brain Material Blender 2.8 Easy Tutorial

Download 3d model

Creating plastic texture - 
defaults, only change colour and roughness.

Final results, using the downloaded model, are at
https://github.com/hn-88/Blender-files/tree/main/brainmodel

referer in apache logs not seen in awstats

Trying to set up awstats for one of our servers which needed referer information to be captured - the referer info was not being displayed initially.

https://simonecarletti.com/blog/2009/01/logging-external-referers-with-apache/

Documentation said

better to have separate logs for each virtual server. So, set that up.

Purge old files (which contain irrelevant data during testing) by deleting from DirData

It is in /var/lib/awstats on our server.

And the main reason for referer not being displayed was the wrong logformat - it needed to be 
LogFormat=1
and not 
LogFormat=4 # default

Sunday, November 17, 2024

customizing email-based self sign-up in Moodle

Copy-pasting from an email conversation - 
  • There is a discussion here for customizing the welcome email for the students - https://moodle.org/mod/forum/discuss.php?d=389805

  • To change whom to send the confirmation email in the case of "self registration with admin confirmation"  - Navigate to `Site Administration --> Plugins --> Plugins overview --> Email-based self-registration with admin confirmation ( Settings ), you should be able to set captcha and admin email id to be whom the email to be sent. 

  • If you would like to change any email content,etc. Navigate to `Site Administration --> General --> Language customisation --> Choose English ‎(en) --> Open language pack for editing --> In filter strings choose auth_emailadmin --> Click Show Strings`, it has detailed descriptions on what each string means. If you would like to update/customise any email content, etc you can update there accordingly.

Friday, November 15, 2024

Moodle notification - Task failed: Send user digests

One of our Moodle instances showed this in the task logs:

SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/TroubleshootingSMTP server error: QUIT command failed 
Detail: Too many login attempts, please try again later. For more information,

This could have been due to sending each email with a separate login - I have changed the SMTP session limit to 90 instead of 1 (which would have made the server log in repeatedly for each email).

Another possibility is that one of our development servers is also using the same email id for sending, and that is causing a "too many connections" error which is what the google support page linked above talks about. So, I created a separate email account for that server to send emails from the development server to prevent these errors from happening.

Thursday, November 14, 2024

how to change Google Play store screenshots for an Android app

For the particular app, from the Google Play developer console,

Store presence ->

(default listing)

--> at the right-hand side

scroll down to Graphics.

What I did for getting suitable screenshots was to take screenshots from mobile, and in landscape mode for tablet screenshots, since my Samsung M34 5G's screen resolution was high enough. 

Wednesday, November 13, 2024

onboarding a user on a linux webserver

sudo adduser theuser

https://duckduckgo.com/?t=lm&q=ubuntu+adduser+or+useradd&ia=web

https://tecadmin.net/generate-ssh-keys-in-pem-format/

ssh-keygen -m PEM -t rsa -b 4096 -f filenameOfKey.pem

and for the user to make modifications,

cp -r course coursemod
cp -r report reportmod

chown -R auser:www-data coursemod
chown -R auser:www-data reportmod


Monday, November 11, 2024

'send user digests failed' error on Moodle

 One of our Moodle instances had around 100 of "send user digest failed" messages. It appears that these are due to the following users (listed around 21 users). We can log on to the GMail email id being used to send emails from the server to check if these are due to "mailbox full" or whether it is due to wrongly entered email ids or something else.

Accordingly, one of the admins disabled notifications for these users.

I've confirmed that doing so -

Site administration > Browse list of users > (choose the user) > (Administration) > Preferences > Notification preferences > Disable notifications

does in fact change the "emailstop" column of the prefix_user table in the database. So, this is the correct procedure.

I have enabled forwarding of bounce notifications from two of our Moodle instances which send emails, to my email address, I will do this (Disable Notifications) for each bouncing email user going forward.

Sunday, November 10, 2024

notice to add the xapp status applet in Linux Mint Xfce desktop

 https://forums.linuxmint.com/viewtopic.php?t=319869

As the above forum posts said, the solution was to 

Right-click on the panel (the strip along the bottom of the screen)

Choose the menu item Panel > Add new items > XApp status

(But since such an applet is not visible, just set to ignore? - Status Tray plugin is added.)

Saturday, November 09, 2024

OpenSpace - running version 0.20.1 on Linux Mint 22

The space visualization tool OpenSpace - https://www.openspaceproject.com/ - has a deb file for download, but that leads to dependency issues with libboost - version 1.83-dev is what is installed for Ubuntu 24.04 on which Linux Mint 22 is based, and the .deb file depends on version 1.74-dev. So, advised to compile from source.

Following the instructions at Ubuntu — OpenSpace documentation - except had to replace 
sudo apt install libboost1.74-dev
with
sudo apt install libboost-all-dev following https://askubuntu.com/questions/922625/cannot-install-libboost-all-dev-because-dependencies-are-not-getting-installed

On the first try, with the downloaded source from the github releases page, got errors - 
include could not find requested file:
    /path/OpenSpace-releases-v0.20.1/ext/ghoul/support/cmake/message_macros.cmake

was because I had not done git clone --recursive

After the recursive git clone, the first few times make gave errors. We needed to do a checkout of the last stable release,
git clone --recursive https://github.com/OpenSpace/OpenSpace "$openSpaceHome"
cd "$openSpaceHome"
git checkout "releases/v0.20.1" --recurse-submodules

Otherwise, the current head was being built, with incompatible osrectxt format etc etc.

make -j was going quite fast, 65% in just a couple of minutes, but then the machine would hang. Finally worked out by running System Monitor that (a) swap was not enabled, and (b) certain longer jobs would cause significant RAM usage leading to all 8 GB being used and then a system crash. After enabling swap of 32 GB, continued with
make -j 2
doing 2 concurrent jobs instead of unlimited concurrent jobs - and now the linker complained that some symbols were not found. I suspected that this was due to the interrupted builds due to the crashes - so, 
make clean
make -j 2

That built the executable in around an hour on this ~10 year old Lenovo Thinkcenter desktop. When I tried to run it, after setting mrf cache to true in openspace.cfg and copying over the sync, user and mrf_cache directories from an earlier install on Windows, and setting the OPENSPACE_SYNC environment variable in .bashrc, errors just before the screen becomes usable - 
terminate called after throwing an instance of 'sgct::Error'
what():  [Engine] (3010): GLFW error (65547): X11: Standard cursor shape unavailable

Checked if it was running Wayland instead of X11 - using this method,
echo $XDG_SESSION_TYPE
x11

So it was running x11. And not Wayland. Checking for cursors in Software Manager, installing the base cursors did not solve the issue - 
sudo apt install xcursor-themes

OpenSpace would work so long as we didn't move the cursor inside its window. Controlling it via the HTML interface, through a web browser pointed to localhost:4680 was working.

Then thought of display managers and window managers - tried out Xfce desktop -
 sudo apt install task-xfce-desktop -y

Rebooted, logged in to Xfce desktop using the chooser next to the login name, and now OpenSpace worked fine. So, there's something in Cinnamon desktop which doesn't play well with GLFW.

NASA SVS fulldome gallery

 Nasa's Scientific Visualization Studio has a few fulldome videos available at https://svs.gsfc.nasa.gov/gallery/fulldome-gallery/

Many from the Dynamic Earth show, and Mars from Wet to Dry

moving from Azure CDN

The Azure portal had emailed us that the Azure CDN from Edgio would be retiring, and that since Edgio had gone into bankruptcy, service continuity was iffy. Their "recommended replacement" Azure Front Door Standard or Premium, looked pricey:

Front Door seems to have a minimum monthly cost of $35,
https://azure.microsoft.com/en-us/pricing/details/frontdoor/

So, instead, shall I just migrate the content elsewhere?

Currently, only old issues of a newsletter seems to be on cdn.ourdomain.org - content being served from a particular storage container.

I could move all the stuff there to a github pages repository instead, and map cdn.ourdomain.org to that - Github pages is free, (limited to 2 GB per repository).

Another option is that I can configure a cheap VM to point to the relevant container, mounting the container with blobfuse - 
https://learn.microsoft.com/en-us/azure/storage/blobs/storage-how-to-mount-container-linux?tabs=RHEL

Looking at the size of the content, which was only 780 MB of archival content and not expected to grow, thought of going with github pages.

Created a github pages repository,
put all the files there,
and changed cdn.ourdomain.org CNAME record to point there instead of the CDN.

Tested with google site:cdn.ourdomain.org for old cached links, working with the new site - like
http://cdn.ourdomain.org/sssihms/wp-content/uploads/2018/01/nameoffile.pdf
 

OK.


Friday, November 08, 2024

File upload size on WordPress

 After an operating system upgrade, Wordpress upload file size limit had decreased to the default, and 50 MB was desired. Increased by editing the php.ini file,

upload_max_filesize = 50M
post_max_size = 58M
max_execution_time = 300

and restarted the web server.

Wednesday, November 06, 2024

find which version of ubuntu Linux Mint is based on

 Via https://www.baeldung.com/linux/mint-ubuntu-base-check

Either

cat /etc/upstream-release/lsb-release

or

inxi -Sx

or

System Reports in the UI - System Information tab

Linux Mint 21, for example, is based on Ubuntu 22.04 while Mint 22 is based on Ubuntu 24.04

Database connection failed error on Moodle instance - enable service to make it start automatically on reboot

The problem was that I had not "enable"d the tunnel service (details in a previous post) which was tunneling the database connection over ssh - so, on server reboot, the tunnel service was not restarting automatically. We need to do 

sudo systemctl enable name-of-our-service

to make it start automatically on reboot, and then

sudo systemctl start name-of-our-service

to actually start it the first time.

Monday, November 04, 2024

sheepit render farm client as a service

 As a commandline, and as a service on linux

https://erlangen-sheppy.medium.com/sheepit-renderfarm-on-linux-16ccb1f5f5a6

Edit: finally ended up using Sheepit manually, and not as a service, and with trickle to limit the bandwidth - https://hnsws.blogspot.com/2024/12/limiting-download-speeds-with-trickle.html - the advantage is that when I want to run something else like OpenSpace, I can easily stop Sheepit from the UI.

Saturday, November 02, 2024

Lenovo Thinkcentre desktop - Linux Mint notes

Decided to try out Linux Mint on one of the desktops which had Windows 10 installed. To minimize interference with the borrowed machine, we installed Linux on a separate 256 GB SSD. To connect the SSD, we disconnected the CD/DVD drive. 

To boot into the install USB, F10 is the key we have to press on boot, which gives the option to go into System Settings or BIOS. 

The machine was rebooting instead of shutting down when the 'Shut down' option was chosen.
https://askubuntu.com/questions/1321208/computer-reboots-instead-of-shutting-down
All Power > "Power on X" settings should be turned off in BIOS. I also found a setting which said, "When lose power" --> "go back to previous state". Changed that to 'shut down', too. 

With these changes, the machine shuts down. But when power is removed and re-applied to the SMPS (by putting on the UPS the next day), the machine still automatically boots even without pressing the power button - so a separate switchable plug would be desirable.

Then, added swap to prevent sudden freezes due to memory issues (though system freezes due to insufficient power is still possible, the SMPS is underpowered) - 

https://thelinuxcode.com/add-swap-space-linux-mint/

free -h
sudo fallocate -l 32G /swapfile
sudo mkswap /swapfile
sudo chmod 0600 /swapfile
sudo swapon /swapfile
free -h

Edit: The above method of adding a swap file does not persist on rebooting - apparently it will persist only if added to /etc/fstab - so I added a line to root cron - 

sudo crontab -e

#(at the bottom of the file)
# all other cron jobs must be above this
@reboot swapon /swapfile