Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Custom Cleanup Script Worked, But Now This...

  1. #1
    Join Date
    Aug 2014
    Beans
    543
    Distro
    Lubuntu 22.04 Jammy Jellyfish

    Custom Cleanup Script Worked, But Now This...

    This may be specific to Lubuntu, but I'm not sure.

    My custom cleanup script worked phenominally on 22.04, but on 24.04 the script removes and purges those things which I install, such as Bleachbit, Kolourpaint, Falkon, etc.

    What changed from 22.04 that might cause this?
    Last edited by wyattwhiteeagle; 3 Weeks Ago at 05:42 AM.

  2. #2
    Join Date
    Mar 2011
    Location
    U.K.
    Beans
    Hidden!
    Distro
    Ubuntu 22.04 Jammy Jellyfish

    Re: Custom Cleanup Script Worked, But Now This...

    If you build optional logging into your custom script that might be a start.

  3. #3
    Join Date
    Aug 2014
    Beans
    543
    Distro
    Lubuntu 22.04 Jammy Jellyfish

    Re: Custom Cleanup Script Worked, But Now This...

    Quote Originally Posted by dragonfly41 View Post
    If you build optional logging into your custom script that might be a start.
    Optional logging, hmm

    Here's the current script, any corrections/suggestions are greatly appreciated.
    I run this script with sudo

    Code:
    # Delete "orphaned" packages
       deborphan | xargs apt remove --purge -y
    
    # Houseclean over 10 days
       journalctl --vacuum-time=10d
    
    # Delete old logs
       find /var/log -type f -name "*.gz" -delete
    
    # Remove packages that didn’t install completely
       apt autoclean -y
    
    # Clean your apt-cache
       apt clean -y
    
    # Clear thumbnails
       rm -rfv ~/.cache/thumbnails
    
    # Clear cache
       du -sh /var/cache/apt
    
    # Remove software dependencies that you no longer need
       apt autoremove -y
    
    # Kernel and other Cleanups after Deletions
       apt autoremove --purge -y
    Last edited by wyattwhiteeagle; 3 Weeks Ago at 01:50 PM.

  4. #4
    Join Date
    Mar 2010
    Location
    /home
    Beans
    9,684
    Distro
    Xubuntu

    Re: Custom Cleanup Script Worked, But Now This...

    I would be tempted to suggest that perhaps the deborphan part of your script is responsible for purging packages that you want to keep.

    With your current Lubuntu 24.04 setup, deborphan might be identifying some critical or installed applications (like Bleachbit, Kolourpaint, Falkon) as orphaned due to changes in package dependencies or configurations.

    One possible solution would be to whitelist packages you do not want removed.

    For example, create or modify the /etc/deborphan.conf file and add these lines:
    Code:
    keep Bleachbit
    keep Kolourpaint
    keep Falkon
    Note, I am not a Lubuntu user so this is kind of guesswork on my part.

    Let's wait for others to add their thoughts before you make any changes.

  5. #5
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Custom Cleanup Script Worked, But Now This...

    That script makes all sorts of dangerous assumptions.
    It doesn't specify the script interpeter to be used on the first line. That is non-standard.

    The commands are dependent on the PATH, which can be dangerous. Best to fully specify the exact, absolute, location for any program used in a script. For example, "apt" should be "/usr/bin/apt". Find the full path for the other commands too and specify them.

    Code:
    # Clear cache
       du -sh /var/cache/apt
    doesn't actually clear anything. It just lists the size. Incorrect comments are a maintenance nightmare. The /usr/bin/apt autoclean and /usr/bin/apt autoremove options do the cleaning.

    Is there a reason you don't just have the journald config file limit log file sizes? Then you would need the /usr/bin/journalctl command at all. Set it once and forget about it. There are good reasons to do it in a script, but having the system automatically handle things where it can easily is usually preferred. You might want to also address the text log files with /etc/logrotate.d/ files to ensure you limit sizes and have appropriate log rotation there too.

  6. #6
    Join Date
    Aug 2014
    Beans
    543
    Distro
    Lubuntu 22.04 Jammy Jellyfish

    Re: Custom Cleanup Script Worked, But Now This...

    Quote Originally Posted by Rubi1200 View Post
    I would be tempted to suggest that perhaps the deborphan part of your script is responsible for purging packages that you want to keep.


    With your current Lubuntu 24.04 setup, deborphan might be identifying some critical or installed applications (like Bleachbit, Kolourpaint, Falkon) as orphaned due to changes in package dependencies or configurations.


    One possible solution would be to whitelist packages you do not want removed.


    For example, create or modify the /etc/deborphan.conf file and add these lines:
    Code:
    keep Bleachbit
    keep Kolourpaint
    keep Falkon

    Note, I am not a Lubuntu user so this is kind of guesswork on my part.


    Let's wait for others to add their thoughts before you make any changes.
    Good catch. 1+ and thank you.


    While not ignoring the very important points from others here, I'll begin with this...


    The Deborphan manpage mentions the following...
    FILES
    /var/lib/deborphan/keep
    A newline-separated list of packages to keep. Package names are in no
    particular order.

    Do I put in this "keep" file only the package name as it is listed in "dpkg -l" or is it better to include all pertinent paths to everything that the app, package, program, etc uses and its dependencies?


    How might I get a list of all relevant things and also those of the dependencies?

  7. #7
    Join Date
    Aug 2014
    Beans
    543
    Distro
    Lubuntu 22.04 Jammy Jellyfish

    Re: Custom Cleanup Script Worked, But Now This...

    This post wasn't actually needed.
    It was something for me to put together a personal file.

    Somewhere I believe there should be a "delete post" option for the person posting to delete unneeded posts.
    Maybe there's the option to enable that feature in my profile...I don't know.
    Last edited by wyattwhiteeagle; 3 Weeks Ago at 03:32 AM.

  8. #8
    Join Date
    Mar 2010
    Location
    /home
    Beans
    9,684
    Distro
    Xubuntu

    Re: Custom Cleanup Script Worked, But Now This...

    To my knowledge, you can add any program you want to keep using its common name.

    For example,

    Code:
    bleachbit
    falkon
    python3
    No need for the full path and also no need to put them in any particular order.

    Note this was just an example, you need to add the program name as shown in the package manager.

  9. #9
    Join Date
    Mar 2010
    Location
    /home
    Beans
    9,684
    Distro
    Xubuntu

    Re: Custom Cleanup Script Worked, But Now This...

    Quote Originally Posted by wyattwhiteeagle View Post
    This post wasn't actually needed.
    It was something for me to put together a personal file.

    Somewhere I believe there should be a "delete post" option for the person posting to delete unneeded posts.
    Maybe there's the option to enable that feature in my profile...I don't know.
    As far as I know, this option does not exist.

    Only an admin can delete posts but that means you would need to PM them.

    Or I guess you could use the Report Post button at the bottom of the post and request it there.

  10. #10
    Join Date
    Aug 2014
    Beans
    543
    Distro
    Lubuntu 22.04 Jammy Jellyfish

    Re: Custom Cleanup Script Worked, But Now This...

    For now...

    Quote Originally Posted by TheFu View Post
    Is there a reason you don't just have the journald config file limit log file sizes? Then you would need the /usr/bin/journalctl command at all. Set it once and forget about it. There are good reasons to do it in a script, but having the system automatically handle things where it can easily is usually preferred.
    Where would I find the journald config file?
    What is it's file name?
    What are the proper commands to effectively limit log file sizes?
    Last edited by wyattwhiteeagle; 3 Weeks Ago at 05:00 AM.

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •