Apr 272012
 

Hey Everyone,

There is a chance that my blog will go down between now and the 1st of May…I’m getting enough visitors to start hitting the monthly bandwidth limit for my webhost. If it does go down, it will be back up by the 1st of May and receiving visitors again 🙂

Just a heads up for any dedicated readers.

Share
Apr 262012
 

I have created an updated version here

I’ve created an update of the Raspberry Pi Memory Split Selector Script that has been cleaned up a bit and functions a bit differently.
The new script can detect the current memory that the system is showing, as well as determining which file has been activated.
Changing the active split will result in the script removing start.elf and copying the relevant elf file to start.elf to enable the new RAM split.
Once again, feedback is most welcome either in this post or in this thread.

The script can be downloaded from here.

Update – a new version has been created from some feedback on the forums, Get it here

Below is the code –

#!/bin/bash
##
## Raspberry Pi Memory Split Selector Script v2
## Author: SirLagz
## Website: http://sirlagz.net
##
## The purpose of this script is to make selecting the memory split
## on the RPi easy.
## Simply make this script executable if it's not already, move
## it to the directory with the elf files, and run it with ./select2.sh
## The menu should be pretty self explanatory.
##
clear
list=./*
b128det=0
b192det=0
b224det=0
bdefdet=0

for i in $list
do
case $i in
"./arm128_start.elf") b128det=1;;
"./arm192_start.elf") b192det=1;;
"./arm224_start.elf") b224det=1;;
"./start.elf") bdefdet=1;;
esac
done

if [[ "$bdefdet" -eq 0 ]] ; then
cp arm192_start.elf start.elf
current=192
fi

if [[ "$b192det" == "$bdefdet" ]] ; then
diffresult=`diff arm192_start.elf start.elf`
if [[ -z $diffresult ]] ; then
current=192
fi
fi

if [[ "$b128det" == "$bdefdet" ]] ; then
diffresult=`diff arm128_start.elf start.elf`
if [[ -z $diffresult ]] ; then
current=128
fi
fi

if [[ "$b224det" == "$bdefdet" ]] ; then
diffresult=`diff arm224_start.elf start.elf`
if [[ -z $diffresult ]] ; then
current=224
fi
fi

declare -i vram
vram=256-$current
sysram=`cat /proc/meminfo | grep MemTotal | awk -F\ '{ printf("%.0f",$2/1024) }'`
echo "##################################"
echo "## Raspberry Pi Memory ##"
echo "## Selector Script ##"
echo "##################################"
echo " Current Memory Split"
echo " CPU $current/$vram VRAM"
echo " Detected System RAM"
echo " $sysram MB"
echo "##################################"
case $current in
128)
echo "1) Set CPU/VRAM split to 192/64"
echo "2) Set CPU/VRAM split to 224/32"
echo "3) Quit"
;;
192)
echo "1) Set CPU/VRAM split to 128/128"
echo "2) Set CPU/VRAM split to 224/32"
echo "3) Quit"
;;
224)
echo "1) Set CPU/VRAM split to 128/128"
echo "2) Set CPU/VRAM split to 192/64"
echo "3) Quit"
;;
*)
echo "Invalid memory detected"
;;
esac
echo "Enter Choice:";
read x

case $x in
1)
case $current in
128)
rm start.elf && cp arm192_start.elf start.elf
;;
192)
rm start.elf && cp arm128_start.elf start.elf
;;
224)
rm start.elf && cp arm128_start.elf start.elf
;;
*)
echo "Invalid memory detected"
;;
esac
;;
2)
case $current in
128)
rm start.elf && cp arm224_start.elf start.elf
;;
192)
rm start.elf && cp arm224_start.elf start.elf
;;
224)
rm start.elf && cp arm192_start.elf start.elf
;;
*)
echo "Invalid memory detected"
;;
esac
;;
3) exit 0;;
esac
if [[ $? -ne 0 ]]; then
echo "Memory Split setting failed"
fi

Share
Apr 202012
 

Update – a newer version has been created here.

With the recent release of the Raspberry Pi, a computer designed to make coding and programming easy, fun, and accessible to children of all ages, there has been some discussion on how to change the memory split between the GPU and CPU.
I have come up with a script to make changing the split easy for all the future programmers who aren’t quite comfortable doing it themselves. I’m not a great coder so if you spot any flaws in this please shout out.

You can download the bash script here.
Feedbask is most welcome as I’m looking to improve the script.

Below is the code for the script itself if you want to copy / paste it instead.
If anyone has any suggestions for the script itself or would like some more options, feel free to express yourself in either the comments section on this port or in this thread


#!/bin/bash
##
## Raspberry Pi Memory Split Selector Script
## Author: SirLagz
## Website: http://sirlagz.net
##
## The purpose of this script is to make selecting the memory split
## on the RPi easy.
## Simply make this script executable if it's not already, move
## it to the directory with the elf files, and run it with ./select.sh
## The menu should be pretty self explanatory.
##
clear
list=./*
b128det=0
b192det=0
b224det=0
bdefdet=0

for i in $list
do
case $i in
"./arm128_start.elf") b128det=1;;
"./arm192_start.elf") b192det=1;;
"./arm224_start.elf") b224det=1;;
"./start.elf") bdefdet=1;;
esac
done

if [[ "$b192det" == "$bdefdet" ]] ; then
diffresult=`diff arm192_start.elf start.elf`
if [[ -z $diffresult ]] ; then
mv arm192_start.elf arm192_start.old.elf
b192det=0
fi
fi

if [[ "$b128det" == "$bdefdet" ]] ; then
diffresult=`diff arm128_start.elf start.elf`
if [[ -z $diffresult ]] ; then
mv arm128_start.elf arm128_start.old.elf
b128det=0
fi
fi

if [[ "$b224det" == "$bdefdet" ]] ; then
diffresult=`diff arm224_start.elf start.elf`
if [[ -z $diffresult ]] ; then
mv arm224_start.elf arm224_start.old.elf
b224det=0
fi
fi

if [[ "$b128det" == 0 ]] ; then
current=128
elif [[ "$b192det" == 0 ]] ; then
current=192
elif [[ "$b224det" == 0 ]] ; then
current=224
fi

declare -i vram
vram=256-$current

echo "##################################"
echo "## Raspberry Pi Memory ##"
echo "## Selector Script ##"
echo "##################################"
echo " Current Memory Split"
echo " CPU $current/$vram VRAM"
echo "##################################"
case $current in
128)
echo "1) Set CPU/VRAM split to 192/64"
echo "2) Set CPU/VRAM split to 224/32"
echo "3) Quit"
;;
192)
echo "1) Set CPU/VRAM split to 128/128"
echo "2) Set CPU/VRAM split to 224/32"
echo "3) Quit"
;;
224)
echo "1) Set CPU/VRAM split to 128/128"
echo "2) Set CPU/VRAM split to 192/64"
echo "3) Quit"
;;
*)
echo "Invalid memory detected"
;;
esac
echo "Enter Choice:";
read x

case $x in
1)
case $current in
128)
mv start.elf arm128_start.elf && mv arm192_start.elf start.elf
;;
192)
mv start.elf arm192_start.elf && mv arm128_start.elf start.elf
;;
224)
mv start.elf arm224_start.elf && mv arm128_start.elf start.elf
;;
*)
echo "Invalid memory detected"
;;
esac
;;
2)
case $current in
128)
mv start.elf arm128_start.elf && mv arm224_start.elf start.elf
;;
192)
mv start.elf arm192_start.elf && mv arm224_start.elf start.elf
;;
224)
mv start.elf arm224_start.elf && mv arm192_start.elf start.elf
;;
*)
echo "Invalid memory detected"
;;
esac
;;
3) exit 0;;
esac
if [[ $? -ne 0 ]]; then
echo "Memory Split setting failed"
fi

Share
Apr 152012
 

I’ve got Simple Log File Monitor in my environment monitoring the /var/log/auth.log log file at the moment, using default settings, which is quoted below –

AppName=AuthLog,AppLogFile=/var/log/auth.log,AppMarkText===MARK==,AppMarkFile=0,AppProcess=grep "Accepted password",AppAction=mail -s "Access Logs" <EMAIL>

I have replaced the in the default config with my own email address.

The first time the script ran, it emailed this to my email address

Apr 8 21:41:18 server sshd[7726]: Accepted password for user from 10.1.1.150 port 46582 ssh2
Apr 8 21:45:39 server sshd[7825]: Accepted password for user from 10.1.1.150 port 46593 ssh2
Apr 8 21:49:07 server sshd[7936]: Accepted password for user from 10.1.1.150 port 46596 ssh2
Apr 8 21:49:21 server sshd[7940]: Accepted password for user from 10.1.1.150 port 46597 ssh2
Apr 10 10:44:22 server sshd[24150]: Accepted password for user from 2.151.180.140 port 53894 ssh2
Apr 10 10:55:51 server sshd[24615]: Accepted password for root from 124.73.163.174 port 50267 ssh2
Apr 10 21:30:50 server sshd[30071]: Accepted password for user from 10.1.1.150 port 44807 ssh2
Apr 10 21:51:46 server sshd[30272]: Accepted password for root from 10.1.1.150 port 45046 ssh2
Apr 10 23:36:26 server sshd[31043]: Accepted password for user from 10.1.1.150 port 46084 ssh2
Apr 11 21:31:12 server sshd[22030]: Accepted password for user from 10.1.1.150 port 52350 ssh2
Apr 11 22:40:57 server sshd[22779]: Accepted password for user from 10.1.1.150 port 52521 ssh2
Apr 12 09:13:26 server sshd[29172]: Accepted password for root from 124.73.163.174 port 60181 ssh2
Apr 12 09:37:35 server sshd[29546]: Accepted password for user from 2.151.180.140 port 53802 ssh2
Apr 12 22:44:10 server sshd[4718]: Accepted password for user from 10.1.1.150 port 33128 ssh2
Apr 12 23:17:09 server sshd[5111]: Accepted password for user from 10.1.1.150 port 33552 ssh2
Apr 12 23:18:12 server sshd[5115]: Accepted password for user from 10.1.1.150 port 33554 ssh2
Apr 12 23:19:18 server sshd[5119]: Accepted password for user from 10.1.1.150 port 33556 ssh2
Apr 13 01:42:51 server sshd[15465]: Accepted password for user from 10.1.1.150 port 34823 ssh2
Apr 13 23:11:39 server sshd[28603]: Accepted password for user from 10.1.1.150 port 45111 ssh2
Apr 13 23:22:13 server sshd[28769]: Accepted password for user from 10.1.1.150 port 45505 ssh2
Apr 13 23:24:16 server sshd[28925]: Accepted password for user from 10.1.1.150 port 45517 ssh2
Apr 13 23:28:24 server sshd[29199]: Accepted password for user from 10.1.1.150 port 45561 ssh2
Apr 13 23:43:37 server sshd[29436]: Accepted password for user from 10.1.1.150 port 45628 ssh2
Apr 14 00:02:36 server sshd[30422]: Accepted password for user from 10.1.1.228 port 35761 ssh2

This should be the expected output from the script with the default settings.

This has been scheduled to run every hour via crontab, and will email me the authentication successes for the past hour each and every hour, though this can be modified via crontab.
The script can be modified to not send if there’s nothing to report, but at the moment I have not made that configurable as of yet. It will be done for a later version.
The default configuration file variable also has to be changed if you intend to run the script without the -c switch to set the path of the configuration variable.

Share
Apr 152012
 

I recently had some issues trying to access Cacti on my server.
After some messing around, I had to remove all the access configuration to get it going, I added the ones I needed back in to get it going.

I wanted to lock down some access to cacti from the external intarwebs, so had a few extra rules that caused some issues.

I had the following in the config file

Alias /cacti /usr/share/cacti/site


Options +FollowSymLinks
AllowOverride None
order deny,allow
allow from 10.1.1.0/24
deny from all

I had to comment out the lines, restart apache, then re-add them one by one restarting apache after each addition just to make sure it works.


Alias /cacti /usr/share/cacti/site


Options +FollowSymLinks
# AllowOverride None
# order deny,allow
# allow from 10.1.1.0/24
# deny from all

Share