Anyway to remove software on a client from munki database via command line?

760 views
Skip to first unread message

Hayden

unread,
Apr 18, 2013, 12:29:17 PM4/18/13
to munk...@googlegroups.com
So when munki removes something on a client, the log states:

"Removing package data from internal database..."

Is there a way to remove a package via command line on a client without munki? How do you remove something from it's internal database?

Nick McSpadden

unread,
Apr 18, 2013, 12:31:25 PM4/18/13
to munk...@googlegroups.com
That'd be the "pkgutil" command.  Check out the manpage for it for details, but generally sudo pkgutil --forget com.package.name does the trick.


--
You received this message because you are subscribed to the Google Groups "munki-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to munki-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
--
Nick McSpadden
Client Systems Manager
Schools of the Sacred Heart, San Francisco

Gregory Neagle

unread,
Apr 18, 2013, 12:32:50 PM4/18/13
to munk...@googlegroups.com
Read the 1000+ lines of code in /usr/local/munki/munkilib/removepackages.py and replicate the functionality.

Or _use_ it:

/usr/local/munki/munkilib/removepackages.py pkgid [pkgid ...]

/usr/local/munki/munkilib/removepackages.py --help 
for more options

-Greg

Gregory Neagle

unread,
Apr 18, 2013, 12:33:39 PM4/18/13
to munk...@googlegroups.com
On Apr 18, 2013, at 9:31 AM, Nick McSpadden <nick.mc...@sacredsf.org> wrote:

That'd be the "pkgutil" command.  Check out the manpage for it for details, but generally sudo pkgutil --forget com.package.name does the trick.

That removes the pkgid from pkgutil's database, but does not remove the items installed by the package itself.

-Greg

Hayden

unread,
Apr 18, 2013, 12:38:49 PM4/18/13
to munk...@googlegroups.com
Let's just say I have a simple package that installs some files into a dir, nothing else - munki is still placing a receipt into it's 'database' and if I manually remove that dir and try to reinstall it via munki it thinks it's still installed because of this receipt. I could just uncheck the box, remove it, and then reinstall but I was just hoping for a command that would remove the entry in the 'database' manually, which I thought was the ApplicationInventory.plist in /Library/Managed Installs/


Gregory Neagle

unread,
Apr 18, 2013, 12:40:06 PM4/18/13
to munk...@googlegroups.com
In that case, `pkgutil --forget pkgid` will accomplish what you want.

-Greg

On Apr 18, 2013, at 9:38 AM, Hayden <crackh...@gmail.com> wrote:

Let's just say I have a simple package that installs some files into a dir, nothing else - munki is still placing a receipt into it's 'database' and if I manually remove that dir and try to reinstall it via munki it thinks it's still installed because of this receipt. I could just uncheck the box, remove it, and then reinstall but I was just hoping for a command that would remove the entry in the 'database' manually, which I thought was the ApplicationInventory.plist in /Library/Managed Installs/


No, that's an inventory of what apps are installed on a machine.

Hayden

unread,
Apr 18, 2013, 12:43:47 PM4/18/13
to munk...@googlegroups.com
Ok will try, thank you.

jps3

unread,
Apr 19, 2013, 3:02:20 PM4/19/13
to munk...@googlegroups.com
I've been using this for awhile since I discovered it. It's very helpful for those situations, especially testing or special computers, where I need to clean something up. Of course, be careful, there are a lot of sloppy packages out there that do all kinds of oddball things, so this method may not fix/remove everything. It's also nice since I can be run via ssh, ARD Send Unix command, etc.

Gregory Neagle

unread,
Apr 19, 2013, 3:13:39 PM4/19/13
to munk...@googlegroups.com
On Apr 19, 2013, at 12:02 PM, jps3 <jp...@lehigh.edu> wrote:

I've been using this for awhile since I discovered it.

What exactly?

It's very helpful for those situations, especially testing or special computers, where I need to clean something up. Of course, be careful, there are a lot of sloppy packages out there that do all kinds of oddball things, so this method may not fix/remove everything. It's also nice since I can be run via ssh, ARD Send Unix command, etc.

If you mean `pkgutil --forget com.foo.somepkg`, it doesn't remove _anything_ except the receipt in pkgutil's database.
 
-Greg
Reply all
Reply to author
Forward
0 new messages