Saturday, October 30, 2010

PXE installer & LivePXE

I have done some work on network booting (PXE) and pxe installation.

I have created a live cd. The first version boots clonzilla, gparted and installs lucid mini cd. On the server version I can boot ubuntu desktop Live, but that does not work on the LIVEPXE cd (NFS does not work on the cd for the moment).

The advantage of my solution is that I use a dchp proxy wich means it coexists with existing dhcp without any changes.

Download it at:
https://sourceforge.net/projects/qfpxeinstaller/

This is how to config it yourself.
http://ubuntuforums.org/showthread.php?t=1606910

Saturday, October 23, 2010

dchpProxy

This is a very crude setup of dhcpProxy with dnsmasq.
With this setup it has to be on the same server as tftp (I think).
I will fix that and also change the config file from ltsp which is not relevent since I use it for a PXE install server.

I will also make a start script that handle dynamic subnet.


--------------------------------------------
Installing dnsmasq
-----------------------------------------------
https://help.ubuntu.com/community/UbuntuLTSP/ProxyDHCP

sudo apt-get install dnsmasq

sudo nano /etc/dnsmasq.d/ltsp.conf
add:

####################################################################
# Copied from https://help.ubuntu.com/community/UbuntuLTSP/ProxyDHCP
# Modified by vikjon0 2010-10-22 for PXE install server
#####################################################################
# Sample configuration for dnsmasq to function as a proxyDHCP server,
# enabling PXE clients to boot when an external, unmodifiable DHCP
# server is present.
# The main dnsmasq configuration is in /etc/dnsmasq.conf;
# the contents of this script are added to the main configuration.
# You may modify the file to suit your needs.

# Don't function as a DNS server:
port=0

# Log lots of extra information about DHCP transactions.
log-dhcp

# Dnsmasq can also function as a TFTP server. You may uninstall
# tftpd-hpa if you like, and uncomment the next line:
#enable-tftp

# Set the root directory for files available via FTP.
tftp-root=/var/lib/tftpboot

# The boot filename.
dhcp-boot=/var/lib/tftpboot/pxelinux.0

# rootpath option, for NFS
dhcp-option=17,/var/www/PXE

# kill multicast
dhcp-option=vendor:PXEClient,6,2b

# Disable re-use of the DHCP servername and filename fields as extra
# option space. That's to avoid confusing some old or broken DHCP clients.
dhcp-no-override

# PXE menu
pxe-prompt="Press F8 for boot menu", 3

# The known types are x86PC, PC98, IA64_EFI, Alpha, Arc_x86,
# Intel_Lean_Client, IA32_EFI, BC_EFI, Xscale_EFI and X86-64_EFI
pxe-service=X86PC, "Boot from network", pxelinux

# A boot service type of 0 is special, and will abort the
# net boot procedure and continue booting from local media.
pxe-service=X86PC, "Boot from local hard disk", 0

# If an integer boot service type, rather than a basename is given, then the
# PXE client will search for a suitable boot service for that type on the
# network. This search may be done by multicast or broadcast, or direct to a
# server if its IP address is provided.
#pxe-service=x86PC, "Install windows from RIS server", 1

# This range(s) is for the public interface, where dnsmasq functions
# as a proxy DHCP server providing boot information but no IP leases.
# Any ip in the subnet will do, so you may just put your server NIC ip here.
dhcp-range=192.168.0.130,proxy

# This range(s) is for the private network on 2-NIC servers,
# where dnsmasq functions as a normal DHCP server, providing IP leases.
#dhcp-range=192.168.0.20,192.168.0.250,8h

# For static client IPs, and only for the private subnets,
# you may put entries like this:
#dhcp-host=00:20:e0:3b:13:af,10.160.31.111,client111,infinite

Thursday, April 8, 2010

Bug in Karmic network-manager

When making connection available for all users this just causes the connection to disappear

Workaround:
set "managed=true" in [ifupdown] section in /etc/NetworkManager/nm-system-settings.conf

https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/405413

Sunday, March 21, 2010

Howto downgrade ubuntu 9.10 karmic to legacy grub

My Asrock ION 330 hangs for a minute in the boot sequence with grub2.
Lets downgrade to Legacy.


sudo apt-get purge grub2 grub-pc
sudo rm /boot/grub/*

sudo apt-get install grub

sudo update-grub

sudo fdisk -l

sudo grub-install /dev/sdX

echo "grub hold" | sudo dpkg --set-selections

Saturday, March 20, 2010

Howto get automount and stuff working in 9.10 Karmic without gdm

When running the gnome desktop without gdm e.g. by startx things does not work as expected. E.g. if a usb disk is plugged in it is not mounted and the err "not authorized" is displayed.

I think the correct solution may be to include ck-launch-session in startx but I have not been able do do this. I still dont really understand exactly how the ubuntu startup scripts works.

EDIT: please note that this does not fix usb automount in xbmc.
The problem can instead be fixed by:

sudo apt-get install policykit-1 devicekit-power

sudo nano /var/lib/polkit-1/localauthority/50-local.d/custom-actions.pkla
add:

[Actions for xbmc user]
Identity=unix-user:xbmc
Action=org.freedesktop.devicekit.disks.*;org.freedesktop.devicekit.power.*;org.freedesktop.consolekit.system.*;org.freedesktop.hal.storage.mount-removable;org.freedesktop.hal.device.volume
ResultActive=yes
ResultAny=auth_admin
ResultInactive=yes

Tuesday, March 16, 2010

xbmc 9.11 usb does not automount after gnome-core is installed

I have this very annoying probklem that I have not been able to solve. when I install gnome-core usb disks does not mount anymore. I get "not authorized".
Generally if I use gdm it works but if I use xbmc or startx it does not work.

I think the problem could be that the policykit is upgraded to polictkit-1 and any settings that are done for xbmc does not work anymore.

I have now found this: EDIT: This does not fix the usb mount problem. It fixes some other permission problems though. I have given up on xbmc and gnome for the moment. I use lxde with xfce and kde components instead.
http://forum.xbmc.org/showthread.php?t=70394

--------------------------
(sudo apt-get install policykit-1 devicekit-power)

sudo nano /var/lib/polkit-1/localauthority/50-local.d/custom-actions.pkla
add:

[Actions for xbmc user]
Identity=unix-user:xbmc
Action=org.freedesktop.devicekit.disks.*;org.freedesktop.devicekit.power.*;org.freedesktop.consolekit.system.*;org.freedesktop.hal.storage.mount-removable;org.freedesktop.hal.device.volume
ResultActive=yes
ResultAny=auth_admin
ResultInactive=yes

Sunday, February 14, 2010

NSClient++ external vbs script to check MSSQL jobs

Edit: New fixed version

This script for NSClient++ checks if there is any failed jobs in MS SQL server. The database connection data is stored in a UDL file.

External script alias in nsclient:
check_mssql_jobs=cscript.exe //T:30 //NoLogo scripts\check_mssql_jobs.vbs /MaxWarn:0 /MaxCrit:1 /truncate:900

Nagios command:
define service{
use generic-service
host_name SEHQFVD03
service_description MSSQL jobs
check_command check_nrpe_check_mssql_jobs
high_flap_threshold 35.0
low_flap_threshold 30.0
notification_options w,u,c,r,f
}


Script:
'########################################################
'# Check MSSQL jobs over UDL TEST v0.0.0.4
'# VIKJON0 2010-02-13
'# VIKJON0 2010-03-02 Only look at latest time job was run
'#########################################################

Option Explicit
Dim strConnection, conn, rs, strSQL
Dim objConn
Dim connStr
Dim foundTXT, returnTXT, perfTXT
Dim errLevel, errLevelTXT
Dim MaxWarn, MaxCrit, numberOfRows, truncate
Dim wshArgs

'--Set working directory
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
'WScript.Echo WshShell.CurrentDirectory
WshShell.CurrentDirectory = "C:\Program Files\NSClient++\scripts"

'--Get command line arguments-- /MaxWarn:Y /MaxCrit:Z /truncate:x
Set wshArgs = wscript.arguments

if wshArgs.Named.exists("MaxWarn") then
MaxWarn = cint(wshArgs.named.item("MaxWarn"))
else
MaxWarn = 0
end if

if wshArgs.Named.exists("MaxCrit") then
MaxCrit = cint(wshArgs.named.item("MaxCrit"))
else
MaxCrit = 0
end if
if wshArgs.Named.exists("truncate") then
truncate = cint(wshArgs.named.item("truncate"))
else
truncate = 0
end if

'--Run db query-----------------------
strConnection = "File Name=myUDL.udl; "
Set conn = CreateObject("ADODB.Connection")
conn.Open strConnection

Set rs = CreateObject("ADODB.recordset")

'Check only category = 3 for maintence jobs
'------------------------------------------------------

strSQL = "SELECT name, message,category_id FROM msdb.dbo.sysjobs AS J LEFT OUTER JOIN msdb.dbo.sysjobhistory AS H ON J.job_id = H.job_id " &_
"WHERE enabled = 1 AND run_status != 1 AND step_id = 0 " &_
"AND (cast(run_date as varchar) + RIGHT('00' + cast(run_time as varchar),6)) = " &_
"(select max(cast(run_date as varchar) + RIGHT('00' + cast(run_time as varchar),6)) " &_
"FROM msdb.dbo.sysjobhistory AS H2 where H2.job_id = H.job_id AND H2.step_id = 0 " &_
")order by name"

'----------------------------------------------


rs.open strSQL, conn, 3,3
numberOfRows = rs.recordcount

foundTXT = ""
if numberOfRows = 0 then
foundTXT = "check_db OK"
else
rs.MoveFirst
WHILE NOT rs.EOF
foundTXT = foundTXT & rs("name") & "#"
rs.MoveNext
wend
end if


'--Ceck result and build return data
If truncate > 0 then
foundTXT = left(foundTXT,truncate)
end if

errLevel = 0
errLevelTXT = ""
if not MaxCrit = 0 AND numberOfRows >= MaxCrit then
errLevel = 2
errLevelTXT = ", found errors: " & numberOfRows & " > critical"
else
if not MaxWarn = 0 AND numberOfRows >= MaxWarn then
errLevel = 1
errLevelTXT = ", found errors: " & numberOfRows & " > warning"
end if
end if

perfTXT = "|'found errors'=" & numberOfRows &";" & MaxWarn & ";" & MaxCrit & ";"
returnTXT = foundTXT & errLevelTXT & perfTXT
'msgbox returnTXT

'--Close and exit

rs.Close
Set rs = Nothing
conn.Close
Set conn = Nothing

Wscript.StdOut.WriteLine ReturnTXT
WScript.Quit(errLevel)