Author Archives: admin

HowTo: Create LVM snapshots and revert

HowTo: Create LVM snapshots and revert

LVM Snapshots

The logical volume manager software allows you to take a snapshot of any logical volume.
This can be used to bring your logical volume back to a known good state or to merge changes from a modified snapshot back to the original logical volume. The latter is possible because lvm snapshots are also writeable (as of lvm2, this is not the case for the older lvm1).
You can use snapshots as a form of backup which allows you to recover lost data or recover from an unstable system following some installs.
For example before you try some modifying some important system configuration files or installing new software, you could take a snapshot of your system before trying something out. If things don’t work as you planned, you can revert to a good working system by using the snapshot.

Note: its important to mention that if a snapshot runs out of space, the whole snapshot is dropped and cannot be used. However if you notice the snapshot is running out of space (check this using the lvdisplay or lvs commands), you can increase its size just like any other logical volume.

Taking A Snapshot

When you take a snapshot, use the lvcreate command along with the “-s” or –snapshot option as shown below and remember not to use any “-” (i.e. dash/hyphen) in the name as software like grub2 will have trouble using it:

sudo lvcreate --size 1G -s -n snapshot_lv /dev/vgroup/original_lv

So the above would create a logical volume called snapshot_lv which is a snapshot of original_lv (in the volume group called vgroup).
Note that the size you need to use will depend on what you’re doing. Bear in mind that snapshots use “copy on write”, so data is only copied to the snapshot when it deviates from the original data. So when you access data in the snapshot volume, you effectively access the original logical volume’s data unless: (a) the original volume’s data has changed, in which case you access a copy of the original which is stored in the snapshot volume, (b) you have written to the snapshot, in which case the modified data resides in the snapshot volume.
Thus, you can create a snapshot of say, 100GiB using only a few GiB, because most of the “snapshot” data still resides on the original volume.

Mounting A Snapshot

You can mount a snapshot which allows a limited form of experimentation, e.g. you can run software on files there without damaging the original files. If you’re happy with the outcome, then you can run the software using your original files. Or you could just merge that snapshot if you’d like to change your originals to the state of those in the snapshot (instructions to merge are shown in next section).
To mount a snapshot, create a directory for the snapshot in /mnt for example:

sudo mkdir /mnt/snap

Then for a snapshot called “snap”, you could mount it using:

sudo mount /dev/ubuntu/snap /mnt/snap

Then cd to the directory to access the snapshot’s files:

cd /mnt/snap

Reverting/Merging To The Snapshot’s State

Once you have a snapshot available, you can change the original logical volume to the state of that snapshot should the need arise.
Before changing the state of the logical volume to that of it’s snapshot, you need to have unmounted that logical volume if you want the change to happen immediately. Alternatively, if you can’t unmount, you can carry out the command but the changes will not take effect until you do a reboot.
In order to revert to the snapshot, you would simply use the lvconvert command along with the –merge option, as shown below:

lvconvert --merge /dev/vgroup/snapshot-lv

Now the original logical volume has been reverted/merged to the state of the snapshot (remember this will probably require a reboot if one of the volumes is mounted).
Note that once you’ve used a snapshot to revert/merge, the snapshot disappears from your system.

Removing A Snapshot

If you no longer have use for a snapshot, you can remove it using the lvremove command:

sudo lvremove /dev/vgroup/snapshot_lv_name

Where vgroup is the volume group in which the snapshot resides, and snapshot_lv_name is the name of your snapshot logical volume.

A Simple Example

As an example, lets create a snapshot of the logical volume (test_lv). In this case, lets say we have 10GiB of music:

sudo lvcreate --size 2G -s -n test_lv_snapshot /dev/vgroup/test_lv

The 2GiB of data means you’re covered if a few of your files get deleted.
If instead you used 10GiB as the snapshot size, you can rest assured that even if every file was accidently deleted, the snapshot can hold enough data to recover it all.
If the new software did actually mess up your music files, you can revert your files to their original state when you took the snapshot by using the command:

lvconvert --merge /dev/ubuntu/test_lv_snapshot

So using snapshots can give you more flexibility for your backups and snapshot size is based on the risk assessment of how your data may change.

Creating A “Complete Backup” From A Snapshot

Snapshots only grow if data on the original logical volume changes or if you write to the snapshot yourself (more about the write aspect later).
So if we forget about us manually writing to snapshots for the moment, the only data in the snapshot are chunks of original volume data which have changed on the original volume since the snapshot was taken.
Have you noticed that a snapshot still relies on the unchanged original data being OK?
In other words, you can only use a snapshot to revert an original logical volume if the original still exists. So snapshots are a fantastic feature as you’ll see below, but they are not backups in the conventional sense of having a complete copy of all the original data.
If you want a completely independent separate copy of your data at the time of a snapshot, you can take a copy in the same way you would for any other device, e.g. using the cp or dd commands.
Note that this way of backing up data ensures a consistent view of the data is quickly taken at a specific point in time. This is important when backing up databases for example. Obviously creation of a consistent view requires tables to be locked, but the beauty of lvm is that they need only be locked for a very small amount of time (which makes it viable when compared to locking tables and waiting hours for data to be physically copied).

