Tag: Linux

Linux installation on SSD

I am going to be installing a Linux desktop onto an SSD drive soon, and I have started to research. If you have done this already and found something you needed to do that was not documented, please drop me a line.

My aim is to setup my Intel i3 Mini-ITX system with a Linux Desktop install (Ubuntu probably) and eventually drop in some more storage, since the case and motherboard could handle 4 more SATA devices, not including the optical and SSD boot drive.

Figured I could end up running for additional storage, services and desktop environment for doing other tasks like maybe get VMware Workstation going so I can run my existing virtual machines.

The current duties it does that requires Windows will move onto a laptop I will purchase at the end of this month, or early next month.

Linux system hardening

I really need to sit down and do some research on Linux System Hardening, as I really want to take a look at any kernel hardening that can be done on the system. i.e. I don’t want users to be able to see who else is on the machine via the output of commands like ‘w’ and ‘who’. I remember grsecurity use to be available to do this, so I should look around to see if this is still valid or do we do it another one.

I did find the following web post about SSH hardening which I enjoyed reading here.

If you’ve done Linux System Hardening recently, chime in on the comments with your experience.

New PC laptop purchase

I was going to build up another mini-ITX desktop, however the more I look at it I am better off buying one of those Dell Outlet Inspirion laptops. As  I end up getting a PC that can be used as a desktop replacement and doesn’t need any more hardware purchased. i.e. keyboard/mouse/monitor. So I am monitoring the outlet site the past week watching what Intel i3 Third generation systems come up and the prices.

The PC laptop will probably run Windows 7 x64 Home (or Windows 8.1 if my work VPN finally ends up supporting it). While my existing mini-ITX desktop (i3/16gb ram) will probably be converted to a Ubuntu desktop, so I can implement lxc containers again and some other workload on it. Really want to get tvheadend setup on it and plug in the USB tuner I was using with my Raspberry Pi. Remember the post here, about that?

If I get some time this weekend one evening going to install a temporary hard disk into my desktop and do a Ubuntu 12.04.4 install and do some messing about to ensure the hardware all detects fine and resolution of monitors works fine. The system uses an Intel HD 4000 onboard, so I hope accelerated video works or that could be a problem.

Looking to purchase the laptop the end of this month or early next month.

Confluence 5.4.2 installation problem – Confluence not starting post install

This is not something I’ve hit before, however this is my first time installing Confluence 5.4.2 x32 on a Exigent VPS account. Post the installation, I got the message indicating that the service has started and you should connect to it to finish the configuration.

However, nothing was found to be running on the default port of 8090, so I checked the catalina.out file in the logs folder to determine what was written. It was showing the lines below;

Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

At this point I figured I needed to change the amount of memory being allocated to java during startup so I went looking to see where this was being set from. Turns out its in the setenv.sh file in the bin folder.

On the first line of the file, change the -Xmx512m to something a little smaller, if your running on a VPS that doesn’t have enough available memory to let it have 512Mb of ram. Save the change and fire it up via “start-confluence.sh” and it should load up fine.

EDIT: It’s safe to say that my low end VPS account cannot really run the Confluence install, as it failed to create the database in MySQL and put the box under serious load due to all memory being consumed, which subsequently pushed out the load average. See below;

top – 09:56:16 up 45 days, 16:50, 3 users, load average: 70.49, 37.55, 15.18
Tasks: 70 total, 3 running, 67 sleeping, 0 stopped, 0 zombie
Cpu(s): 12.1%us, 87.9%sy, 0.0%ni, 0.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 1048576k total, 1048576k used, 0k free, 0k buffers
Swap: 0k total, 0k used, 0k free, 0k cached

I gave it a go nonetheless :)

Confluence 5.4.2 x64 installation error

I was attempting an installation of Confluence 5.4.2 x64 from the binary file that can be executed and it failed like below;

root@hostname:/home/username# ./atlassian-confluence-5.4.2-x64.bin
Unpacking JRE …
Starting Installer …
./atlassian-confluence-5.4.2-x64.bin: 466: /home/username/atlassian-confluence-5.4.2-x64.bin.17671.dir/jre/bin/java: not found

I’ve seen this problem before with another product, so I knew immediately what the problem is. It’s due to executing the x64 version on a 32bit Linux.

Go download the 32bit version of the file and execute it. It will work.

Wifidog and Authpuppy

I’ve been trying to get Wifidog and Authpuppy going, however failed to get the end to end solution working.

I was able to get Wifidog installed and compiled. In addition to getting Authpuppy going, but getting them to work together is not working  for me.

I want to use a small pc with dual nics to connect to the local network (which gets out to internet) and the other nic connected to 1 or more Access Points.

The network with the Access Point doesn’t appear to have its traffic intercepted by Wifidog at all, and that’s the bit that I am stuck with currently.

Exigent VPS

