Video Screencast Help

Package Refresh Errors on the Notification Server - Cleaning Out the Dusty Closet!

Created: 18 Feb 2009 • Updated: 18 Feb 2009 | 4 comments
Language Translations
BRING's picture
+3 3 Votes
Login to vote

One of the more frustrating systems infrastructure management problems in using and maintaining the Symantec Management Platform (Notification Server), is how to clean up outdated or broken Software Delivery packages. In many cases, the administrator may not know that he has Software Delivery tasks in this unusable state.

Many administrators create Software Delivery packages for regular distribution, for applications that are used in their environment on a daily basis. These particular application packages have a regular refresh and maintenance cycle. However, there are numerous "One-off" packages and related programs that have been sent to a small or unique subset of computers, possibly just one time, to resolve a specific problem, to remediate a non-supported application, or simply install a limited-use software tool. In many of these cases, these applications and their resulting packages just sit around and finally, as the source files get removed from the NS, or the package gets disabled, (or, in the case of Patch Management, the bulletins get superseded), the following error message is observed in the Notification Server log files:

"The NS failed to refresh package snapshot. Could not access the package path. Package:<GUID or Text>."

You can also see the text of this in the screenshot below:

Whether these come from superseded patches, or a broken software delivery task, the result is almost always additional processing load on your notification server as it tests the validity of those packages, processing thru the default number of retry cycles when packages get in this state. Additional evidence will appear in the form of clogged up log files, repeating these messages every 10 minutes, by default. This happens because the Package Refresh scheduled task runs every 10 minutes, to ensure that package codebase information is current. While our screenshot only shows one package in that state, if you have numerous packages that are in this state, your error logs can take on a bright red hue at that regular interval!

Identifying the Source of the Broken Packages

First, you will need to identify whether or not you are experiencing problems with generic Software Delivery packages and jobs, or if the problems are coming from superseded patches from Patch Management. The primary tool for determining this is the Log Viewer. Let first take a look at Software Delivery.

Software Delivery:

The log entries for Software Delivery will generally show a source location for a package server, which should be familiar to you. As shown in the previous screenshot, the package is usually in blue, indicating that you can click on it, and bring up the Log Viewer's Item Browser, shown below:

The Item Browser in the Log viewer, has some great information. The Summary tab offers general details about the object selected, in our case, a software delivery package. Reviewing the contents of the Classes tab should confirm that we have a Software Delivery package to work with.

Patch Management:

While the primary focus of this article is to address the removal of problematic Software Delivery packages that are NOT coming from Patch Management, please find the appropriate reference material in the Knowledge Base to resolve any of the Patch Management Solution problems that you may encounter, such as superseded or disabled bulletins and their related packages and programs. Specifically - KB article How to completely remove superceded bulletins from the environment (37756) can be used to resolve bulletins in this state.

So what is the problem? More than likely, since all Software Delivery tasks usually have a package, program, and advertisement, one or more of those components is missing or incorrectly referenced. It may have objects that it needs that are not referenced correctly themselves. Once in this state, it is difficult to fix these problems. Generally, it is better to remove them, and that is what the remainder of this article focuses on.

As a general rule, you will want to attempt to remove packages that you are no longer using thru the Notification Server console menus. If these packages cannot be deleted from the console directly, additional procedures outlined below will be necessary to help you remove these "problem packages" gracefully.

Getting Ready

Once you have identified the source solution of the problem, you need to plan out how to get them removed. One of the best ways to get started is to see what items are "referenced" to the package or program we want to remove, and attempt to delete those items. Let's get access to the console, and make sure we have the tools necessary.

First, open a remote session into your Notification Server console. The Remote Desktop Protocol (RDP), using the "MSTSC /Console" command provides you with the access you will need to resolve these issues. You should have a command prompt window open, pointed to the ...\Notification Server\bin folder. This is necessary as there will more than likely be some command prompt utilities needed as you clean these packages up. And, while the process is reasonably straightforward, there is some trial and error involved.

You will also need a copy of the DELETEITEMS.cs nscript copied to your Notification Server. This is normally copied to the ...\Notification Server\bin folder. A zip file containing all of the necessary files is attached to the article.

Once the above items are all in place, it is always a good idea to attempt to remove the package via the console menus. The screenshot below shows how we have found the package in question, and, using the right-click menu, are attempting to delete the package.

Identifying the Culprits

That is exactly what we want to do - figure out why we cannot delete these packages. Once you have clicked on delete, the package normally would be deleted. However, what you will probably see is something like the next screenshot:

This lets us know that there are other items referencing ours. Go ahead and click on the blue link "Click here to display a reference dependency report for the selected item." You will now see the screenshot below:

We now notice that there are two items referencing this object. Experience has proven that usually deleting the bottom object, (in this case a Software Delivery Task) will successfully clean the dependent reference. Browsing in the console to this specific task, deleting it, and then returning the package reference in the console and deleting it usually resolves the simplest of these issues.

Stubborn Items

Often the above steps will clean up the packages or tasks that are causing the errors in the logs. Sometimes it is necessary to use a "bigger hammer" to fix problems like these.

At this point, the "bigger hammer" disclaimer is necessary. The procedures and tools shown below will cause data loss. This is good, as long as the data loss is data that you are expecting to lose (delete). You can, without careful use, cause items to be removed from your database that you DON'T want to lose. Please double check any guid data you collect and use to make sure it is what you want to remove.

To troubleshoot and clean these up, some additional understanding is required. That understanding is simply a review of what our problem is, that each of these items is referencing something that no longer exists or is incorrectly configured in the database. Understanding that, we now need to begin a deeper search to find out who is referencing what and remove those references.

To do this, let's return to the Altiris Log Viewer. As we saw earlier, the Log Viewer has an Item Browser which provides information about the object.

While the other tabs have valuable information, we will want to focus our attention on the References tab; so that we can see what other items are referencing this item. Clicking on the References tab lists the other objects and references as shown in the screenshot below. One or more of these items will need to be deleted first, in order to remove the other references.

You ask yourself - "Which one do I remove?" Generally, experience has shown that the items that do not have a name listed are a good bet to choose. So double-click on that item, and then a new Item Browser opens, displaying the guid in the lower left hand corner. Using the Windows Copy function, capture that guid.

Since removing some of these items takes a bit more trouble, we are going to use three different pieces to achieve our ends.

  1. We will use a script execution tool called NSCRIPT, which comes with Notification Server. This runs from a command prompt, and is found in the ...\Notification Server\bin folder, and executes pre-defined scripts against the Notification Server database.
  2. We are also going use a pre-defined script called DELETEITEMS.cs. This script essentially calls the DELETEITEM method, found in the Notification Server source code. The script itself is contained at the end of this article.
  3. Lastly, to properly define what we want to delete, the DELETEITEMS.cs script requires a SQL query to provide the scope of guids for items we want to delete. The key element to remember is that the script must output an item guid, or a guid of an object referenced in the item table. So...

Open a command window on the Notification Server, and change drives and directories until you reach the ...\Notification Server\bin folder. Assure that deleteitems.cs is in this folder.

The command syntax is:

NSCRIPT deleteitems.cs "Select guid from item where guid ='(paste the copied guid from the Item Browser here)'"

As you can see in the screenshot below, we have pasted the guid in the correct location

Once run, this should delete the object in question. There may be cases where you get a failure. This simply means that the object you are trying to delete is referenced by another object, and you will need to peruse the Item Browser list again, and check on other references. Usually it takes a couple of times to find the correct one.

There is also included in the attached zip file a DELETEITEMS.exe file. You can also use the following syntax with that binary:

Deleteitems " Select guid from item where guid ='(paste the copied guid from the Item Browser here)'"

This will perform the same function.

However, once found and removed, the earlier references then delete very easily.

This will help you resolve those pesky package refresh errors in the logs.

DELETEITEMS.CS

Deleteitems.cs comes thanks to the Altiris Development staff. The text below is the content of the script. The script does require a few other files which are included as a part of the zip file. Simply copy the zip file into the ...\Notification Server\bin folder, and extract the contents there.

using System;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Collections;
using System.Collections.Specialized;
using Altiris.Common;
using Altiris.NS.ContextManagement;
using Altiris.NS.ItemManagement;
using Altiris.NS.StandardItems;
using Altiris.NS.Security;


