# Flag packages not to autoremove



## Alain De Vos (May 13, 2022)

I want to autoremove packages but flag some to never autoremove.
I think it's not possible but it would be a nice feature.


----------



## SirDice (May 13, 2022)

Alain De Vos said:


> I think it's not possible but it would be a nice feature.


pkg-set(8):

```
-A 01, --automatic 01
                Set automatic flag for the package: 0 is not automatic, 1 is
                automatic.  This affects the operation of pkg-autoremove(8).
```

pkg-autoremove(8) only removes packages that have 'A' set to 1 and have nothing depending on them anymore. So setting A to 0 on a package will prevent pkg-autoremove(8) from removing it.


----------



## Lamia (May 13, 2022)

Am I correct to use pkg-lock as an alternative way to prevent such autoremove?


----------



## SirDice (May 13, 2022)

Lamia said:


> Am I correct to use pkg-lock as an alternative way to prevent such autoremove?


pkg-lock(8) would prevent it from being removed, yes. But it will also prevent it from being updated.


----------



## grahamperrin@ (May 18, 2022)

Alain De Vos said:


> … flag some …



Which ones?


----------



## Alain De Vos (May 18, 2022)

I have not kept a record. And now i can't find out anymore.
php74-mysqli was one of them.


----------