I signed up for a Exigent VPS several weeks back and have been using it on and off. I loaded mine up with a configuration that would allow vhost mail hosting and webhosting. It ran fine, the bandwidth to the VPS itself seemed fine.

To be honest I have been very happy with the VPS service, so much so I recommended it to others. Since we signed up during an introduction of new hardware/services, we actually got a good sign up cost.

I don’t use mine currently, as I moved my services back to shared web hosting, but tempted to hang onto it for a bit longer as its good to have. Besides, if I get rid of it, I wont get another for the price I am paying at the moment.

If you need a VPS, check out Exigent.

Realtek RTL2838 DVB-T tuner on Raspberry Pi with TvHeadEnd success

I decided to give my DVB-T usb dongle (Realtek RTL2838) another go with the Raspberry Pi and TvHeadEnd. As I thought the newer version of Raspbian if available might address the condition I had previously where I had no dvb device after plugging it in. Older post found here.

It would appear it was a good to check this out again.

I downloaded the latest Raspbian available from the Raspberry Pi site. The version available at the time of this post is the one below;

2013-12-20-wheezy-raspbian.zip

I installed to an SD card and booted my Raspberry Pi.

I plugged in my Realtek RTL2838 tuner and it detected fine and when I checked for the dvb device structure, it was populated all correctly, which never happened previously at all.

[26848.628778] usb 1-1.3: new high-speed USB device number 6 using dwc_otg
[26848.741110] usb 1-1.3: New USB device found, idVendor=0bda, idProduct=2838
[26848.741147] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[26848.741166] usb 1-1.3: Product: RTL2838UHIDIR
[26848.741183] usb 1-1.3: Manufacturer: Realtek
[26848.741199] usb 1-1.3: SerialNumber: 00000001
[26848.851456] usb 1-1.3: dvb_usb_v2: found a 'Realtek RTL2832U reference design' in warm state
[26848.857238] usbcore: registered new interface driver dvb_usb_rtl28xxu
[26848.921368] usb 1-1.3: dvb_usb_v2: will pass the complete MPEG2 transport stream to the software demuxer
[26848.921447] DVB: registering new adapter (Realtek RTL2832U reference design)
[26848.965698] usb 1-1.3: DVB: registering adapter 0 frontend 0 (Realtek RTL2832 (DVB-T))...
[26849.001551] r820t 0-001a: creating new instance
[26849.014447] r820t 0-001a: Rafael Micro r820t successfully identified
[26849.021655] Registered IR keymap rc-empty
[26849.022183] input: Realtek RTL2832U reference design as /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/rc/rc0/input0
[26849.022231] rc0: Realtek RTL2832U reference design as /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/rc/rc0
[26849.022262] usb 1-1.3: dvb_usb_v2: schedule remote query interval to 400 msecs
[26849.035148] usb 1-1.3: dvb_usb_v2: 'Realtek RTL2832U reference design' successfully initialized and connected

And device files

root@raspberrypi:~# ls -la /dev/dvb
total 0
drwxr-xr-x  3 root root   60 Jan  1 14:51 .
drwxr-xr-x 13 root root 3080 Jan  1 14:51 ..
drwxr-xr-x  2 root root  120 Jan  1 14:51 adapter0
root@raspberrypi:~# ls -la /dev/dvb/adapter0/
total 0
drwxr-xr-x 2 root root     120 Jan  1 14:51 .
drwxr-xr-x 3 root root      60 Jan  1 14:51 ..
crw-rw---T 1 root video 212, 4 Jan  1 14:51 demux0
crw-rw---T 1 root video 212, 5 Jan  1 14:51 dvr0
crw-rw---T 1 root video 212, 3 Jan  1 14:51 frontend0
crw-rw---T 1 root video 212, 7 Jan  1 14:51 net0

Next I configured other tools before compiling and installing the TvHeadEnd per the steps below;

sudo apt-get install unzip libcurl4-openssl-dev pkg-config git build-essential dvb-apps

cd ~
git clone https://github.com/tvheadend/tvheadend
cd tvheadend
./configure
make
sudo make install

At which point I executed the binary via “tvheadend -C” and I could now access the web interface for the TvHeadEnd software via http://raspberrypi_ip:9981/ where I could now see my dvb tuner was detected.

At this point you now have to configure the network and channels according to your region. Can be a bit tricky, but I followed the info available at the post here (step 14). This helped me make sense of the sequence of actions.

Below is a screen grab showing VideoLan Client from my Windows 7 desktop and a web browser in the background attached to the TvHeadEnd which is running on the Raspberry Pi with the RTL2838 tuner.

tvheadend_rtl2838_rpi_vlc

 

EDIT: And to get my TvHeadEnd to auto start with boot I performed the following additional steps.

Created /etc/init.d/tvheadend file with the contents below;

#!/bin/bash
### BEGIN INIT INFO
# Provides: tvheadend
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs $remote_fs $network
# Should-Start: $syslog
# Should-Stop: $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1
# Short-Description: start/stop tvheadend Server
### END INIT INFO

TVHNAME="tvheadend"
TVHBIN="/usr/local/bin/tvheadend"
TVHUSER="tvheadend"
TVHGROUP="tvheadend"
PIDFILE=/var/run/$TVHNAME.pid

start() {
if [ -e $PIDFILE ]; then
PID=$(ps ax | grep -v grep | grep -w $(cat $PIDFILE) | awk '{print $1}')
if [ -n "$PID" ]; then
echo "$TVHNAME already running (pid $PID)."
exit 1
fi
fi
echo -n "Starting tvheadend: "
start-stop-daemon --start --background --pidfile $PIDFILE --make-pidfile --user ${TVHUSER} --exec ${TVHBIN} -- 
-u ${TVHUSER} -g ${TVHGROUP} -f -C
echo "Done."
}

stop() {
if [ -e $PIDFILE ]; then
PID=$(ps ax | grep -v grep | grep -w $(cat $PIDFILE) | awk '{print $1}')
if [ -n "$PID" ]; then
echo -n "Stopping $TVHNAME: "
start-stop-daemon --stop --quiet --pidfile $PIDFILE --name ${TVHNAME}
echo "Done."
else
echo "$TVHNAME is not running."
fi
else
echo "$TVHNAME is not running."
fi
}

status() {
if [ -e $PIDFILE ]; then
PID=$(ps ax | grep -v grep | grep -w $(cat $PIDFILE) | awk '{print $1}')
if [ -n "$PID" ]; then
echo "$TVHNAME is running (pid $PID)."
else
echo "$TVHNAME is not running."
[ -e $PIDFILE ] && exit 1 || exit 3
fi
fi
}

case "$1" in
start) start ;;
stop) stop ;;
restart) stop && sleep 2 && start ;;
*) echo "Usage: $0 [start|stop|restart|status]" && exit 1 ;;
esac

exit 0

Now set the script as executable using below;

sudo chmod 755 /etc/init.d/tvheadend

Create a tvheadend group

sudo groupadd tvheadend

Create a tvheadend user that is part of the video group and tvheadend group.

sudo useradd -g tvheadend -G video -m tvheadend

And now set the initscript tvheadend to startup and shutdown as system does

sudo update-rc.d tvheadend defaults

Raspberry Pi and Xbox 360 camera as a Webcam

Have wanted to configure an Xbox 360 camera as a Webcam on a Raspberry Pi. I’ve simple followed the post here.

I wasn’t interested in having the camera capture images with motion, as I want to act more like a traditional webcam that captures an image every set interval. To perform that task you just need to enable the option below in the motion.conf (/etc/motion/motion.conf) and you can test it by running “motion -n” as root (or via sudo).

# Make automated snapshot every N seconds (default: 0 = disabled)
snapshot_interval 120

With the interval set below it will create a file every 120 seconds. You’ll also get a lastsnap.jpg symlink which links to the last/latest capture.

I modified the configuration to also append some text to the webcam capture and overlay it on the picture. A demo of what I captured is below and how it looks.

01-20140101005600-snapshot

Raspberry Pi with RTL8188CUS 802.11n wifi adapter – Update

I’ve actually been playing around with my Realtek RTL8188CUS wifi adapter and found that the configuration of the wifi adapter without wpa_supplicant seems to be a better way to go.

The information I found below was taken directly from the source Far Robotics Website. Thanks to those folks for posting the 3 methods below;

Installing rtl8188cus and rtl8188eu based wifi adaptors for raspbian without using wpa_supplicant.

Edit the file /etc/network/interfaces using the following format for networks with WPA/WPA2 security. Use the command sudo nano /etc/network/interfaces to open and edit the file. Exit the editor and save the file using keys cntl-X, Y, Enter.  Enclose Your-Network-Name and Your-Network-Password within quotation marks as in the example below.

auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-ssid "Your-Network-Name"
wpa-psk "Your-Network-Password"

Edit the file /etc/network/interfaces using the following format for networks using WEP security. Use the command sudo nano /etc/network/interfaces to open and edit the file. Exit the editor and save the file using keys cntl-X, Y, Enter. Do not use quotation marks around Your-Network-Name and Your-Network-Password.

auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet dhcp
wireless-essid Your-Network-Name
wireless-key Your-Network-Password

Edit the file /etc/network/interfaces using the following format for networks using no security. Use the  command sudo nano /etc/network/interfaces to open and edit the file. Exit the editor and save the file using keys cntl-X, Y, Enter. Do not use quotation marks around Your-Network-Name.

auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet dhcp
wireless-essid Your-Network-Name

If you have success and/or failure, be sure to post a comment. Feedback is always most welcome.