Registered member login:
Register Now
Altirigos » Deployment Solution » Imaging - Bootworks/Rdeploy » Linux Automation Scripting Tips/Tricks

» Current Poll
Do you leave the Aclient enabled?
YES - 82.31%
107 Votes
NO - 17.69%
23 Votes
Total Votes: 130
You may not vote on this poll.
» Stats
Members: 9,493
Threads: 11,748
Posts: 55,284
Top Poster: Nick (4,981)
Welcome our newest member, badgerpro
» Online Users: 63
7 members and 56 guests
artusod, badgerpro, bellwb, blues_drummer2002, Brandon, lidoiwo, mbernich
Most users online at once 294, 06-30-2007 at 12:24 PM.
» March 2010
S M T W T F S
28 1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31 123
Reply
Old 03-28-2007, 01:36 PM   #1 (permalink)
 
Status: Super Altiris Admin
Join Date: 09-06-2006
Location: Columbus, OH
Age: 28
Posts: 296


Linux Automation Scripting Tips/Tricks

There seems to be a serious lack of documentation on the Internet regarding this subject, so this is as good of a place to start it. I'm throwing everything that I've run across in here so others may benefit.

We have been using DOS automation since we began using Altiris a couple of years ago. Our base image is about 1.5 gigabytes after all of our customizations, and this image would typically take approximately 15 minutes to deploy on various Dell-based systems ranging from old OptiPlex GX150's to the newest OptiPlex 745's.

We were interested in speeding this process up by utilizing a different form of automation. WinPE was looked into, however the extra time it took to boot into automation negated the speed benefits of using it as our automation platform. We decided to implement Linux automation instead, since it had the fast bootup like DOS and faster transfer speeds that WinPE provided.

I'm far from a Linux expert. Scripting our deployment jobs is the only real experience I have had with Linux. I'm hoping this will provide a useful perspective for those who may be in my shoes and want to speed up their imaging processes. The code may be messy, but it works.

Notes for first-timers regarding some key differences between DOS and Linux:
  • Slashes, not backslashes. This will be especially important if you're converting an existing script.
  • No drive letters. Linux uses folders for "mapped drives". Instead of mapping your eXpress share to F: like in DOS, it gets mapped to /mnt/ds/ instead.
The "Create Disk Image" and "Distribute Disk Image" tasks:
You'll want to ensure you're using rdeployt for your imaging tasks, as there is no graphics-mode rdeploy like there was in DOS.
Keep in mind that since this will be running under the Linux automation, you'll need to format your path/file names in Linux format. For example, if your disk image is in \\AltirisServer\eXpress\Images\Standard.img, you'll want to key in /mnt/ds/images/Standard.img instead. Be sure to check the checkbox immediately underneath the text box. Windows doesn't know what the /mnt/ds/ path is since it's not in a Windows-based format, so it will bark at you that it doesn't exist. By checking this box, you won't receive any warnings about it.
Scripting:
  • Any commands that are executed in a script will not output to the screen by default. You can make these commands output to the screen by adding "> /dev/tty1" (without quotes) to the end of the line.
  • Add the following line to your script near the top to put the /mnt/ds/RDeploy/Linux folder in the path so you don't need to keep typing the full pathname to rdeployt and firm: export PATH=$PATH:/mnt/ds/RDeploy/Linux
  • Token replacement is done the same way as DOS; just change the REM to # instead.
  • Variables are assigned by simply typing VARIABLENAME=contents. They are referenced by $VARIABLENAME after they are set.
Logic / Driver Injection:
I've found the case statement to work more reliably than if statements.

This example will set the workstation's product name as the MDOEL variable and inject the appropriate drivers to the C:\DRV folder on the workstation.

Code:
MODEL="%#!computer@prod_name%"
case "$MODEL" in
  'OptiPlex GX260')
    Firm -recurse Copy "/mnt/ds/Drivers/GX260" "prod:/drv"
  ;;
  'OptiPlex GX270')
    Firm -recurse Copy "/mnt/ds/Drivers/GX270" "prod:/drv"
  ;;
  'OptiPlex GX280')
    Firm -recurse Copy "/mnt/ds/Drivers/GX280" "prod:/drv"
  ;;
esac
Creating multiple mounts to the same server:
There is a known issue with DS 6.8 where automation will crash if two mount points are created to the same server. In some setups, you may want to have a common reference that changes based on the client's IP address.

This example will check the client's IP address, and based on the third octet (assuming only 2 digit numbers are used) will map /mnt/img to either the eXpress share's Images subdirectory or mount this folder to a different server altogether. This could be useful if you want a machine to use a local file server to pull down an image from a local server instead of pulling the image across a WAN.

Examine the mounts.local file in the etc folder through boot disk creator to see how the asmbmount command is used to mount the eXpress share and modify the line below to fit your environment. This example assumes that the 10 subnet is a remote subnet and the 20 subnet is a local subnet (to the Altiris server), and that the \\ALTIRISSERVER\eXpress\Images folder structure is identical to the \\SERVERNAME\ShareName folder structure.
Code:
LONGIPADDR=%AGENTIPADDR%
IPADDR=${LONGIPADDR:6:2}
case "$IPADDR" in
  '10')
    mkdir /mnt/img
    asmbmount -b -d DOMAIN -f /Account.pwl //SERVERNAME/ShareName /mnt/img
    ;;
  '20')
    /bin/ln -s /mnt/ds/images /mnt/img
    ;;
esac
Put all of these concepts together, and we can address the following scenario:
A company has their headquarters in New York and a satellite office in San Diego. The Altiris server is located in New York. All machines in New York have IP addresses in the 10.10.50.xxx range and all machines in Los Angeles have IP addresses in the 10.10.60.xxx range. Their Altiris server's name is NEWYORK. There is a server in San Diego named SANDIEGO, which has an Images share containing the same image found in the eXpress/Images share on the Altiris server named WinXP.img. They would like a single script to image PC's in both locations without streaming the images across the country.

Code:
export PATH=$PATH:/mnt/ds/RDeploy/Linux

LONGIPADDR=%AGENTIPADDR%
IPADDR=${LONGIPADDR:6:2}

case "$IPADDR" in
  '50')
    /bin/ln -s /mnt/ds/images /mnt/img
    ;;
  '60')
    mkdir /mnt/img
    asmbmount -b -d DOMAIN -f /Account.pwl //SANDIEGO/Images /mnt/img
    ;;
esac

rdeployt -md -f/mnt/img/WinXP.img

MODEL="%#!computer@prod_name%"
case "$MODEL" in
  'OptiPlex GX260')
    Firm -recurse Copy "/mnt/ds/Drivers/GX260" "prod:/drv"
  ;;
  'OptiPlex GX270')
    Firm -recurse Copy "/mnt/ds/Drivers/GX270" "prod:/drv"
  ;;
  'OptiPlex GX280')
    Firm -recurse Copy "/mnt/ds/Drivers/GX280" "prod:/drv"
  ;;
esac

exit 0
If anyone else has anything to add, feel free. Hopefully those who take the plunge will be able to do so with little trouble.
dfrancis is offline   Reply With Quote
Old 03-28-2007, 07:42 PM   #2 (permalink)
 
Mike's Avatar
 
Status: Altiris Engineer (Super Mod)
Join Date: 02-22-2005
Location: South Jordan, Utah, USA
Posts: 1,196


Thumbs up

Great write-up!
I've been on the Linux automation soap-box for a while now. Hopefully this will help others overcome the intimidation of this solution.

I sticky'ed this post.
__________________
______________________
Mike Ainsworth

Mike is offline   Reply With Quote
Old 03-29-2007, 06:07 AM   #3 (permalink)
 
Status: Super Altiris Admin
Join Date: 01-08-2007
Location: Scotland
Posts: 100


Thanks dfrancis

Thanks to your help i have now got Linux driver injection to work.

Still have a problem with the Optiplex 745 Linux driver.

Cheers.
stewfo is offline   Reply With Quote
Old 03-29-2007, 07:57 AM   #4 (permalink)
 
Status: Super Altiris Admin
Join Date: 09-06-2006
Location: Columbus, OH
Age: 28
Posts: 296


Stewfo:

Attached to this post is a zip file containing a .ko file. This is a driver that works with DS 6.8. I honestly can't remember which thread/forum I found this on a few weeks ago. I swear it was here on Altirigos but I couldn't locate it when I just did a search.

At any rate, drop the contents of this zip file into the following folder under your eXpress share: \\AltirisServer\eXpress\Bootwiz\platforms\Linux\x8 6\Drivers\std\lib\modules\_ver_\kernel\opt\bdc

You should see some additional entries in the NIC selection when rebuilding your Linux automation that will allow the 745's NIC to be recognized.
Attached Files
File Type: zip OptiPlex 745 DS68 Driver.zip (50.4 KB, 196 views)
dfrancis is offline   Reply With Quote
Old 03-29-2007, 09:22 AM   #5 (permalink)
 
Status: Super Altiris Admin
Join Date: 01-08-2007
Location: Scotland
Posts: 100


Hi dfrancis

I am running 6.8 SP1 and have downloaded your zip file and extracted it to the location specified. I am still getting error messages.

mount error 101 network is unreachable
rc.agent: warning: no express mount found, (as well as some other errors)

The Linux pxe driver also fails on a HP compaq dc7600 which is also using a Broadcom nic.

Thanks in advance

Stewfo
stewfo is offline   Reply With Quote
Old 03-29-2007, 09:51 AM   #6 (permalink)
 
Status: Super Altiris Admin
Join Date: 09-06-2006
Location: Columbus, OH
Age: 28
Posts: 296


stewfo: Did you go into PXE Configuration, edit your Linux boot image, and ensure that the newly copied NIC drivers were selected? You may also want to look at bumping them to the top of your list. There will be both "tg3" and "tg3.ko" drivers listed. The "tg3.ko" drivers are the newer ones that work with Broadcom NICs up through the 745.

Before I copied the tg3.ko file to that folder, I renamed it to tg3new.ko to make it stand out to me a little bit more. See the attached screenshot for an example of what you should see. Yours will say tg3.ko instead of tg3new.ko.
Attached Thumbnails
linux-automation-scripting-tips-tricks-bootdiskcreator-tg3.gif  
dfrancis is offline   Reply With Quote
Old 03-29-2007, 10:29 AM   #7 (permalink)
 
Status: Super Altiris Admin
Join Date: 01-08-2007
Location: Scotland
Posts: 100


Talking

Hi dfrancis

Cheers for the reply, i have fixed the problem.
I had both the x86 and the x64 checked but was booting a 32bit OS, as soon as i unchecked the x64 checkbox hey presto my 745 mounted the share.

I am away to give myself a slap

Cheers
stewfo is offline   Reply With Quote
Old 06-17-2007, 09:56 PM   #8 (permalink)
 
Status: Junior Altiris Admin
Join Date: 05-15-2007
Location: Sydney
Posts: 11


Another thing to keep in mind,

I have just spent the past two days wondering why firm will not work correctly in linuxPE.

I booted into LinuxPE, killed the adlagent process and saw that it kept coming up with an error message saying 'Firm: No such file or Directory' when i tried to run it.

I told PXE to not use the Linux x64 boot files and it started working properly.

Is anyone out there using x64 and had firm working?

I will post my linux scripts when I am finished if anyone is interested.
pretenda is offline   Reply With Quote
Old 06-18-2007, 07:15 AM   #9 (permalink)
 
Status: Super Altiris Admin
Join Date: 09-06-2006
Location: Columbus, OH
Age: 28
Posts: 296


Quote:
Originally Posted by pretenda
I booted into LinuxPE, killed the adlagent process and saw that it kept coming up with an error message saying 'Firm: No such file or Directory' when i tried to run it.

I told PXE to not use the Linux x64 boot files and it started working properly.

Is anyone out there using x64 and had firm working?
pretenda, are you running firm from the /mnt/ds/rdeploy/linux/x64 directory instead of /mnt/ds/rdeploy/linux?

In the script from my original post to this thread, there's a line that adds the /Rdeploy/Linux folder to the path variable. I'd be curious to see if you added /x64 onto the end of that if you'd see different results.

export PATH=$PATH:/mnt/ds/RDeploy/Linux
to
export PATH=$PATH:/mnt/ds/RDeploy/Linux/x64

We don't use x64 in our environment so I can only give suggestions. Linux doesn't seem to be too popular of an automation solution 'round these parts.
dfrancis is offline   Reply With Quote
Old 06-18-2007, 07:33 AM   #10 (permalink)
 
Status: Junior Altiris Admin
Join Date: 05-15-2007
Location: Sydney
Posts: 11


Aah, I don't appear to have that folder! Any ideas on how to get it? If so, I will give it a shot on my test PCs and post the results.

We have a nice blend of x64 and i386 pcs on our site, so for us just running the standard 32 bit kernel is probably a better solution.
pretenda is offline   Reply With Quote
Old 06-18-2007, 10:04 AM   #11 (permalink)
 
Status: Super Altiris Admin
Join Date: 09-06-2006
Location: Columbus, OH
Age: 28
Posts: 296


Alas I'm not sure. Are you running DS 6.8? And did you create an automation environment for the 64 bit one? That same folder should also exist in your eXpress share under RDeploy\Linux\x64
dfrancis is offline   Reply With Quote
Old 06-18-2007, 08:35 PM   #12 (permalink)
 
Status: Junior Altiris Admin
Join Date: 05-15-2007
Location: Sydney
Posts: 11