Preparing For Recovery Before Experimenting/Tweaking/Trying Something New

Have you ever wrecked your system by tweaking things, or adding software that didn’t quite do what you expected, or by removing something important by mistake? Wouldn’t it be nice to be able to undo the mess and return your system to its former working state?
Well using a snapshot you can return to that good state – that is, only if you took a snapshot before you started your experimentation!
There are two ways to do this.

  • Method 1: The first method is to change your current system and revert to the snapshot if something goes wrong.
  • Method 2: Alternatively you can boot using the snapshot as your root logical volume, make the changes to the snapshot, then if something goes wrong just reboot and remove the snapshot, or if you would like to keep the changes just merge the snapshot.

Using either approach, you’ll need take a snapshot of the system in a known good state before you start any tweaks or try out new stuff (and if you’re changing the kernel, the very first thing you should do is back up /boot if your install has /boot on a normal /dev/sda1 partition which is not part of lvm, more about this below).

Recovery Method 1: Trying Out New Stuff On Your Root Logical Volume (Your Normal System)

Using this approach, you take a snapshot of the root file system’s logical volume then carry out your tweaks on the root logical volume. If there is a mistake or problem you revert to the snapshot which has the root volume’s (thus the root filesystem’s) original state.
Now is the time to back up /boot if you are going to change the kernel (see if this applies to you by reading the “Backing Up /boot” section, below).
Ok, having backed up /boot (only if you needed to), now we can get on with taking the snapshot.
In Ubuntu 18.10, the root file system resides on the logical volume /dev/ubuntu/root (also /dev/mapper/ubuntu-root).
So, based on this you could create a snapshot of this logical volume, using:

sudo lvcreate --size 2G -s -n rootsnap /dev/ubuntu/root

You should base the size on whatever job you are doing, unfortunately there is no rule-of-thumb for calculating this size. Think about how much data will change, e.g. if it’s only for a few config file changes or for trying out a new graphics driver, 2GiB is overkill. But if you plan on changing a lot of software, take the size of the software into account. If you have the space, its recommended to be generous with the size of your snapshot – in any case, once you’ve finished the snapshot will be removed anyway thus relinquishing the space to your system.

Once you have taken your snapshot, crack on with trying out some experimentation or new software config etc …
If you are happy with the changes, you just need to remove the snapshot (see “Removing A Snapshot” section above) and you’re done.
Otherwise, if this new stuff messes up your system, the steps required to fix things will depend on how badly things went…
If the system boots up OK, you can run the lvconvert command below while the root filesystem is mounted, a reboot will then be required before the logical volume is actually reverted to the snapshot.

sudo lvconvert --merge /dev/ubuntu/rootsnap

If you can’t boot you should start up a live cd or live usb then run the above lvconvert command.
When you run the lvconvert command you should see something like this: Then reboot.
If you still can’t boot, (this may happen if /boot has been changed somehow!) for example if you’ve changed to a different kernel as part of what you tried since taking the snapshot (In which case you’ll see something like “An error occurred while mounting /boot”), then you’ll need to fix /boot.
To fix /boot: follow the “Restoring /boot” section below. When you’ve restored /boot, you just need to reboot normally – now things will be right back as they were before you started your experiments!

Quick Summary:

  • (1) Backup /boot if required. (Follow steps in “Backing up /boot” section below) .
  • (2) Take a snapshot of your current root logical volume
  • (3) Carry out your tweaks
  • (4) If you’re not happy with the changes, revert to snapshot using lvconvert. Otherwise if you are happy with the changes, remove the snapshot as you will not need it.
  • (5) If still can’t boot because /boot got messed up, follow steps in “Restoring /boot” section below.

Recovery Method 2: Trying Out New Stuff On The Snapshot Instead

By default lvm2 snapshots are read/write, meaning that if you mount the snapshot and change things, when a merge is done, the original will be changed to the snapshot’s modified state.
For some people, using the snapshot’s write functionality in this way may conceptually seem more suitable for trying out tweaks or they may feel more comfortable doing things this way (although both approaches work equally well).
OK, lets start by saying that now is the time to back up /boot if you are going to change the kernel (see if this applies to you by reading the “Backing Up /boot” section, below).
Next, create a snapshot of the root logical volume as before:

sudo lvcreate --size 2G -s -n rootsnap /dev/ubuntu/root

