Category: Ubuntu

Compiling R1Soft Backup Agent on Ubuntu 16.x or 14.x

** UPDATE FOR UBUNTU 16.X **

it’s a little different with these versions of ubuntu, you can follow the instructions below, but when it comes time to updating your grub config, do this instead.

# grep menuentry /boot/grub/grub.cfg

Which, will output all the kernels, which now you just have to ‘count’ the entries, so for example

if [ x"${feature_menuentry_id}" = xy ]; then
 menuentry_id_option="--id"
 menuentry_id_option=""
export menuentry_id_option
menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-8e6c4ba1-8970-4c10-8245-ff967b14dad5' {
submenu 'Advanced options for Ubuntu' $menuentry_id_option 'gnulinux-advanced-8e6c4ba1-8970-4c10-8245-ff967b14dad5' {
 menuentry 'Ubuntu, with Linux 4.4.0-62-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-62-generic-advanced-8e6c4ba1-8970-4c10-8245-ff967b14dad5' {
 menuentry 'Ubuntu, with Linux 4.4.0-62-generic (upstart)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-62-generic-init-upstart-8e6c4ba1-8970-4c10-8245-ff967b14dad5' {
 menuentry 'Ubuntu, with Linux 4.4.0-62-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-62-generic-recovery-8e6c4ba1-8970-4c10-8245-ff967b14dad5' {
 menuentry 'Ubuntu, with Linux 4.4.0-59-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-59-generic-advanced-8e6c4ba1-8970-4c10-8245-ff967b14dad5' {
 menuentry 'Ubuntu, with Linux 4.4.0-59-generic (upstart)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-59-generic-init-upstart-8e6c4ba1-8970-4c10-8245-ff967b14dad5' {
 menuentry 'Ubuntu, with Linux 4.4.0-59-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-59-generic-recovery-8e6c4ba1-8970-4c10-8245-ff967b14dad5' {
 menuentry 'Ubuntu, with Linux 3.16.0-69-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.16.0-69-generic-advanced-8e6c4ba1-8970-4c10-8245-ff967b14dad5' {
 menuentry 'Ubuntu, with Linux 3.16.0-69-generic (upstart)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.16.0-69-generic-init-upstart-8e6c4ba1-8970-4c10-8245-ff967b14dad5' {
 menuentry 'Ubuntu, with Linux 3.16.0-69-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.16.0-69-generic-recovery-8e6c4ba1-8970-4c10-8245-ff967b14dad5' {
menuentry 'Memory test (memtest86+)' {
menuentry 'Memory test (memtest86+, serial console 115200)' {

Now, you just need to ‘count’ the entries, so for us we want to ‘downgrade’ to kernel 3.16.0.69-generic, which, starting at 0, makes it be 7, on the advanced menu.

Because we have a sub menu to deal with, we’ll have to execute this command;

# sudo grub-set-default "1>7"

Which is telling it to use the 7th option, on the 1st option (the submenu for advanced). Now you just run update-grub, and reboot.

# sudo update-grub

Old article below:

If, like us, you use R1Soft backups, you may have recently encountered an error trying to get it to compile on your Ubuntu 14.x or 16.x machines.

This is because they are nearly a year out of date on compiling for the latest kernels, the newest one currently supported is actually 3.16, so, the agent will fail on anything newer than that. You can view all the available module versions from the R1soft repository, by clicking here.

Their support is basically useless [unless you pay], so, we had to find our own solution.

This isn’t the most elegant way to fix things, but, it works, so there’s that. [I guess]. Basically, 16.x comes with kernel 4.4, which won’t work, so what did we end up having to do? Downgrade the kernel!  

Well, not literally downgrade, we just used the older, supported kernel that was already installed.

To make this work for you, you’ll have to edit the grub configuration, by doing this.

# cp /etc/default/grub /etc/default/grub.bak

# nano /etc/default/grub

and make these changes

GRUB_DEFAULT=saved 
GRUB_TIMEOUT=2

then exit and save the file.

Now, we’re going to have to find out which kernels you have installed, for us, we simply did the following;

# grep menuentry /boot/grub/grub.cfg

Which, will give you output similar to the following;

menuentry 'Ubuntu, with Linux 4.4.0-31-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-31-generic-advanced-64f733aa-c9fe-4aed-b662-8fd6b99d6825' {
menuentry 'Ubuntu, with Linux 4.4.0-31-generic (upstart)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-31-generic-init-upstart-64f733aa-c9fe-4aed-b662-8fd6b99d6825' {
menuentry 'Ubuntu, with Linux 4.4.0-31-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-31-generic-recovery-64f733aa-c9fe-4aed-b662-8fd6b99d6825' {
menuentry 'Ubuntu, with Linux 3.16.0-77-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.16.0-77-generic-advanced-64f733aa-c9fe-4aed-b662-8fd6b99d6825' {
menuentry 'Ubuntu, with Linux 3.16.0-77-generic (upstart)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.16.0-77-generic-init-upstart-64f733aa-c9fe-4aed-b662-8fd6b99d6825' {
menuentry 'Ubuntu, with Linux 3.16.0-77-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.16.0-77-generic-recovery-64f733aa-c9fe-4aed-b662-8fd6b99d6825' {

In our case, we want to use the 3.16.0.77 version of the kernel, so, we simply issue these commands;

# grub-set-default "gnulinux-advanced-64f733aa-c9fe-4aed-b662-8fd6b99d6825>gnulinux-3.16.0-77-generic-advanced-64f733aa-c9fe-4aed-b662-8fd6b99d6825"
# grub-reboot "gnulinux-advanced-64f733aa-c9fe-4aed-b662-8fd6b99d6825>gnulinux-3.16.0-77-generic-advanced-64f733aa-c9fe-4aed-b662-8fd6b99d6825"
# update-grub

then, you’re ready to reboot into your shiny old kernel

# reboot

now, you can verify that the R1Soft agent is working again, using this;

# hcp -v

Idera Hot Copy 5.14.4 build 433 (http://www.r1soft.com)
Documentation http://wiki.r1soft.com
Forums http://forum.r1soft.com

Thank you for using Hot Copy!
Idera makes the only Continuous Data Protection software for Linux.

hcp driver module: 4.6.1 build: 41

and

# /usr/sbin/r1soft/bin/cdp -v
(R1Soft CDP Agent) version 5.14.4 build 433 2016/07/18 16:41:16

That’s it! you’ve got working backups again!

 

Setup Auto Updating Apt-get Update/Upgrade with Logging

Here’s some quick steps on how to setup automatic apt-get upgrade and apt-get update on your ubuntu server, with the capability of logging and sending someone of your choosing a notification of the updates and what the output was.

I pieced this together from various sources around the web into a step by step quick tutorial both for myself, and others to use to make it easier when wanting to set this up across servers.

It’s a pretty handy addition to any administration tool kit as it cuts down on time ssh’ing in and manually running this, and is especially useful because it’s got logging so you only have to login if there was an issue!

** nb assumes a proper postfix / default setup.

INSTRUCTIONS

** nb assumes a proper postfix / default setup.

1) SSH to server

2) login / su to root

3) issue these commands:

# nano /root/autoupd

4) paste these items in

#!/bin/bash
tmpfile=$(mktemp)
hostname=$(hostname)
ourtime=`date +"%m-%d-%y"`
echo "APT UPDATE RESULTS:" >> ${tmpfile}
echo "*---*" >> ${tmpfile}
aptitude update >> ${tmpfile} 2>&1
echo "" >> ${tmpfile}
echo "APT UPGRADE RESULTS:" >> ${tmpfile}
echo "*---*" >> ${tmpfile}
aptitude -y full-upgrade >> ${tmpfile} 2>&1
echo "" >> ${tmpfile}
echo "APT CLEAN RESULTS:" >> ${tmpfile}
echo "*---*" >> ${tmpfile}
aptitude clean >> ${tmpfile} 2>&1
mail -s "[${ourtime}] - [${hostname} patches]" root < ${tmpfile}
rm -f ${tmpfile}

5) issue this for your aliases file

# nano /etc/aliases

6) make sure this exists:

root: mail@yourdomain.com

replacing with your proper email address, obviously.

7) run newaliases to ensure functionality

# newaliases

8) restart postfix

# service postfix restart

9) test the script

# chmod +x /root/autoupd
# /root/autoupd

10) you should now have an email in your inbox with the results, if not grab a coffee and start troubleshooting.

11) now you want to make this run daily by copying it to your daily cron directory and make it executable again, just incase something changed.

# cp /root/autoupd /etc/cron.daily/autoupd
# chmod +x /etc/cron.daily/autoupd

12) that’s it, wait for the email notifications!

Installing Custom Themes with Trac 10.x. Beautify your Development and set yourself Apart.

Ever wanted to install a new theme to your TRAC installation? Often we’ll want our development environments to look a little different from every other trac site on the Internet. We’d never tried to change the theme before, so decided to write a small tutorial on how it’s done for our archiving purposes, and for anyone else that wants to change their TRAC theme.

We’re using Ubuntu Linux, and this tutorial assume you’ve already installed TRAC on a global basis to your development server.

So, lets get some themes installed on our Trac 10.x installation shall we?

First, install the pre-requisites if not already installed.

# apt-get install python2.5-setuptools

We had to change a couple permissions as well so Trac and everything can read/write where it needs to

# chown -R www-data:www-data /var/www

Now we had to install WebAdmin for Trac 10.x:

# svn export http://svn.edgewall.com/repos/trac/sandbox/webadmin/
# cd webadmin
# python setup.py bdist_egg
# easy_install -Z dist/*.egg

Note that WebAdmin is included with Trac 11.x if you’re bleeding edge, you probably don’t need this.

Now we had to install ThemeEnginePlugin for Trac 10.x:

# svn checkout http://trac-hacks.org/svn/themeengineplugin
# cd themeengineplugin
# cd 0.10
# python setup.py bdist_egg
# easy_install -Z dist/*.egg

Now, lets install some themes for Trac 10.x:

# svn checkout http://trac-hacks.org/svn/pydotorgtheme/
# cd pydotorgtheme/0.10/
# python setup.py bdist_egg
# easy_install -Z dist/*.egg
# cd ../../
# svn checkout http://trac-hacks.org/svn/gamedevtheme/
# cd gamedevtheme/0.10
# python setup.py bdist_egg
# easy_install -Z dist/*.egg
# cd ../../
# svn checkout http://trac-hacks.org/svn/consultanttheme/
# cd consultanttheme/0.10
# python setup.py bdist_egg
# easy_install -Z dist/*.egg
# cd ../../

Now we added the following to our Trac.ini within the project we want the themes to be used for:

# cd /var/local/trac/trac.yourdomain.com/conf/
# nano trac.ini

Add this to the components section of your configuration file

[components]
webadmin.* = enabled
themeengine.* = enabled

Then we restarted Apache and we were able to select themes to make available, and attach to our Trac Installation. Note that with each new theme added, you will have to restart Apache in our experience.

This should get you going with installing some themes for Trac on your Ubuntu Linux server. Have Fun!