<p>These are built-in grains, which are collected at minion startup. <a href="https://github.com/saltstack/salt/tree/develop/salt/grains" rel="nofollow noreferrer">Here's the code</a> responsible for generating them.</p>

<p>You cannot remove them, but you can <a href="https://docs.saltstack.com/en/latest/topics/grains/index.html" rel="nofollow noreferrer">overwrite them</a>, for example to an empty value in <code>/etc/salt/grains</code>:</p>

<pre><code>osfinger: null
</code></pre>

<p>or with <a href="https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.grains.html" rel="nofollow noreferrer">grains execution module</a>: <code>salt minion1 grains.delval osfinger</code>.</p>

<p>Keep in mind that some of the core grains are essential for the correct functioning of salt, e.g. module providers for <code>pkg</code> module rely on them.</p>

CC BY-SA 4.0
2018-08-03T07:12:10.763Z
so there is no location as such of grains storage in minion and master.
Dheeraj Chelaramani
CC BY-SA 4.0
2018-08-03T08:04:12.180Z
Yes, there's only cache which you can clear with `salt-run cache.clear_grains` or sync grains with `salt-run saltutil.sync_grains`.
A. Z.
CC BY-SA 4.0
2018-08-03T09:09:46.593Z
I tried something:                                                                                    
1.Created some grains in minion
2 Synced the grains with the master
3 Cleared cache from the master
4 Then also it is showing the grains
PS: This condition is after clearing cache and not syncing
Dheeraj Chelaramani
CC BY-SA 4.0
2018-08-03T09:15:39.170Z
Yes, the cache is just that, a cache. When the grains are needed, and they are not in cache, they will get synchronized automatically. It's impossible to remove core grains.
A. Z.
CC BY-SA 4.0
2018-08-03T10:42:49.933Z
I tried the same with custom grains but they are still present.
Dheeraj Chelaramani
CC BY-SA 4.0
2018-08-03T12:47:29.230Z
For custom grains use the `salt minion1 grains.delval customgrain` as the answer suggest, then. See: https://docs.saltstack.com/en/latest/topics/grains/index.html
A. Z.
CC BY-SA 4.0
2018-08-02T16:25:32.877Z
2018-08-02T16:25:32.877Z
A. Z.
<p>I am trying to completely remove the grains from the system. I have one master and one minion setup(minion id= minion1). I am doing</p>

<blockquote>
  <p>salt minion1 grains.ls</p>
</blockquote>

<p>that is listing me all the grains</p>

<p>Now I removed data.p which is the cache memory for the grains in master</p>

<pre><code>path : /var/cache/salt/master/minions/minion1/data.p
</code></pre>

<p>Without running a salt_sync or any other command for sync I am again doing.</p>

<pre><code> `salt minion1 grains.ls`,
</code></pre>

<p>It's returning the same result.(The grains are still somewhere stored.</p>

<p>Where exactly it is storing the grains and how to delete that?</p>

<salt><devsecops>
Why unable to find the exact path for grains storage in master?
Dheeraj Chelaramani
# Why unable to find the exact path for grains storage in master?

(Asked by: username_0 on 2018-07-13)

I am trying to completely remove the grains from the system. I have one master and one minion setup(minion id= minion1). I am doing

salt minion1 grains.ls

that is listing me all the grains
Now I removed data.p which is the cache memory for the grains in master
path : /var/cache/salt/master/minions/minion1/data.p

Without running a salt_sync or any other command for sync I am again doing.
 `salt minion1 grains.ls`,

It's returning the same result.(The grains are still somewhere stored.
Where exactly it is storing the grains and how to delete that?

**Tags:** salt, devsecops


---

## 1 answers

### Answer by username_1 on 2018-08-02. Score: 2

These are built-in grains, which are collected at minion startup. Here's the code responsible for generating them.
You cannot remove them, but you can overwrite them, for example to an empty value in /etc/salt/grains:
osfinger: null

or with grains execution module: salt minion1 grains.delval osfinger.
Keep in mind that some of the core grains are essential for the correct functioning of salt, e.g. module providers for pkg module rely on them.

> **Comments:**
> **username_0**: so there is no location as such of grains storage in minion and master.  
> **username_1**: Yes, there's only cache which you can clear with `salt-run cache.clear_grains` or sync grains with `salt-run saltutil.sync_grains`.  
> **username_0**: I tried something:                                                                                     1.Created some grains in minion 2 Synced the grains with the master 3 Cleared cache from the master 4 Then also it is showing the grains PS: This condition is after clearing cache and not syncing  
> **username_1**: Yes, the cache is just that, a cache. When the grains are needed, and they are not in cache, they will get synchronized automatically. It's impossible to remove core grains.  
> **username_0**: I tried the same with custom grains but they are still present.  
> **username_1**: For custom grains use the `salt minion1 grains.delval customgrain` as the answer suggest, then. See: https://docs.saltstack.com/en/latest/topics/grains/index.html  

---