Now boot using the snapshot as your root filesystem. The easiest way to do this is to hold Shift while your system starts up.
This will bring up the grub menu, when you can see the menu you should hit e to edit.
This will bring up some grub script text which you can edit on the fly.
Move to the line starting with linux (Navigate using the cursor arrows) and change:

root=/dev/mapper/ubuntu-root

to use your snapshot name, e.g:

root=/dev/mapper/ubuntu-rootsnap

When you’ve typed that, simply hit F10 to boot.
You should now boot into your snapshot.
(Note that this is only a temporary change that you’ll need to carry out each time you want to boot into your snapshot. If you want something more permanent, you could add an entry to grub2 menu – but snapshots are usually temporary entities, so a menu entry would normally be overkill, let us know if you’d like us to include instructions about how to add a permanent entry!).
You can verify that you’re using the snapshot as your root filesystem by running:

df .

If you used “rootsnap” for your snapshot name, you’ll see something like this: You should see your snapshot name in the result.
Now you can proceed with your tweaks and experimentation.
When you’re finished your tweaks, if you decide you like what you’ve done, just run:

sudo lvconvert --merge /dev/ubuntu/rootsnap

You can run the above command from either the snapshot system or your normal system. If you run it from the snapshot, you’ll see something like this: Now when you reboot, you’ll have the changes on your root logical volume (i.e. your normal system will have the tweaks).

Otherwise, if your changes messed up the snapshot, you just need to boot normally (don’t run lvconvert command) then remove the snapshot using:

sudo lvremove /dev/ubuntu/rootsnap

If things got messed up, and your changes involved changing the kernel, you’ll probably need to follow the “Restoring /boot” section below.

Quick Summary:

  • (1) Backup /boot if required. (Follow steps in “Backing up /boot” section below) .
  • (2) Take a snapshot of your current root logical volume
  • (3) Boot using your snapshot as the root filesystem (see above).
  • (4) Carry out your tweaks
  • (5) If you are happy with the changes, merge to snapshot using lvconvert
  • (6) If still can’t boot because /boot got messed up, follow steps in “Restoring /boot” section below.

Renaming Logical Volumes (and thus Snapshots)

If you want to rename a snapshot, simply use the lvrename command.
This may be required for example if you used a logical volume name with a “-” in it when creating your snapshot.
If you ever wanted to boot up via grub2 into a root file system snapshot who’s named like that, such as “root-snap”, you could change the name to something useable like “rootsnap” by using this command:

sudo lvrename /dev/ubuntu/root-snap ubuntu/rootsnap

Where ubuntu is the name of the volume group.

Backing Up /boot

If your /boot is on its own partition, e.g. /dev/sda1 (as is the case for a default Ubuntu 12.10 lvm install), you’ll want to back that up also – only if what you want to try out involves a kernel change, or any other change to /boot, otherwise there is no need to back up /boot.
To take a backup of /boot, run the following command before taking the snapshot of your root filesystem (so you’ll have a copy on snapshot also):

dd if=/dev/sda1 of=boot_backup.img

Do take note of where abouts in your root filesystem you’ve put boot_backup.img because if you have to resort to using it later you’ll need to know where to find it!

Restoring /boot

To fix /boot using boot_backup.img (created earlier): start up a live cd, or live usb, then mount your root filesystem, e.g.:

sudo mkdir /mnt/rtfs
sudo mount /dev/ubuntu/root /mnt/rtfs

Locate your boot_backup.img, then revert to the original /boot by running the below command (use your path to boot_backup.img, and take care to use the correct device!):

sudo dd if=/mnt/rtfs/boot_backup.img of=/dev/sda1

When this command has finished, your /boot partition has been restored.

Still Can’t Boot?

If you still cannot recover your system (e.g. you changed the kernel, but forgot to back up /boot), you can try holding Shift while your system restarts. This will throw up your grub menu from which you should be able to boot to an older kernel. Once up and running, you can use the software updater (or similar) to update your kernel to its former self.

FreePBX now available

FreePBX now available

After months of preparation and testing, tidyhosts are excited to announce our new FreePBX hosting packages.  FreePBX is an opensource, IP based, all in one PBX solution built on the very popular Asterisk platform.

Not only is FreePBX easy to use, it is also fully customisable.  Out of the box FreePBX comes pre-loaded with many of the normal phone system functions and features that end users would expect, but there are dozens of commercial modules available from the FreePBX store that can be added as the requirements grow.

FreePBX allows customers to use either software or hardware based phones, meaning you can download and install a software based phone onto your device, removing the need for a desk phone.  The ability to use a software phone allows you to take calls anywhere in the world which makes the solution ideal for geographically scattered workers.

FreePBX removes the need for expensive ISDN lines and PBX equipment on the customer premises.  Having a hosted PBX gives customers flexability, remote working and disaster recovery.

