Sep 272017
 

I wrote a little snippet to update my PXE server’s Debian netboot image so I can schedule this to run every month or so to ensure that my Netboot image is up to date.

The variables are to set the Debian mirror, architecture, and paths and filenames for the downloaded image file, and where the image file should be un-tarred to.
I have architecture in there because I had some old machines which require i386 kernels. If you don’t need i386, then you can replace all the arch variables and hardcode amd64 instead.

#!/bin/bash
debmirror=http://mirror.internode.on.net/pub/debian
arch=amd64
tmpfile=/tmp/$arch-netboot.tar.gz
tftppath=/srv/tftp/deb-stable/$arch
wget $debmirror/dists/stable/main/installer-$arch/current/images/netboot/netboot.tar.gz -O $tmppath
tar -C $tftppath -xzf $tmpfile ./debian-installer/amd64/initrd.gz ./debian-installer/amd64/linux --strip-components=3

Share
Mar 082016
 

This post is more of a note to myself on how to install the proprietary nVidia drivers on a fresh Debian install as I keep forgetting which packages I need!

After recently reinstalling Jessie onto a computer with an older Geforce card, I had to install an older version of the drivers (340.96).

From a fresh install, I needed to install the following packages:

gcc
make
linux-headers-3.16.0-4-amd64

# apt-get install gcc make linux-headers-3.16.0-4-amd64

The kernel version above will change as time goes on, so you can substitute the version number with $(uname -r) – e.g. apt-get install linux-headers-$(uname -r)

Once the packages are installed, you need to make sure the gcc version that your kernel was compiled with matches your current compiler.
You can find out what version your kernel was compiled with by checking the contents of /proc/version
# cat /proc/version
Linux version 3.16.0-4-amd64 (debian-kernel@lists.debian.org) (gcc version 4.8.4 (Debian 4.8.4-1) ) #1 SMP Debian 3.16.7-ckt20-1+deb8u4 (2016-02-29)

In my case, my kernel was compiled with gcc-4.8, so I had to also install gcc-4.8.
# apt-get install gcc-4.8

Once the compiler was installed, I also need to set the CC environment variable so that the correct compiler is used to compile the nVidia driver.
# export CC=gcc-4.8

Now that everything is setup, I can run the nVidia installer to install the drivers.

Share
Mar 112012
 

Recently I had some issues with my free DNS service, it wasn’t updating my DNS so I couldn’t access my server remotely.
After this happened a few times, I decided to modify one of the configuration files so that it would email me my external IP address each time the PPP connection came up. This ensured that I would get the latest IP address emailed to me ASAP.

What You Will Need :

Sendmail or equivalent on the linux box that you doing this on.
The PPP connection needs to be on the linux box also for this tutorial, however I will write up a guide that uses an external website instead later on.
A commandline mail sending program, I have used mailx in this example, which is symlinked to mail.

How To Do It :

To do this, I added a file in this directory ( on my Debian System ) –

/etc/ppp/ip-up.d/

which I have named “EmailIP”.
Scripts in this directory are run when the ppp connection goes up.

The file contains the following line which does the gruntwork

echo Connection has come up - New IP Address : `ifconfig ppp0 | grep inet | awk -F' ' '{ print $2 }'|awk -F: '{print $2}'` | /usr/bin/mail -r <From@example.com> -s IP-Address <Email@example.com>

What that command does is pipe the text “New IP Address : ” followed by the output of ifconfig ppp0 which is then grepped down to the inet line, and then awked down to the actual IP address and pipe it into the mail command which can send an email via sendmail or whatever mail daemon you have installed.
The sendmail command has the following parameters specified –
-r : specifies the address that the email appears to be coming from (From@example.com in the example)
-s : specifies the subject of the email (IP-Address in the example)
Email Address (Email@example.com in the example)

Then once you have the script in place, when the ppp connection goes down then comes back up, you should get an email to the email address you specified with the text “Connection has come up – New IP Address : <Your New IP Address>

Share
Jul 192011
 

Hi All, just a quick update today.

I was trying to get NFS working today but kept running into errors.
Whenever I tried to start imapd, I would keep getting this error –

rpc.idmapd[12599]: main: fcntl(/var/lib/nfs/rpc_pipefs/nfs): Invalid argument

Turns out, I didn’t have dnotify support enabled in the kernel.
Enabling this now, and will be testing very soon.

Just a quick tip for anyone coming across this issue !

Cheers all.

Share
Jun 232011
 

Hi All,

I’ve been working on fitting a webcam streaming server on a thin client.

Using Debian, I managed to get the base distribution down to 150 megabytes with my own kernel and stripping out unwanted packages like aptitude, logrotate, vim, and the default kernel with all of it’s modules.

After installing ffmpeg and openssh server, the distribution was brought to just under 200 megabytes.

Once I have the kernel installed and detecting my webcam, I can use ffmpeg and ffserver to stream video from the webcam to my network.

I created this ffserv.conf file in my root home directory –


Port 81
BindAddress 0.0.0.0
MaxClients 10
MaxBandwidth 50000
NoDaemon

<Feed webcam.ffm>
file /tmp/webam.ffm
FileMaxSize 10M
</Feed>

<Stream webcam.mjpeg>
Feed webcam.ffm
Format mjpeg
VideoSize qvga
VideoFrameRate 10
VideoBitRate 100
</Stream>

That conf file will setup the parameters, and stream settings for ffserver to use when it starts streaming.

The first stanza sets up the port that the server will listen on, and the address.
The other 3 lines are self explanatory.

The Feed stanza is just defining the feed name and file it will use, while the stream stanza sets up the stream.

I am using mjpeg format as it’s light on the CPU but you can use other formats like FLV or ASF.

Once the config file has been created, you can use this command to start the streaming server.


ffserver -f /root/ffserv.conf & ffmpeg -v verbose -r 5 -s 320x240 -f video4linux2 -i /dev/video0 http://localhost:81/webcam.ffm

That command with start ffserver with the parameters in /root/ffserv.conf, and then start ffmpeg with a verbosity level of verbose, a default frame rate of 5, a size of 320×240, format of video4linux2, and an input device of /dev/video0, streaming it to http://localhost:81/webcam.ffm.

If you want to add audio to the stream, add the parameters –

-f oss -i /dev/dsp

Once the server has started streaming, you should be able to open the stream with a browser if the webcam is being streamed via mjpeg using the address of http://yourwebcamserver:81/webcam.mjpeg – replacing ‘yourwebcamserver’ with the IP address of the server hosting the stream.

You can also use a player like VLC to open a FLV or ASF stream.

Any questions of feedback ?
Please leave me a comment 🙂

Share