Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PRUNE_MODULES=1 does not seem to do anything #306

Closed
kaoscoach opened this issue Jun 11, 2020 · 13 comments
Closed

PRUNE_MODULES=1 does not seem to do anything #306

kaoscoach opened this issue Jun 11, 2020 · 13 comments

Comments

@kaoscoach
Copy link

I had a previous Pi running Raspbian that ran out of disk space and had to rebuild. Since my reinstall I have been very cognizant of checking its disk space. After a couple of rpi-update's I have tried running it with the PRUNE_MODULES=1 setting but I still see old versions in /lib/modules. What files is PRUNE_MODULES=1 supposed to be removing?

@popcornmix
Copy link
Collaborator

See: #197
For me it prints out:

Pruning /lib/modules/5.4.42+
Pruning /lib/modules/5.4.28-v7l+
Pruning /lib/modules/4.19.79-v8+
Pruning /lib/modules/4.19.79+
Pruning /lib/modules/4.19.23-v7+
Pruning /lib/modules/4.19.84-v7l+
Pruning /lib/modules/4.19.84-v7+
Pruning /lib/modules/4.19.57+
Pruning /lib/modules/5.5.0-rc5+
Pruning /lib/modules/5.5.0-rc5-v7l+
Pruning /lib/modules/4.19.60-v7+
Pruning /lib/modules/4.19.57-v7+
Pruning /lib/modules/4.19.1-v7+
Pruning /lib/modules/4.19.85-v8+
Pruning /lib/modules/4.19.80-v8+
Pruning /lib/modules/4.19.105-v7l+
Pruning /lib/modules/4.19.56+
Pruning /lib/modules/4.19.37-v7+
Pruning /lib/modules/4.19.64-v7l+
Pruning /lib/modules/4.19.102-v8+

It deletes any directory in /lib/modules/* whose content only include files of type *.ko or modules.* (i.e. default kernel modules)

@kaoscoach
Copy link
Author

I don't get that output or anything like that. I am using pi-hole on Raspbian. Is there something I should do to help troubleshoot?

@popcornmix
Copy link
Collaborator

Can you show me what you entered to run rpi-update?

@kaoscoach
Copy link
Author

sudo PRUNE_MODULES=1 rpi-update

@kaoscoach
Copy link
Author

Looking at #197 helped. I deleted the /root/.firmware_revision and re-ran, which worked. Is deleting /root/.firmware_revision a requirement?

@popcornmix
Copy link
Collaborator

It deletes all modules before installing the new ones. It will only do this if you actually updating. Otherwise you'd be left with no modules at all.

@kaoscoach
Copy link
Author

So I performed the command incorrectly? As I said, if I run, sudo PRUNE_MODULES=1 rpi-update on an up-to-date system, nothing happens for me. Only worked after I deleted /root/.firmware_revision.

@popcornmix
Copy link
Collaborator

It only deletes modules when it has an update to do. If you are up to date the script does nothing.

@kaoscoach
Copy link
Author

I guess I am confused. I thought running sudo PRUNE_MODULES=1 rpi-update on an up-to-date system would remove unneeded/unused files. But you are saying I have to run, sudo PRUNE_MODULES=1 rpi-update on an out of date system in order for it to work? Is there a way to do a uname -a and delete all that do not correspond to the current running kernel? At least that way it could remove unneeded/unused files on an up-to-date system while keeping those that are currently in use.

@popcornmix
Copy link
Collaborator

The description of PRUNE_MODULES is "Allows you to delete unused module directories when doing an update."
You need to have an update to do for it to do anything. As you discovered you can force an update by removing /root/.firmware_revision.
There are no plans to change the behaviour.
If you always use PRUNE_MODULES=1 in the future when running rpi-update your sdcard space will no longer fill up with old modules.

@kaoscoach
Copy link
Author

But if I use PRUNE_MODULES=1 in the future, won't that delete a possible working version of my system? When I reboot and if I deleted the modules prior to the update, I would not be able to fix it since those files would be deleted?

Initially, I wasn't sure which files were 'needed', so I guess if you do not plan to change the behavior, I will just script a way to delete the unneeded directories after comparing it to a current running 'uname -a'. Since I now know modules that do not match the uname are not needed. Thanks.

@popcornmix
Copy link
Collaborator

PRUNE_MODULES=1 only deletes modules before it installs new ones. When you reboot it will use the new modules that have been installed (along with the new kernel which only works with the new modules).

@kaoscoach
Copy link
Author

I guess I am the only on that backs up their kernels. Feel free to close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants