Show Posts

You can view here all posts made by this member. Note that you can only see posts made in areas to which you currently have access.


Messages - Brian000

Pages: [1] 2 3 4
2
General Discussion / Re: Boot Times & Run Times
« on: January 23, 2022, 09:04:18 pm »
Hi,

That's an interesting thought..............and I'd agree with your findings - at least based on my usage, I get similar performance (at least to login).... Although I always caveat that I'm not a heavy desktop user (I don't install/start a GUI if I don't need it).

Considering my own (old) hardware - I certainly find that CD and DVD is noticeably slower than either USB or HDD. For a few years, I actually installed that O/S onto a USB3.0 (600MB/s) which was plugged into a USB2.0 port (being only 60MB/s). This had minimal performance loss when compared against my standard 5400RPM HDD (100MB/s) installation. At present I use a SSD (530MB/s) which is plugged into the same old SATA2 port (being only 300MB/s)...   so based on that, it would appear that my SSD is by far my best option - but in reality, it is all very insignificant.
(I'm unsure if those figures are correct, I grabbed them from the internet solely for this post!)

It's probably worth considering that many of the boot processes are not reading from disk, but they are initialising hardware and negotiating network, etc - which may explain why "time to boot" is pretty consistent...

3
Linux Support / Re: SSH Key authentication
« on: January 08, 2022, 10:21:05 am »
It appears that I do not understand it correctly! ;)

The HOST directive is a client side “shortcut” - so when I type “ssh gitserver” it knows which user and host to use!

So, that’s not quite what I’m after, but at least i know i can use the ssh-key (just need to secure that)

….but what is the right way to do this??

4
Linux Support / Re: SSH Key authentication
« on: January 08, 2022, 12:00:19 am »
I have a fudge which seems to work - but I don't like it!

Generating an SSH-KEY without a passphase, and lock down the SSH connection on the server instead.

This means (assuming I understand it correctly) that the client connection can remain "insecure", because the server only permits access from  clients with the SSH-KEY (and from the named user).  Further, setting the PasswordAuthentication to "no", means that the same named user can only ever use the key.

Changing /etc/ssh/ssh_conf - adding another "host" directive like:
Code: [Select]
    Host gitserver
    HostName localhost
    User git
    IdentityFile ~/.ssh/id_gitserver
    IdentitiesOnly yes
    SendEnv LANG LC_*
    PasswordAuthentication no

Nb: for my testing both gitserver and localhost are in my /etc/hosts.

If anybody has a better idea of how to connect via SSH without requiring a password, please reply because I'm happy to continue playing.....

Thanks......

5
Linux Support / SSH Key authentication
« on: January 07, 2022, 10:11:24 pm »
(Lubuntu - 5.11.0-43-generic #47~20.04.2-Ubuntu)

I have played with SSH authentication in the past and failed then too - but didn't have a use for it.... However, that's changed because I'm looking at using GIT and therefore need to be able to SSH onto my GIT server via cron - so I'm back setting up SSH key authentication.

This is a single computer, which I'm SSHing back to itself for testing and I have done what the internet suggests is the "usual" - being:
(only one of so many examples : https://www.pragmaticlinux.com/2021/05/configure-ssh-for-login-without-a-password/)

Code: [Select]
ssh-keygen -f .ssh/id_gitserver
eval "$(ssh-agent -s)"
ssh-add .ssh/id_gitserver
ssh-copy-id -i .ssh/id_gitserver [email protected]

"OK, nice!", I think to myself when it all works! However, it seems that I need to rerun the two commands; "eval" and "ssh-add" (which requires the passphase) whenever I logout and back in....  I see that I now have a lot of "ssh-agent" processes running, so I'm pretty sure this isn't how it should work - but does anybody know what I'm doing wrong?

Some posts suggest that I should use "ssh-agent bash" instead of the EVAL command - but I that gives similar/same results.

There is a risk from my testing, that I have nested connections, but I expect the SSH keys to authenticate from my git user regardless of anything.

Thanks.

6
Linux Support / Re: Debian 11
« on: January 05, 2022, 10:08:46 pm »
Hi,

I have run into a few upgrade issues with Deb11, but that%u2019s only upgrading thinGs like HomeAssistant, because dependancies no longer exist.  It%u2019s holing me back from upgrading to 11.

If you we talking serverand demand reliability, i%u2019d recommend any of the RedHat source re-builds; like Oracle Linux and the others have started up since CentOS changed (and is no longer in that list). The balance is functionality - you%u2019ll be tied to older software versions - but may be able to add extra repos to bypass that - although that risks the stability i guess!  But if you require rock-solid build and potentially zero downtime, that%u2019s my personal recommendation.

But a dedktop - I would go for any of the LTS editions - i%u2019m not sure if Deb11 is - the LTS will give you (again) stability over newer features, but also longer support when compared with non-lts editions.

If you look at distrowatch.com - that will give you a list of the main software with versions.

It may be worth you keeping a list of what you install, because it should be easy enough to swap or reinstall%u2026.  There are ways to automate builds - I just wish i had time to look into those myself ;)


Edits in Bold</>

Perhaps somebody else has hands on experiance with 11?

7

Hi,

While I fear i won’t be able to provide any real help - What model is it and what distribution are you using?  And how far from your PC are you? 

I have used a few wireless keyboards - on Ubuntu Mint.
My first was an Accuratus Toughball2 - the keyboard was hit and miss, but the trackball was good
I’ve had a few cheap keyboard and mouse pads which actually worked quite well but were let down by their build quality
And i currently, use a Logitech k400+ which is good on batteries and works well.


All of these were always used about 2m away, with the dongle at the rear.  I got better reliable performance but moving the dongle to a USB extender (positioning it away from PC and monitor)


How old is you keyboard? It may be that newer models are just better!


8
General Discussion / Re: Version Control
« on: January 01, 2022, 11:17:06 am »
.....For those not using RHEL8 (or similar) - you may be interested in this script.

It uses RCS; being a simple versions control system which exists on many distros/repos.

Code: [Select]
apt-get install rcs
which is a tiny package!

I have scripted the basic use-cases, which could be used to version control any file you may have.  While RCS relies on subdirectories (./RCS) the below uses a central directory and creates a symlink instead - this way all of the version data is kept in 1 place (opposed to scattered around your drive).

I include the below for anybody who may be interested in version controlling their files, but doesn't want the bother of installing something like GIT (you lucky things! :) ) - but I don't intent to maintain this any further, and I've therefore added a few extra comments to aid those who may find it useful.

NB: I'm not suggesting it's 100%, but based on my own basic tests it showed promise.....

examples:
Code: [Select]
brian000s_vc_script.sh add /etc/fstab 
This will create a new directory within ${rcsdir} called "_etc_" which is symlinked to "/etc/RCS" - adding this initial version to it.

After making changes, run:
Code: [Select]
brian000s_vc_script.sh lock /etc/fstab
brian000s_vc_script.sh update /etc/fstab
Which will apply the new changes (perhaps you'd consider merging those two into one statement!).

To view the revision history:
Code: [Select]
brian000s_vc_script.sh version /etc/fstab

If you find yourself changing multiple files at the same time:
Code: [Select]
brian000s_vc_script.sh bulk
this will version control (creating new revisions, or updating existing ones) for any thing changed "today"

For more info please refer to the script below.......   

Hope this helps somebody.....

Code: [Select]
#!/bin/sh

##X-ref: https://linuxforums.org.uk/index.php?topic=14199.0

CI=`which ci`
CO=`which co`
RCS=`which rcs`
RCSDIFF=`which rcsdiff`
RLOG=`which rlog`
DIRNAME=`which dirname`
dollar=$
success=0
today=$(date +"%Y-%m-%d")

##update as required!
user=`whoami`.`hostname -s`
rcsdir=/shared/RCS
rcsdirtmp=${rscdir}/tmp

_HELP() {
  echo "#########################################################"
  echo "File: ${0}"
  echo "$Id:$"
  echo "$Source:$"
  echo "#########################################################"
  echo "Purpose: Use RCS for version control"
  echo "         This uses symlinks saving revisions to 'rcsdir'"
  echo "#########################################################"
  echo "Known Issue or Risk:"
  echo "  Limited testing -  may contain errors"
  echo "  RCS removes the file after it's created, so this performs a 'get' after"
  echo "  'Bulk' may encounter issues where the revision is locked"
  echo "  During development, I lost a few test file, so a copy of the original script is saved to 'rcsdirtmp'"
  echo "  RCS doesn't seem to permit un/lock with a specific user - so 'user' may not be fully functional"
  echo "#########################################################"
  echo ""
  echo "checkout - Bookout and lock the latest revision"
  echo "           ${0} checkout <file>"
  echo ""
  echo "bulk     - Batch add/update all changes made <today>"
  echo "           ${0} bulk"
  echo ""
  echo "diff     - Get differences between the file and latest revision"
  echo "           ${0} diff <file>"
  echo ""
  echo "get      - Bookout and unlock the latest revision"
  echo "           ${0} get <file>"
  echo ""
  echo "header     - Check file for inclusion of the version detail parameters"
  echo "           ${0} header <file>"
  echo ""
  echo "help    -  View this text"
  echo ""
  echo "lock     - Lock a file for changes (will leave the file unchanged)"
  echo "           ${0} lock <file>"
  echo ""
  echo "new      - add a new file; which includes the 'get' and 'header' actions"
  echo "           ${0} new <file>"
  echo ""
  echo "unlock   - Release a Lock from a file (will leave the file unchanged)"
  echo "           ${0} unlock <file>"
  echo ""
  echo "update   - Push changes to version control"
  echo "           ${0} update <file>"
  echo ""
  echo "version  - view revision history for a specific file"
  echo "ver      - synonym for 'version'"
  echo "           ${0} version <file>"
  echo "           ${0} ver <file>"
  echo ""
  echo "#########################################################"
}

_LOG() {
  ##Consider logging instead of just "echo"!
  if [ ! "${1}" = "" ]; then
    echo ${1}
  fi
}

_Success() {
  ##Log and report failures.
  ##${success} holds the greatest of any errors.
  if [ ${1} -eq 0 ]; then
    _LOG "${2} - ${3} Successful."
  else
    _LOG "${2} - Unexpected Error(${1}): ${3}."
    if [ ${success} -lt ${1} ]; then
      success=${1}
    fi
  fi
}

_Bulk() {
  ##Add/Update all files in the current directory into RCS.
  ### not 100% - issues around when the file is locked.
  message="Bulk update ${today}"
  description="Created via Bulk"
  for file in `find . -maxdepth 1 -newermt "${today}"`; do
    ##disrgared old errors
    success=0

    ##Does the file needs to added or (locked and) updated?
    if [ -f "${file}" ]; then
      _TestInputFile "${file}"
      if [ ${success} -eq 0 ]; then
        ##Use LOG to establish if the file already exists (and therefore needs to updated)
        ${RCS} log "${dirname}/${basename}" >> /dev/nul 2>>/dev/nul
        if [ ${?} -eq 0 ]; then
          _LOG "Processing: '${dirname}/${basename}' (update)"
          ## remember to lock the file before an update
          lock=-l
          _LOCK
          _UPDATE
        else
          ##If it's not an update, it needs to be added.
          _LOG "Processing: '${dirname}/${basename}' (new)"
          _NEW
          if [ ${success} -eq 0 ]; then
            lock=-u
            _CHECKOUT
          fi
        fi
      fi
    else
      ##RCS does not handle directories...
      _LOG "${file} is not a file (or was not found)."
    fi
  done
}

_CheckHeader() {
  ##Capture those files which shoud have variables but don't
  if [ ! "`grep \#\!/bin/ ${dirname}/${basename}`" ]; then
    _LOG "Consider adding '#!/bin/sh'"
  fi

  ##use ${dolar} to stop RCS from expanding them, mistaking them for it's own parameters!
  if [ ! "`grep \${dollar}Id ${dirname}/${basename}`" ]; then
   _LOG "Consider adding '${dollar}Id:${dollar}' and ${dollar}Source:${dollar}'"
  fi
}

_TestInputFile() {
  ##build the target directory based on in the input filename
  cd `${DIRNAME} ${1}`
  basename=`basename ${1}`
  dirname=${PWD}

  if [ ! -f "${dirname}/${basename}" ]; then
    _Success 9 "${dirname}/${basename}" "Input file not found"
  fi
}

_MKRCSDIR() {
  ##Create symlink for the RCS directory.
  ##Nb: to bypass this, simply manually create the RCS directory as required.
  if [ -d "${dirname}/RCS" ]; then
    _LOG "RCS subdirectory already exists."
  else

    ##Create the "tmp" direcory too
    if [ ! -d "${rcsdirtmp}" ]; then
      mkdir -p "${rcsdirtmp}"
    fi

    ##to use a local RCS direcory, simply create the directory first
    ##translate characters because the path will become the directory name
    rcsloc=`echo "${dirname}" | tr "/ " __`
    _LOG "Making RCS subdirectory - ${rcsloc}"
    mkdir -p "${rcsdir}/${rcsloc}"
    if [ ${?} -ne 0 ]; then
      _Success 9 "${rcsdir}/${rcsloc}" "Unable to create RCS directory"
    fi

    ##Create the symlink.
    ln -s "${rcsdir}/${rcsloc}" "${dirname}/RCS"
    if [ ${?} -ne 0 ]; then
      _Success 9 "${dirname}/RCS" "Failed to create SymLink"
    fi
  fi
}

_BackupSource() {
  #take a copy of the file before we start.
  #these are not required, but will save the file in the event of errors
  if [ "${backup}" = "" ]; then
    cp -f "${dirname}/${basename}" "${rcsdirtmp}/${basename}"
    _Success ${?} "${basename}" "Copied to 'tmp'"
    backup=no
  fi
}

_NEW() {
  ##Check that the RSC directory exists (or create it)
  _MKRCSDIR
  if [ ${success} -ne 0 ]; then
    _LOG "Failed to make RCS directory."
    exit 9
  fi

  ##Take a backup of the source file
  _BackupSource

  ##Add a new file (also called from _Bulk - which passes the message and description)
  if [ "${message}" = "" ]; then
    ${CI} -T -i -w${user} ${dirname}/${basename} 
  else
    ${CI} -T -i -w${user} -m"${message}" -t-"${description}" ${dirname}/${basename} 
  fi
  _Success ${?} ${basename} "Add to version control"
}

_LOCK() {
  ##Lock the file - required before updating the revision
  ${RCS} ${lock} ${dirname}/${basename}
  _Success ${?} ${basename} "Lock"
}
_UPDATE() {
  ##Take a backup of the source file
  _BackupSource

  ##Add a new file (also called from _Bulk - which passes the message and description)
  if [ "${message}" = "" ]; then
    ${CI} -T -u -w${user} ${dirname}/${basename} 
  else
    ${CI} -T -u -w${user} -m"${message}" -t-"${description}" ${dirname}/${basename} 
  fi
  _Success ${?} ${basename} "Update"
}

_CHECKOUT() {
  ##Get the latest revision.
  _BackupSource
  ${CO} -T -w${user} ${lock} ${dirname}/${basename}
  _Success ${?} ${basename} "Check out"
}

_VERSION() {
  ##display the revision details
  ${RLOG} -b ${dirname}/${basename}
}

_DIFF() {
  ##Display a difference between the file and latest revision
  ${RCSDIFF} ${dirname}/${basename}
}

#############################################

if [ "${RCS}" = "" ]; then
  echo "RCS doesn't appear to exist on this system!"
  exit 9
elif [ "${1}" = "help" ]; then
  _HELP
elif [ "${1}" = "bulk" ]; then
  _LOG ""
else
  _TestInputFile "${2}"
  if [ ${success} -ne 0 ]; then
    _LOG "Unable to process file '${2}'."
    exit 9
  fi
fi

#############################################

if [ "${1}" = "bulk" ]; then
  _Bulk
elif [ "${1}" = "header" ]; then
  _CheckHeader
elif [ "${1}" = "checkout" ]; then
  lock=-l
  _CHECKOUT
elif [ "${1}" = "diff" ]; then
  _DIFF
elif [ "${1}" = "get" ]; then
  lock=-u
  _CHECKOUT
elif [ "${1}" = "lock" ]; then
  lock=-l
  _LOCK
elif [ "${1}" = "new" ]; then
  _NEW
  if [ ${success} -eq 0 ]; then
    lock=-u
    _CHECKOUT
    _CheckHeader
  fi
elif [ "${1}" = "unlock" ]; then
  lock=-u
  _LOCK
elif [ "${1}" = "update" ]; then
  _UPDATE
elif [ "${1}" = "ver" ] || [ "${1}" = "version" ]; then
  _VERSION
fi

9
General Discussion / Version Control
« on: December 31, 2021, 06:42:28 pm »
Hello everybody,

I have just spent (AKA wasted :) ) today learning the basics of RCS. While I accept that it's extremely old, it did fit my use-case rather well.... But stretching my testing to other computers, I quickly found that it's not available in (standard) RHEL8 - so fear that's the start of it phased out of other distros.

My network consists of various computers, all of which have similar config files and custom scripts which I'm keen to version control.  Using RCS, I "had" created a central NFS stored directory, and used symlinks for the "RCS" directories (where it stores the version details) allowing me to easily include them within my backup process.
 
I guess I'm about to move to GIT - but does anybody else use GIT to version control O/S level config files, and have any tips on how to structure such a repository?  And/or how to pull/get changes to separate directories - like say I want to version control: "/etc/host", "/var/www/config.php" and /home/brian/my_script.sh (for examples) - for ALL my assets.

While I'm largely a single user I guess I'd have 1 repository per asset - but is that a fair assumption and is there anything I need to consider?

Thanks in advance...
Brian

10
Linux Support / Re: Login loop in Kali linux 2021.4
« on: December 28, 2021, 12:01:13 am »
Hi,

I don't use VNC myself - but what changes have you made to that config, and have you tried to revert those?

Perhaps it's best to enable SSH and confirm that works if only to avoid locking yourself out completely.

Could you kindly confirm that you're using the same account details for both VNC and at the machine itself (and whether that's root).

Finally, how did you create the VNC account - I seem to recall that VNC users don't always equate to local (/etc/passwd) users (that would explain why you can't login locally!).

Let us know.....





11
Hi,

You may like to have a read of a few of these - which are all using PIs with a EZO PH Sensor.
https://forums.raspberrypi.com/viewtopic.php?t=323824
https://www.raspberrylovers.com/2018/04/ph-meter-for-raspberry-pi.html
https://myhydropi.com/connecting-a-ph-sensor-to-a-raspberry-pi

Although as suggested before - if you require remote installation and battery dependency - I understand that Arduinos are "better", because they can be powered up to take a reading and powered down again, much better than a PI would - which will preserve any battery for longer.

Not my area, but as Keith says, procession instruments aren't always a good fit for domestic purposes, while they give greater accuracy/detail - they are often meant for laboratory environments that have control over other conditions that could influence the results. Not being able to control those factors may give poor results.  I don't know anything about these PH sensors, but just be aware of the risk when buying hardware of scientific quality.

I'm not sure I can input to your use case, requirements or setup either - but I'd be interested on how you get on.... 

Please remember to give your database some thought too, because regular reads could result in thousands of records being created per day - which quickly gets to millions. while I don't know the practical limitations of a MySQL table, "millions" is a lot of data! (do you require it all, and how will you ensure the database maintains the response time you expect?)

Best of luck.....

12
Hi,

I no longer use Wordpress either, so consider the below as a general rule, for applications which use MySQL/MariaDB as their default backend.

BEFORE YOU DO ANYTHING, backup your database and at least your config files (all files if you can too)!
I'LL ALSO RECOMMEND to test the backups; by creating a second database, and importing the database export, then modifying the config files and testing the results.  After all - even a good backup has very little value if you're unable to use it! :)

Essentially, you just want to remove everything and start again.......  your options are usually 1 of 2:

1) Because you may have added/created files, and those can cause unexpected problems in the future, the best options is likely to be removing everything and going through the installation process all over again (consider using a different installation and data directory, and a different database - which means you wont need to delete any of you old files) - and result in 2 separate environments, both running at the same time.

2) If you can't do that, then you will need to remove your data files and your config files, before going through the initial setup process again (while you may be able to reuse the same database name, I'd suggest using a different one - or deleting it first).  Most systems, will/should create a new database and all the necessary tables along with any initial data. This would give you a (single) fresh/new environment.

Installing manually is often discouraged by systems like Wordpress, because they perform validation during automated setup process, and that includes server details which Wordpress certainly requires. Therefore, while you may find the SQL on Github (or where ever) you may find it difficult to manually setup the data required).

Hope this helps....