Once the FreePBX server is up and running, customer will need to connect a SIP (Session Initiated Protocol) trunk to their PBX.  We can suggest a number of providers that will offer this.  All call related charges will be payable to the SIP provider.  If you already have your own number which you wish to use on the PBX, then they can be ported over to the SIP provider.

We are also pleased to announce our range of handsets now available from our store.  In particular, the Sangoma handsets, which have been built specifically for FreePBX, however most SIP phones will happily work with FreePBX.

HowTo: Connect to an APC device with an unknown IP address

Have you ever been handed a device that has previously been configured by someone else and the IP details have disappeared?

We recently came across such a situation and thought we would share the trick we used to gain access to the device, which in turn allowed us to setup a new IP address.

This configuration was carried out on an APC AP7921, we wanted to assign IP 192.168.0.1

Firsty, find out the mac address of the unit, this should be on the back, our example 00 c0 b7 36 5c 62

Connect directly to the device using an Ethernet cable (cross over if required)

Having now found the mac address, we need to tell the arp table what the IP to MAC association should be

Windows command
arp -s 192.168.0.1 00-c0-b7-36-5c-62

Linux command
arp -s 192.168.0.1 00:c0:b7:36:5c:62

Now use ping with a packet size of 113 bytes which will assign the IP set in the ARP command

Windows command
ping 192.168.0.1 -l 113

Linux command
ping 192.168.0.1 -s 113

Now you should be able to connect using telnet or http and set the new IP address.  If you don’t know the password then you will need to use the reset button which usually requires a pin or paper click.

HowTo: Mounting Partitions within a XEN domU disk Image

If you have been using virtualisation technologies such as XEN, you would of come across the usage of disk images to store our operating system and data on.  To create one of these we run:

dd if=/dev/zero of=mydisk.img bs=1024k count=0 seek=5000

This would have created for me an image which is approximately 5GB in size. And then I format it to an ext3 file-system with:

This command will of create a new disk image, 5GB in size called mydisk.img.  This is where Debian will be installed but firstly we need to give the new disk a file sytem type, so we run:

mkfs.ext4 mydisk.img

The problems people may face is when the disk image isn’t formatted by dom0, but instead are formatted by an installer and creates more that one partition inside the image.

usually we can mount the newly formatted disk like this:

mount -o loop mydisk.img /mnt/disk1

But since the image which gets created during the installation process of the VM, has multiple partittions, a simple mount won’t work. This is what happens when we try to mount an image which has multiple partitions:

Since the installer creates multiple partitions inside the image, the normal easy mounting within dom0 will not work:

mount -o loop mydisk.img /mnt/disk1: you must specify the filesystem type

We can examine the file further by executing:

fdisk -lu hda

Which outputs:

You must set cylinders.
You can do this from the extra functions menu.

Disk hda: 0 MB, 0 bytes
255 heads, 63 sectors/track, 0 cylinders, total 0 sectors
Units = sectors of 1 * 512 = 512 bytes

Device Boot      Start         End      Blocks   Id  System
  centos.img   *     1060290    17848214     8393962+  83  Linux
Partition 1 has different physical/logical endings:
     phys=(1023, 254, 63) logical=(1110, 254, 63)
  hda2        17848215    20964824     1558305   83  Linux
Partition 2 has different physical/logical beginnings (non-Linux?):
     phys=(1023, 254, 63) logical=(1111, 0, 1)
Partition 2 has different physical/logical endings:
     phys=(1023, 254, 63) logical=(1304, 254, 63)

The ‘u’ flag inside fdisk tells us the partition table sizes in sectors rather than cylinders.  From here we will need this information so we can calculate the correct offset.

Calculate the Offset in “Bytes”

In order to mount the two partitions from the image, we need to know the starting Byte from where each partition starts. To calculate this offset, we mulitply the (start_sector * sector_byte_size). So for the Partition 1 we have (1060290 * 512) = 542868480 and for Partition 2 we have (17848215 * 512) = 9138286080.

Now we can use those “Start Byte” values to mount those partitions in two seperate locations:

mount -o loop,offset=542868480 mydisk.img /mnt/partition1
mount -o loop,offset=9138286080 mydisk.img /mnt/partition2

HowTo: Speed Up Linux Software Raid Building And Re-syncing

Sometimes when assembling a raid array, you may find that it is going to take hours, even worse, days to complete.  Luckily there are ways to increase the assemble time with some useful commands which should decrease the time considerably.

To increase the rebuild speed, enter:

echo value > /proc/sys/dev/raid/speed_limit_min

OR

sysctl -w dev.raid.speed_limit_min=value

In this example, set it to 60000 K/Sec, enter:

echo 60000 > /proc/sys/dev/raid/speed_limit_min

OR

sysctl -w dev.raid.speed_limit_min=60000

If you want to override the default settings you could add these two lines to /etc/sysctl.conf:

dev.raid.speed_limit_min = 60000
dev.raid.speed_limit_max = 200000

Bitmap Option

Bitmaps optimize rebuild time after a crash, or after removing and re-adding a device.

Turn it on by typing the following command:

mdadm –grow –bitmap=internal /dev/md0

Once array rebuild or fully synced, disable bitmaps:

mdadm –grow –bitmap=none /dev/md0

The net result

The rebuild rate jumps from 4k to 61k:

cat /proc/mdstat

Sample outputs:

Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath]
md5 : active raid1 sde2[2](S) sdd2[3](S) sdc2[4](S) sdb2[1] sda2[0]
      530048 blocks [2/2] [UU]
md0 : active raid6 sde3[4] sdd3[3] sdc3[2] sdb3[1] sda3[0]
      5855836800 blocks level 6, 64k chunk, algorithm 2 [5/5] [UUUUU]
      [============>........]  resync = 61.7% (1205475036/1951945600) finish=242.9min speed=61204K/sec

HowTo: resolve the ‘/bin/rm: Argument list too long’ error

You may of come across this error like us when running the command rm -rf *, fortunately there is a workaround that should help:-

find . -name ‘test-*’ | xargs rm

In the above example the command will forcefully delete all of the files in the current directory that begin with test-. You can replace the parameter test-* with anything you like. You can also use * if you want to simply remove all the files

find . -name ‘*’ | xargs rm

Hopefully by running these commands will help you remove the files you want without getting stuck with the error.

HowTo: Install XEN Dom0 on Debian Stretch from source

HowTo: Install XEN Dom0 on Debian Stretch from source

xen logo
This article assumes you have a clean install of Debian and have root level access to the server. Note this was performed on a minimal install with no desktop.

Prereqs

To be able to perform a successful kernel build, you will need to install the following packages:

apt-get install bc bcc bin86 gawk bridge-utils iproute libcurl3 libcurl4-openssl-dev bzip2 module-init-tools transfig texinfo texlive-latex-base gcc-multilib texlive-fonts-extra texlive-fonts-recommended pciutils-dev mercurial libncurses5-dev patch libvncserver-dev libsdl-dev gettext libaio1 libaio-dev libssl-dev iasl libbz2-dev git-core uuid-dev python python-dev python-twisted build-essential make gcc libc6-dev zlib1g-dev texlive-latex-recommended e2fslibs-dev libyajl-dev libpixman-1-dev liblzma-dev flex bison

XEN Compile and install

Now lets get the XEN tarball and make XEN

cd /usr/src

wget https://downloads.xenproject.org/release/xen/4.12.0/xen-4.12.0.tar.gz

tar xvf xen-4.12.0.tar.gz

cd xen-4.12.0

./configure -enable-githttp -libdir=/usr/lib

make -j 5 xen

make -j 5 tools

make -j 5 stubdom

cd dist/install

cp -R * /

vi /etc/default/xendomains and comment out #XENDOMAINS_SAVE=/var/lib/xen/save

These tweeks should make XEN start at system startup and also create the bridge we need for the DomUs. Please note that rc3.d could be rc2.d depending on your runlevel, check with the command runlevel at the prompt.

ln -s /etc/init.d/xendomains /etc/rc0.d/S10xendomains

ln -s /etc/init.d/xendomains /etc/rc6.d/S10xendomains

ln -s /etc/init.d/xencommons /etc/rc3.d/S98xencommons

ln -s /etc/init.d/xendomains /etc/rc3.d/S98xendomains

ln -s /root/xendom0caps /etc/rc3.d/S98xendom0caps

ln -s /root/iptables-enable /etc/rc3.d/S99iptables-enable (not required)

vi /root/xendom0caps (add xl sched-credit -d Domain-0 -w 512)

chmod +x /root/xendom0caps

vi /etc/rc.local (add /usr/bin/setterm -powersave off -blank 0

vi /etc/xen/xend-config.sxp

find line (network-script network-bridge) and comment out

#network-script network-bridge

vi /etc/xen/xl.conf (disable autoballon)

autoballon=0

Interfaces

As newer versions of XEN can use the system bridge rather than its own script we need to edit the network configuration to invoke our new bridge. Firstly create our new bridge interface. Replace the IP values with your settings.

vi /etc/network/interfaces

auto xenbr0
iface xenbr0 inet static
bridge_ports eth0
address 172.20.45.1
netmask 255.255.0.0
network 172.20.0.0
broadcast 172.20.255.255
gateway 172.20.0.1

Once done reboot to ensure the config applies successfully.

Kernel Compile

Now XEN is complete we need to get our kernel for Dom0. Replace the kernel number with the version you want to use.

cd /usr/src

(Please note the kernel version maybe significantly newer than detailed here)

wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.0.10.tar.xz

tar xvf linux-5.0.10.tar.xz

cd linux-5.0.10

make menuconfig

Go into Processor type and features

pic1

Statically enable all XEN features

pic21

Go back to the main menu and enter Device Drivers menu, then enter block devices menu

pic3

Statically enable the 2 XEN options

pic4

Go back to the Device Drivers menu and go down to XEN driver support

pic5

Statically enable all features

pic7

Go back to Device Drivers, go into Network device support and statically enable the 2 XEN options at the bottom

pic8

Exit out and save.

Note to make sure all options are selected run

cat /usr/src/linux-4.12.3/.config | grep XEN

You should see the same as

CONFIG_XEN=y
CONFIG_XEN_DOM0=y
CONFIG_XEN_PRIVILEGED_GUEST=y
CONFIG_XEN_PVHVM=y
CONFIG_XEN_MAX_DOMAIN_MEMORY=500
CONFIG_XEN_SAVE_RESTORE=y
CONFIG_XEN_DEBUG_FS=y
CONFIG_PCI_XEN=y
CONFIG_XEN_PCIDEV_FRONTEND=y
CONFIG_XEN_BLKDEV_FRONTEND=y
CONFIG_XEN_BLKDEV_BACKEND=y
CONFIG_NETXEN_NIC=m
CONFIG_XEN_NETDEV_FRONTEND=y
CONFIG_XEN_NETDEV_BACKEND=y
CONFIG_INPUT_XEN_KBDDEV_FRONTEND=y
CONFIG_HVC_XEN=y
CONFIG_HVC_XEN_FRONTEND=y
# CONFIG_XEN_WDT is not set
CONFIG_XEN_FBDEV_FRONTEND=y
CONFIG_XEN_BALLOON=y
CONFIG_XEN_BALLOON_MEMORY_HOTPLUG=y
CONFIG_XEN_SCRUB_PAGES=y
CONFIG_XEN_DEV_EVTCHN=y
CONFIG_XEN_BACKEND=y
CONFIG_XENFS=y
CONFIG_XEN_COMPAT_XENFS=y
CONFIG_XEN_SYS_HYPERVISOR=y
CONFIG_XEN_XENBUS_FRONTEND=y
CONFIG_XEN_GNTDEV=y
CONFIG_XEN_GRANT_DEV_ALLOC=y
CONFIG_SWIOTLB_XEN=y
CONFIG_XEN_PCIDEV_BACKEND=y
CONFIG_XEN_PRIVCMD=y
CONFIG_XEN_ACPI_PROCESSOR=y

If it looks good then continue otherwise please correct before hand.

make -j 5 bzImage

make -j 5 modules

make -j 5 INSTALL_MOD_STRIP=1 modules_install

cp -a arch/x86/boot/bzImage /boot/vmlinuz-5.0.10

cp -a System.map /boot/System.map-5.0.10

cp -a .config /boot/config-5.0.10

depmod -a

mkinitramfs -o /boot/initrd.img-5.0.10 5.0.10

Modify GRUB2 to boot in XEN mode

cd /etc/grub.d

mv 10_linux 50_linux

vi /etc/default/grub

add these lines under GRUB_CMDLINE_Linux””

GRUB_CMDLINE_XEN_DEFAULT=dom0_mem=1024M,max:1024M
GRUB_CMDLINE_XEN=

save and exit

now issue

update-grub

reboot once complete.

HowTo: Install XEN Dom0 on CentOS 6 from source

HowTo: Install XEN Dom0 on CentOS 6 from source

xen logo

This article assumes you have a clean install of CentOS and have root level access to the server. Note this was performed on a minimal install with no desktop.

Prereqs

To be able to perform a successful kernel build, you will need to install the following packages:

yum groupinstall “Development tools” “Compatibility libraries”

yum install transfig wget texi2html libaio-devel dev86 glibc-devel e2fsprogs-devel gitk mkinitrd iasl xz-devel bzip2-devel pciutils-libs pciutils-devel SDL-devel libX11-devel gtk2-devel bridge-utils PyXML qemu-common qemu-img mercurial texinfo libuuid-devel openssl-devel python-twisted python python-devel ncurses-devel gcc gettext yajl jajl-devel patch yajl yajl-devel lzma-devel flex bison

We also need the 32 bit version of glibc-devel.i686

yum install glibc-devel.i686

XEN Compile and install

Now lets get the XEN tarball and make XEN

cd /usr/src

wget https://downloads.xenproject.org/release/xen/4.12.0/xen-4.12.0.tar.gz

tar xvf xen-4.12.0.tar.gz

cd xen-4.12.0

./configure -enable-githttp -libdir=/usr/lib

make xen

make tools

make stubdom

cd dist/install

cp -R * /

vi /etc/sysconfig/xendomains and comment out #XENDOMAINS_SAVE=/var/lib/xen/save

These tweeks should make XEN start at system startup and also create the bridge we need for the DomUs.

ln -s /etc/init.d/xendomains /etc/rc0.d/S10xendomains

ln -s /etc/init.d/xendomains /etc/rc6.d/S10xendomains

ln -s /etc/init.d/xencommons /etc/rc3.d/S98xencommons

ln -s /etc/init.d/xendomains /etc/rc3.d/S98xendomains

ln -s /root/xendom0caps /etc/rc3.d/S98xendom0caps

ln -s /root/iptables-enable /etc/rc3.d/S99iptables-enable (not required)

vi /root/xendom0caps (add xl sched-credit -d Domain-0 -w 512)

chmod +x /root/xendom0caps

vi /etc/rc.local (add /usr/bin/setterm -powersave off -blank 0)

vi /etc/xen/xl.conf (disable autoballon)

find line (network-script network-bridge) and comment out

#network-script network-bridge

Interfaces

As newer versions of XEN can use the system bridge rather than its own script we need to edit the network configuration to invoke our new bridge. Firstly create our new bridge interface. Replace the IP values with your settings.

cd /etc/sysconfig/network-scripts

vi ifcfg-xenbr0

DEVICE=”xenbr0″
NM_CONTROLLED=”yes”
ONBOOT=yes
TYPE=Bridge
BOOTPROTO=none
IPADDR=172.20.1.73
PREFIX=16
GATEWAY=172.20.0.76
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME=”System xenbr0″

Now we need to edit ifcfg-eth0 and comment out the IP address and add the bridge in.

vi ifcfg-eth0

DEVICE=”eth0″
BOOTPROTO=”none”
NM_CONTROLLED=”yes”
ONBOOT=”yes”
#IPADDR=172.20.1.73
#GATEWAY=172.20.0.76
#NETMASK=255.255.0.0
TYPE=”Ethernet”
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME=”System eth0″
UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03
BRIDGE=xenbr0

Once both files are done reboot to ensure they both apply successfully.

Kernel Compile

Now XEN is complete we need to get our kernel for Dom0. Replace the kernel number with the version you want to use.

(Please note the kernel version maybe significantly newer than detailed here)

cd /usr/src

wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.0.10.tar.xz

tar xvf linux-5.0.10.tar.xz

cd linux-5.0.10

make menuconfigGo into Processor type and features

pic1

Statically enable all XEN features

pic21

Go back to the main menu and enter Device Drivers menu, then enter block devices menu

pic3

Statically enable the 2 XEN options

pic4

Go back to the Device Drivers menu and go down to XEN driver support

pic5

Statically enable all features

pic7

Go back to Device Drivers, go into Network device support and statically enable the 2 XEN options at the bottom

pic8

Exit out and save.

Note to make sure all options are selected run

cat /usr/src/linux-4.12.3/.config | grep XEN

You should see the same as

CONFIG_XEN=y
CONFIG_XEN_DOM0=y
CONFIG_XEN_PRIVILEGED_GUEST=y
CONFIG_XEN_PVHVM=y
CONFIG_XEN_MAX_DOMAIN_MEMORY=500
CONFIG_XEN_SAVE_RESTORE=y
CONFIG_XEN_DEBUG_FS=y
CONFIG_PCI_XEN=y
CONFIG_XEN_PCIDEV_FRONTEND=y
CONFIG_XEN_BLKDEV_FRONTEND=y
CONFIG_XEN_BLKDEV_BACKEND=y
CONFIG_NETXEN_NIC=m
CONFIG_XEN_NETDEV_FRONTEND=y
CONFIG_XEN_NETDEV_BACKEND=y
CONFIG_INPUT_XEN_KBDDEV_FRONTEND=y
CONFIG_HVC_XEN=y
CONFIG_HVC_XEN_FRONTEND=y
# CONFIG_XEN_WDT is not set
CONFIG_XEN_FBDEV_FRONTEND=y
CONFIG_XEN_BALLOON=y
CONFIG_XEN_BALLOON_MEMORY_HOTPLUG=y
CONFIG_XEN_SCRUB_PAGES=y
CONFIG_XEN_DEV_EVTCHN=y
CONFIG_XEN_BACKEND=y
CONFIG_XENFS=y
CONFIG_XEN_COMPAT_XENFS=y
CONFIG_XEN_SYS_HYPERVISOR=y
CONFIG_XEN_XENBUS_FRONTEND=y
CONFIG_XEN_GNTDEV=y
CONFIG_XEN_GRANT_DEV_ALLOC=y
CONFIG_SWIOTLB_XEN=y
CONFIG_XEN_PCIDEV_BACKEND=y
CONFIG_XEN_PRIVCMD=y
CONFIG_XEN_ACPI_PROCESSOR=y

If it looks good then continue otherwise please correct before hand.

make bzImage

make modules

make modules_install

cp -a arch/x86/boot/bzImage /boot/vmlinuz-4.12.3

cp -a System.map /boot/System.map-4.12.3

cp -a .config /boot/config-4.12.3

depmod -a

mkinitrd -o /boot/initrd.img-4.12.3 4.12.3

Modify GRUB to boot in XEN mode

vi /boot/grub/grub.conf

scroll down to the current setting and add the following above your current boot config, you will need to edit the lines to match your root and paths to the files.

title Xen 4.9.0 / Debian GNU/Linux, kernel 4.12.3
root (hd0,0)
kernel /xen.gz
module /vmlinuz-4.12.3 root=root=UUID=03f9e700-ba18-41a1-bbe7-65a372716c73 ro console=tty0
module /initrd.img-4.12.3

save and reboot.

If your system fails to boot then you can boot back into the normal kernel and correct any issues.

Once the system is booted run this as a simple test to make sure XEN is running

xl list

How to: Add autodiscover record using WHM

How to: Add autodiscover record using WHM

whm logo

In order to let Outlook clients such as 2010, 2013 to automatically set up your account and apply the correct settings, an Autodiscovery SRV record now needs to be added. In particular with Outlook 2016 this is now mandatory otherwise you can’t use it.

If you are using the WHM management suite and have access to edit the domains then you can easily accomplish this by following the steps below.

1. Open WHM and login.
2. Click on DNS Functions then scroll down to the domain you want to edit
3. Now where is says Add New Entries, add the following into the first section:

_autodiscover._tcp

4. No need to edit the TTL records but you can of course if you want to, the is default 14400 seconds.
5. Next choose SRV where is says to select.
6. Enter the priority:

0

7. Enter the Weight:

0

8. Enter the Port as:

443

9. Enter the FQDN of the exchange server that your host has given you with the full stop at the end:

outlook.domains.com.

10. Save the settings.

11. Now give it a little time to update then you can use this useful tool from Microsoft:

https://testconnectivity.microsoft.com/

12. If you dont want to use Microsofts tools then run this in a command prompt (Windows)

nslookup -q=srv _autodiscover._tcp.yourdomain.com

 

 

 

How To: Start Your Own Radio Station With SHOUTcast

How To: Start Your Own Radio Station With SHOUTcast

shoutcast logo

Starting your own SHOUTcast radio station can be just a dream for a lot of people due to the potentially expensive equipment required to get up and running, however these days it can be very simple. There are various ways of starting a radio station, the most popular method today is using the internet.

The majority of the population today have access to the internet on some sort of device, where it be a laptop, tablet or smart phone, this opens up so much potential to reach your audience without the need to transmit accross the airwaves.

In order to get your radio station up and running will require some key ingredients that when put together gives you scope for so much poential.

You will need:-

  1. A SHOUTcast Server – the hub where your listeners will connect to and listen in.
  2. Winamp – the source plays the music from your desktop/laptop machine.
  3. SHOUTcast DSP plugin – a plugin for Winamp which converts the music and connects to the SHOUTcast server so your listeners can hear.
  4. A good internet connection
  5. Music of course!

We will quickly cover the items required

SHOUTcast Server

A mentioned this is basically the hub where you as the broadcaster will upload your music to, which in turn allows the listeners to also connect to and listen to your stream. You can purchase your SHOUTcast server from TidyHosts, there are a number of packages to choose from.

Winamp

This is the software that needs to be installed on your desktop/laptop. You can download from http://www.winamp.com/ Once installed you then need to create your playlist that will be streamed for your audience to listen to. Of course you are not limited to files, you can connect external equipment such as CDJs and peform live shows. Please visit http://forums.winamp.com for more details on how to setup your equipment for use with Winamp.

SHOUTcast DSP plugin

Now that you have the server and Winamp installed its time to get the plugin that actually encodes and sends your stream to the server. Without this vital of software you wont be streaming anytime soon. You can download the plugin from http://www.shoutcast.com/BroadcastNow There is a useful guides on the forums at http://forums.winamp.com that show you how to install and setup the plugin for use on your machine.

A Good Internet Connection

If you plan to stream at a good quality bitrate such as 320 kbps then you will need a good and stable internet connection. We cannot stress enough how important this is. If your connection is known for drops then you will quickly lose your audience. The automated SHOUTcast directory may block the listing in the directory if it detects flapping so before starting out make sure this in good shape.

Music of Course

You have got everything ready, server is up, PC is up, all you need now is quality music for your listeners. What you stream is entirely up to you, make sure it is clear and can be easily heard. Having your input volume to low will put listeners off whislt having it too high will cause distortion so test with friends before starting off. Once you have decided what you want to broadcast, try and do some online advertising using social media such as Facebook and Twitter etc. Remember, word of mouth is a great advertising tool, produce a great show and the listeners will increase before you know it!