SCCM 2012: Two ways to deploy Linux with SCCM :-)

SCCM have recently launched service pack 1 with Linux agent for management of Enterprise Linux distributions. People ask me about OS deployment as it’s not supported, but still you can kind of do it.

Think of this, you have Windows PE and the ability to run commands in a task sequence. So if you have the tools you can do anything you want. SCCM does it in the same way With .wim files, it’s all about the Tools like dism or imagex. Regarding Linux i’ve  tested two scenarios.

  1. Distribute a Linux Live ISO: Most Linux distributions allows you to run a Live OS from a DVD, for troubleshooting or trial of the operating system. With the BootLoader Grub4Dos you can boot from ISO files. So the only thing you have to do is install this bootloader while in windows pe, copy the Live ISO to your local drive and configure boot loader to boot from it. Reboot to local disk and your Linux Live OS will be loaded.
  2. Actually deploy a image: In Linux you can use DD to create a image of your harddrive. There also is a DD version for DOS. So you can actually create a valid image of your Linux installation and deploy it with SCCM. Please read more on dd here: http://www.linuxweblog.com/dd-image

Be aware, this is kind of stoneage technology, and you need to put some effort into creating your Linux distribution. You will not be able to run task sequence engine within the operating system. But if you are skilled with Linux you may be able to script the agent installation on first boot, then you will have control again 🙂

Example:

1. Create a package in Your environment this package should contain Your Linux Image and DD for dos. (download it here). Do not create a program for the package as it’s not needed. But I recommend you to enable “Copy the content in this package to a package share on distribution Points” this will allow you to run the task sequence directly from DP later. Please read previous blog post regarding this: http://systemcenter.no/?p=331

2. Create a command line task sequence step, this will run diskpart /s diskpartscript.txt.

The diskpart script looks like this:

Select disk 0
clean
 

The task sequence step looks like this (notice i’ve added the Linux deployment package as Reference for the command line step):

3. Use DD (for dos) to extract the image to disk.

4. Deploy the task sequence to unknown or known computers, run ts directly from DP and enjoy.

 

2 thoughts on “SCCM 2012: Two ways to deploy Linux with SCCM :-)

  1. I love this! Such a clever way of extending the capabilities of System Center to do something useful.

    If you want to run a ConfigMgr install script upon linux client boot (and you do want to!) simply add a script to the /etc/rc.local directory on your Linux host (kind of asuming you’re using a Debian based distro like Ubuntu). You’ll need to copy the content from the Configuration Manger client for Additional Operating systems and include it in your system to be deployed. Unfortunately, you will probably need to control software distribution and such using a mandatory advertisement to your Linux system.

    In the above mentioned directory, add a script with lines similar to this:

    “sudo ./install –mp whatever –sitecode ### -ccm SLES11x86.1.0.0.4014.tar”

    If you’re interested in which sort of commands you should use to create an image from within Linux, a post on Stack Overflow gives us some great examples from which, we get a script like this to run on our linux host:

    mkdir /mnt/hdb
    mount /dev/hdb /mnt/hdb
    dd if=/dev/zero of=/mnt/hdb/zero

    rm /mnt/hdb/zero
    umount /mnt/hdb

    dd if=/dev/hdb of=/dev/sdb bs=100M | gzip -c > /image.img;

    Sources :

    http://blogs.technet.com/b/meacoex/archive/2013/02/13/manage-suse-linux-with-system-center-2012-sp1.aspx

    http://www.microsoft.com/en-us/download/details.aspx?id=36212

    http://serverfault.com/questions/4906/using-dd-for-disk-cloning

  2. My bad I was doing the following when capturing my linux OS image:

    dd if=/dev/sda1 of=/media/usb/capture.img bs=512

    instead of:

    dd if=/dev/sda of=/media/usb/capture.img bs=512

    you can check if the boot sector is copied in linux by doing the following command in the terminal.

    file /media/usb/capture.img

    This should output some text and near the start of the output it should read “x86 boot sector” or something similar, if it does not then you have likely just copied the partition so your image wont have grub or boot sector copied.

    I am yet to test this and one major issue is the file sizes. I used a 9 GB partition and dd has captured a 9.7 GB file, I hope when copied to new disk it doesn’t leave me with a 9 GB partition with lots of unallocated space at the end of the drive. Might be a good idea to come up with some linux scripts to extend the drive after the image is copied to the drive.

    Thanks

Leave a Reply

Your email address will not be published.