namespace DeleteItemsScript
{
	/// <summary>
	/// Summary description for Class1.
	/// </summary>
	class DeleteItems
	{
		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main(string[] args)
		{
			string StrQuery;
			GuidCollection gc = new GuidCollection();
			
			SecurityContextManager.SetContextData();
			Guid itemGuid = Guid.Empty;
			int rowcount = 0;

			if ( args.Length == 0 ) 
			{
				System.Console.WriteLine("Usage: DeleteItems.exe [SQL Query]");
				return; }

			StrQuery = args[0];
			
						
			using (DatabaseContext context = DatabaseContext.GetContext())
			{
				SqlCommand cmd = (SqlCommand)context.CreateCommand(StrQuery);
				System.Console.WriteLine("Running Query: \"{0}\"",StrQuery);
			
				using(SqlDataAdapter adapter = new SqlDataAdapter(cmd))
				{
					DataTable collTable = new DataTable();
					adapter.Fill(collTable);
	
					foreach(DataRow dr in collTable.Rows) 
					{
						/*System.Console.WriteLine((Guid)dr[0]);*/
						IItem ItemToDelete = Item.GetItem((Guid)dr[0]);
						
						if( ItemToDelete == null ) 
						{
							throw new ApplicationException( "The GUID does not match an item" ); }
						else 
						{
							System.Console.WriteLine("Deleting item: {0}",dr[0]);
							try 
							{
								ItemToDelete.Delete();	}
							catch ( Exception ex ) 
							{
								throw new ApplicationException(ex.Message); }
						}
						rowcount++;
					}				
				}
				
				
			}
			System.Console.WriteLine("Processed {0} rows from datatable.",rowcount);
		}
	}
}


License: Altiris EULA
By downloading this software, you agree to the terms and conditions in the Altiris End User License Agreement
Support: User-contributed tools on the Juice are not supported by Altiris Technical Support. If you have questions about a tool, please communicate directly with the author by visiting their profile page and clicking the 'contact' tab.

Comments 4 CommentsJump to latest comment

Pascal KOTTE's picture

Hi
How to completely remove superceded bulletins from the environment (37756),

I do not find this KB but I got 40899 !
kb.altiris.com/article.asp

Any better solution or tools to clean obsolete patchs overloading mass of package servers ?

~Pascal @ Kotte.net~ Do you speak French? Et utilisez Altiris: venez nous rejoindre sur le GUASF

+1
Login to vote
BRING's picture

Here are th notes on how to perform what is in 37756

1. First, identify which bulletins are ones which are superseded by running the report "Superseded Bulletin Summary"
2. Disable those tasks from Tasks - Software Management - Patch Management - Software Update Task - Microsoft. Make note of the programs used by the bulletins by going to the Advanced tab, which will need to be known when going to step 5.

3. Disable the individual bulletins.

4. Delete the Task. If the task is part of a task bundle (Patch 6.2 feature) then edit the Task and remove that bulletin from the bundle by selecting the link marked "Software Bulletin" and X out that bulleting. Then hit Apply.

5. Run the report "Software Update Aggregate Collection" and make sure the collections for that bulletin are now removed after completing step 3. If removed from a bundle then you may need to delete the collections from this report by Right-Clicking and choose Delete.

6. Go to Resources tab - Resources - Software Management - Software Patch Packages - Software Updates - Security Updates - right-click the programs used by the superseded bulletins and choose Delete.

That will remove the programs from the Package Servers and clients.

+1
Login to vote
Eisenkarl's picture

Hi,

what can I do if I use Altiris 7? Every 10 Minutes I will get the error

The NS failed to refresh package snapshot. Could not access the package path. Package:BIOS Upgrade 64-bit Package (c981246f-038f-4318-b538-03d4aabf70bf), Path:E:\Altiris\Notification Server\NSCap\Bin\Win32\X86\Dell Client Manager\BIOS Settings\4b7b30c1-7e61-4653-9a1e-224d28e4e680

I've made an Migration from NS 6 to NS 7.

The way in this article didn't work. Has anybody an idea?
The KB-articles 20888, 38101 21228 doesn't work here for NS7

Thankyou for your help.

Regards

Eisenkarl

+1
Login to vote
BRING's picture
Software Delivery offers the ‘Delete package after’ option to handle this. In 7 this option is held by each Task that pushes the respective package down, under Advanced options.
 
+1
Login to vote