Yeah, I am running DS 6.8 SP1. I just flogged that those two files from another installation of DS It seems to be working now! Still don't know why they were missing.

Here is the tiny little script that i wrote to set the correct path depending on kernel type:


if [ -d /lib64 ]
then
export PATH=$PATH:/mnt/ds/RDeploy/Linux/x64
else
export PATH=$PATH:/mnt/ds/RDeploy/Linux
fi


Probably not the best way of doing it, but it works.
pretenda is offline   Reply With Quote
Old 08-03-2007, 10:52 AM   #13 (permalink)
 
Status: Junior Altiris Admin
Join Date: 05-17-2005
Location: Atlanta, GA
Posts: 14


Dfrancis,

Thanks for the linux tips! I have two questions:

1) You mentioned that with DS6.8 the linux automation will crash if you have more than one mount point. How does one correct this? I attempted to umount my mount points immediately after the actual imaging task, but i still get the "badness in do_exit" and the system never reboots after the imaging completes - it just crashes. Any ideas?

2) I want to implement your alternate mount points based on subnet, but our company uses the second octet of the IP address for different locations. What would be the proper way to modify your IPADDR=${LONGIPADDR:6:2} statement to return the second octet instead of the fourth?

Thanks in advance!

Eric
elgoodman is offline   Reply With Quote
Old 08-06-2007, 07:13 AM   #14 (permalink)
 
Status: Super Altiris Admin
Join Date: 09-06-2006
Location: Columbus, OH
Age: 28
Posts: 296


Quote:
Originally Posted by elgoodman
Dfrancis,

Thanks for the linux tips! I have two questions:

1) You mentioned that with DS6.8 the linux automation will crash if you have more than one mount point. How does one correct this? I attempted to umount my mount points immediately after the actual imaging task, but i still get the "badness in do_exit" and the system never reboots after the imaging completes - it just crashes. Any ideas?

2) I want to implement your alternate mount points based on subnet, but our company uses the second octet of the IP address for different locations. What would be the proper way to modify your IPADDR=${LONGIPADDR:6:2} statement to return the second octet instead of the fourth?

Thanks in advance!

Eric
Hi Eric,

In regards to your first question, I've actually observed the same thing with a single mount point as well. I'm not entirely sure why it does this, but I've had to create a rather large "Run Script" task that handles both imaging, driver injection, and HAL injection (as needed) rather than using a Deploy Image task then a Run Script task to do the necessary cleanup.

The second question pertaining to the second octet, that command is essentially taking the LONGIPADDR string, starting after its 6th character, and assigning the next two characters to the IPADDR string, so 10.20.30.40 truncates to 30. Assuming you're only using only two or only three digit subnets, it should be pretty easy to tweak to meet your needs.
dfrancis is offline   Reply With Quote
Old 08-06-2007, 07:57 AM   #15 (permalink)
 
Status: Junior Altiris Admin
Join Date: 05-17-2005
Location: Atlanta, GA
Posts: 14


FYI - i found a Altiris KB article that addresses the multiple mount point issue. There is a new rootfs file attached to this KB that you can download and extract to your %Program Files%\eXpress\Deployment Server\Bootwiz\platforms\Linux\x86\Base directory and it will fix the multiple mount crashing problem!

https://kb.altiris.com/display/1/kb/...id=34859&n=1&s=


Thanks for your help on the LONGIPADDR string! Sounds pretty easy now that I know what those numbers correspond to.

Cheers,

Eric
elgoodman is offline   Reply With Quote
Old 08-06-2007, 10:14 PM   #16 (permalink)
 
Kogenta's Avatar
 
Status: Junior Altiris Admin
Join Date: 01-31-2007
Location: Des-Moines
Age: 26
Posts: 14


Just what I was looking for

Thanks for the guide, it covered exaclty wat I wanted to know.
Go Linux automation ^^
Kogenta is offline   Reply With Quote
Old 09-04-2007, 12:39 AM   #17 (permalink)
 
Nick's Avatar
 
Status: Altiris Architect (Site Founder)
Join Date: 01-01-2005
Location: RDU, North Carolina, USA
Posts: 4,981


__________________
Scire potentia est (knowledge is power)
Nick is offline   Reply With Quote
Old 09-06-2007, 03:28 PM   #18 (permalink)
 
jlevicke's Avatar
 
Status: Altiris Admin
Join Date: 09-09-2005
Location: Phila, Pa
Age: 35
Posts: 45


The above script works nicely to mount a drive based of IP Address. Are there any thought as to how to get it to work with multiple IP Ranges. In other words if I have a IP like 1xx.xx.xx.xx and 1xx.xx.xxx.xx. I got the script working for all IP's using 7:2 but I also have to use 7:3.
jlevicke is offline   Reply With Quote
Old 09-06-2007, 09:21 PM   #19 (permalink)
 