13
oh! :(

All this chat got me thinking that I ought to update my own PI/GrovePI+ but ran into problems using the latest PI-OS-Lite.....  https://www.raspberrypi.com/software/operating-systems/

Please note the below which I've copied from the DexterInd. Forum

https://forum.dexterindustries.com/t/grove-pi-doesnt-work-do-not-use-raspbian-bullseye/8664
Quote
There have been several postings here where someone is trying to get a Grove-Pi/Grove-Pi+ working and it fails no matter what they try.

The eventual root cause of this failure is that the individual downloaded and installed Raspbian Bullseye.

It should be noted that the Dexter Industries libraries for the Grove-Pi are not yet compatible with Bullseye.

The solution is to flash your SD card with the Raspbian Buster image located here:
https://www.raspberrypi.com/software/operating-systems/#raspberry-pi-os-legacy

Then run the “curl” commands in the installation guide for the Grove-Pi.

If you are using a Pi-4, this version of Raspbian is mandatory as other, earlier, versions will not boot on the Raspberry Pi-4.

Edit:
Updated the link to point to the official download site for the “legacy” version of Raspbian.

14
OK - It does look like the Grove PH Sensor supports Arduino.... *YAY!*   

....But if you're looking at a RPI - Then this Hat allows you to connect a bundle of 12c and Analogue sensors (including motors to it) - super easy.
https://www.seeedstudio.com/GrovePi.html

While the new PI 4s sound sexy, I'd still recommend a 3b for this kind of thing. They are lower spec and therefore likely lower power requirements but also ~£35 rather than ~£100. Despite their modest hardware they are more than happy running MySQL and a HTTP server, etc...  Although if you're reading the sensor data regularly, you should consider external storage or writing the readings to an external database (and then quickly consider archiving and condensing historic data (storing weekly min/max/avgs rather than every single read (so similar)). Depending on the use case, you may also want to consider a UPS or I have used a standard battery-bank in the past.

The GrovePI software (via https://www.dexterindustries.com/grovepi/)  does run headless, but take a little more effort to setup and test, than using the GUI. But the wiki.seeedstudio.com website, contains good example code which you should be able to simply copy/paste to get you up and running quickly....

Oh... one word of warning when buying Grove sensors - keep an eye on the sensors you buy - because you only have a certain amount of 12c inputs and Analogue inputs - it was more blind luck that the 12 or so sensors which makes up my weather station worked out, and each could be connected :)

Running a Webserver on a RPI is easy enough - I tend to use LigHTTP which is available via APT.

Good Luck....

15
Hi,

While the below information may not be what you're after: it may not be a shortcut you'd like, and/or I'm not even sure if this Grove board works on  Arduino.... so the below may help helpful or way off the mark! :)

I've used Grove on a Raspberry before (GrovePI+ Hat) - and found them very easy to connect and equally easy to read using Python.

There also do a PH Sensor:
https://wiki.seeedstudio.com/Grove-PH_Sensor/

Feel free to ignore me, if I'm heading in the wrong direction :)

Pages: [1] 2 3 4

SimplePortal 2.3.3 © 2008-2010, SimplePortal