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

Potluck flavours should clean /var/cache/pkg and /var/db/freebsd-update #298

Open
grembo opened this issue Sep 18, 2024 · 2 comments
Open
Labels

Comments

@grembo
Copy link
Collaborator

grembo commented Sep 18, 2024

I noticed after building a potluck flavour (in this example mariadb), that it keeps packages in /var/cache/pkg after installation. It also keeps /var/db/freebsd-update, in case the pot fbsd-update flavour was run.

This means images are bigger than required.

Example from mariadb on 14.1-RELEASE:

# zfs list zroot/pot/jails/mariadb/m
NAME                        USED  AVAIL     REFER  MOUNTPOINT
zroot/pot/jails/mariadb/m   619M  5.54G     1.49G  /opt/pot/jails/mariadb/m    
# rm -rf /opt/pot/jails/mariadb/m/var/cache/pkg/*
# zfs list zroot/pot/jails/mariadb/m
NAME                        USED  AVAIL     REFER  MOUNTPOINT
zroot/pot/jails/mariadb/m   476M  5.68G     1.34G  /opt/pot/jails/mariadb/m

freebsd-update is a bit more complicated, as in my example I inherited it from freebsd-potluck:

# rm -rf /opt/pot/jails/mariadb/m/var/db/freebsd-update
# zfs list zroot/pot/jails/mariadb/m
NAME                        USED  AVAIL     REFER  MOUNTPOINT
zroot/pot/jails/mariadb/m   476M  5.68G     1.01G  /opt/pot/jails/mariadb/m

As you can see, even though the usage won't go down, REFER went down by over 300MB (so the freebsd base image would shrink by that amount).

@grembo grembo added the feature label Sep 18, 2024
@grembo
Copy link
Collaborator Author

grembo commented Sep 18, 2024

Example:

--- freebsd-potluck.sh.orig	2024-09-18 09:44:51.529801000 +0000
+++ freebsd-potluck.sh	2024-09-18 09:45:20.486070000 +0000
@@ -84,6 +84,10 @@
 service sshd onestop || true
 service sshd onedisable || true
 
+step "Clean freebsd-update"
+rm -rf /var/db/freebsd-update
+mkdir -p /var/db/freebsd-update
+
 step "Create /usr/local/etc/rc.d"
 mkdir -p /usr/local/etc/rc.d
 
@@ -115,7 +119,7 @@
 pkg install -y rsync
 
 step "Clean package installation"
-pkg clean -y
+pkg clean -ay
 
 # -------------- END PACKAGE SETUP -------------

and

--- mariadb.sh.orig	2024-09-18 09:46:08.726728000 +0000
+++ mariadb.sh	2024-09-18 09:46:28.730563000 +0000
@@ -83,6 +83,10 @@
 step "Create /usr/local/etc/rc.d"
 mkdir -p /usr/local/etc/rc.d
 
+step "Clean freebsd-update"
+rm -rf /var/db/freebsd-update
+mkdir -p /var/db/freebsd-update
+
 # we need consul for consul agent
 step "Install package consul"
 pkg install -y consul
@@ -131,7 +135,7 @@
 pkg install -y syslog-ng
 
 step "Clean package installation"
-pkg clean -y
+pkg clean -ay
 
 step "Create mysql directory"
 mkdir -p /var/db/mysql

bretton added a commit to bsdpot/potluck that referenced this issue Oct 9, 2024
@bretton
Copy link

bretton commented Oct 10, 2024

this is done for most of potluck flavours

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

No branches or pull requests

2 participants