Status: Super Altiris Admin
Join Date: 09-06-2006
Location: Columbus, OH
Age: 28
Posts: 296


I don't really have any easy way of testing it myself, but you may be able to tweak it like what I have below. Just put a period after the 2 digit octets and use the entire 3 digit octet. The below example should work if you have a network like 100.10.99.xxx and 100.10.100.xxx...

Code:
 LONGIPADDR=%AGENTIPADDR%
IPADDR=${LONGIPADDR:7:3}
case "$IPADDR" in
  '99.')
    mkdir /mnt/img
    asmbmount -b -d DOMAIN -f /Account.pwl //SERVERNAME/ShareName /mnt/img
    ;;
  '100')
    /bin/ln -s /mnt/ds/images /mnt/img
    ;;
esac
dfrancis is offline   Reply With Quote
Old 09-07-2007, 12:03 PM   #20 (permalink)
 
jlevicke's Avatar
 
Status: Altiris Admin
Join Date: 09-09-2005
Location: Phila, Pa
Age: 35
Posts: 45


Thanks for the Post but the script errored out when trying xx.) ansd using 7:3. What I ended up doing is changing the variable to %NICyIPGATEWAY% and typing out the full Gateway address for each subnet. No big deal but the script now works for all the IP Ranges. Thanks Again!

-John
jlevicke is offline   Reply With Quote
Old 10-24-2007, 12:40 PM   #21 (permalink)
 
bretthexum's Avatar
 
Status: Super Altiris Admin
Join Date: 03-01-2007
Location: OKC, OK
Posts: 107


We are looking into this as well. Right now, we have about 250 remote locations. We are using a single file to map the IP to the local machine that contains the image. In bootworks, it was fairly easy to parse that text file to match up the correct machine with the subnet. Any ideas on how we can use that text file using Linux to set the /mnt/image?? We are pretty new with Linux, so any help would be appreciated.
bretthexum is offline   Reply With Quote
Old 10-24-2007, 01:20 PM   #22 (permalink)
 
Status: Super Altiris Admin
Join Date: 09-06-2006
Location: Columbus, OH
Age: 28
Posts: 296


I'm not well versed in file I/O on Linux. You may need to play with the examples I have above around the LONGIPADDR and IPADDR variables to suit your needs.
dfrancis is offline   Reply With Quote
Old 10-25-2007, 03:59 PM   #23 (permalink)
 
bretthexum's Avatar
 
Status: Super Altiris Admin
Join Date: 03-01-2007
Location: OKC, OK
Posts: 107


After a few attempts I got it working.

Another question -

Is there any good documentation on adding drivers to the automation installation? I saw the post above about adding the files to eXpress\Bootwiz\platforms\Linux\x86 .... But I dont see a drivers folder there. Do I just need to create that path and put the drivers in? I am on SP2 if that makes a difference. We just got our first Optiplex 755 - looking to get these drivers in there.
bretthexum is offline   Reply With Quote
Old 10-27-2007, 07:05 AM   #24 (permalink)
 
Status: Super Altiris Admin
Join Date: 09-06-2006
Location: Columbus, OH
Age: 28
Posts: 296


This is the one big reason why I haven't upgraded from 6.8 SP1 to SP2.

The official "how to compile drivers" KB article is here: https://kb.altiris.com/articleRedirect.asp?aid=28260| and to be perfectly honest, I'm scared to death of it since my entire knowledge of Linux is basically in this thread.
dfrancis is offline   Reply With Quote
Old 02-14-2008, 01:23 PM   #25 (permalink)
 
Status: Junior Altiris Admin
Join Date: 02-14-2008
Location: California
Posts: 3


Question

I'm having NIC throughput problems with the Dell 745 using our Linux automation. The drivers I have are OK; however, the network traces show an issue with the default line speed and duplex settings for the driver.

On the network configuration for the tg3, in the PXE boot image configuration utility, it states that the drivers are using advanced network adapter settings: custom; however, where are these settings provided. I've attempted to "influence" the kernel by injecting line_speed, duplex, auto_flow_control, etc. settings with the insmod command to no avail. Does anyone know where I can customize the NIC driver settings in the boot image? Is there a modules.conf that I can add?

TIA

Last edited by SONGS; 02-14-2008 at 01:26 PM..
SONGS is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Powered by vBadvanced CMPS v3.0 RC2

All times are GMT -4. The time now is 01:47 PM.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
vB.Sponsors
Altirigos