Skip to content

Commit ca89fbd

Browse files
committed
chore: remove unused packages from qemu build
1 parent de14ba7 commit ca89fbd

File tree

4 files changed

+56
-7
lines changed

4 files changed

+56
-7
lines changed

ansible/playbook.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@
198198
- collect-binaries
199199
when: debpkg_mode
200200

201-
- name: Install osquery from nixpkgs binary cache
201+
- name: Purge snapd
202202
become: yes
203203
shell: |
204204
apt autoremove -y --purge snapd

ansible/vars.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ postgres_major:
99

1010
# Full version strings for each major version
1111
postgres_release:
12-
postgresorioledb-17: "17.5.1.009-orioledb"
13-
postgres17: "17.4.1.066"
14-
postgres15: "15.8.1.123"
12+
postgresorioledb-17: "17.5.1.010-orioledb"
13+
postgres17: "17.4.1.067"
14+
postgres15: "15.8.1.124"
1515

1616
# Non Postgres Extensions
1717
pgbouncer_release: "1.19.0"

qemu-arm64-nix.pkr.hcl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,23 @@ source "qemu" "cloudimg" {
7474
format = "qcow2"
7575
headless = true
7676
http_directory = "http"
77+
# TODO (darora): switch to minimal images
78+
# iso_checksum = "file:https://cloud-images.ubuntu.com/minimal/releases/noble/release/SHA256SUMS"
79+
# iso_url = "https://cloud-images.ubuntu.com/minimal/releases/noble/release/ubuntu-24.04-minimal-cloudimg-arm64.img"
7780
iso_checksum = "file:https://cloud-images.ubuntu.com/noble/current/SHA256SUMS"
7881
iso_url = "https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-arm64.img"
7982
memory = 40000
83+
qemu_img_args {
84+
convert = ["-o", "compression_type=zstd"]
85+
}
8086
qemu_binary = "qemu-system-aarch64"
8187
qemuargs = [
8288
["-machine", "virt,gic-version=3"],
8389
["-cpu", "host"],
8490
["-device", "virtio-gpu-pci"],
8591
["-drive", "if=pflash,format=raw,id=ovmf_code,readonly=on,file=/usr/share/AAVMF/AAVMF_CODE.fd"],
8692
["-drive", "if=pflash,format=raw,id=ovmf_vars,file=AAVMF_VARS.fd"],
87-
["-drive", "file=output-cloudimg/packer-cloudimg,format=qcow2"],
93+
["-drive", "file=output-cloudimg/packer-cloudimg,if=virtio,format=qcow2,discard=on,detect-zeroes=unmap"],
8894
["-drive", "file=seeds-cloudimg.iso,format=raw"],
8995
["--enable-kvm"]
9096
]

scripts/90-cleanup-qemu.sh

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,47 @@ elif [ -n "$(command -v apt-get)" ]; then
4242

4343
source /etc/os-release
4444

45-
apt-get -y update
46-
apt-get -y upgrade
45+
apt-mark manual libevent-2.1-7t64
46+
47+
apt-get remove -y --purge ansible-core apport appstream bash-completion bcache-tools bind9-dnsutils bind9-host bind9-libs bolt btrfs-progs byobu command-not-found console-setup distro-info eject fonts-ubuntu-console friendly-recovery ftp fwupd gawk gdisk keyboard-configuration libvolume-key1 libssl-dev lvm2 lxd-agent-loader man-db mdadm modemmanager mtd-utils nano netcat-openbsd nfs-common ntfs-3g parted pastebinit screen strace thin-provisioning-tools tmux usb-modeswitch vim vim-runtime wget whiptail xfsprogs
48+
49+
apt remove -y --purge libc6-dev linux-libc-dev libevent-dev libpcre3-dev libsystemd-dev packagekit multipath-tools unattended-upgrades plymouth gnupg open-vm-tools xauth lxd-installer publicsuffix libclang-cpp18 python3-twisted python-babel-localedata libicu74 python3-pygments fonts-dejavu* python3-botocore
50+
51+
apt-get remove -y --purge linux-headers*
52+
53+
# remove old kernels
54+
# CURRENT_KERNEL="$(uname -r | sed 's/-generic//')"
55+
# INSTALLED_KERNELS=$(dpkg -l | awk '{print $2}' | grep -Eo 'linux-(image|headers|modules|tools)-[0-9]+' | sed -E 's/linux-(image|modules|tools)-//' | sort -Vu)
56+
# REMOVE_KERNELS=$(echo "$INSTALLED_KERNELS" | grep -v -e "$CURRENT_KERNEL")
57+
# for VER in $REMOVE_KERNELS; do
58+
# for PREFIX in linux-image linux-modules linux-tools; do
59+
# for PKG in $(dpkg -l | awk '{print $2}' | grep "^$PREFIX-$VER"); do
60+
# apt-get purge -y "$PKG"
61+
# done
62+
# done
63+
# done
64+
# update-grub
65+
4766
apt-get -y autoremove
4867
apt-get -y autoclean
68+
69+
apt-get -y update
70+
apt-get -y upgrade
71+
4972
fi
73+
74+
systemctl set-default multi-user.target
75+
systemctl disable [email protected]
76+
systemctl mask [email protected]
77+
systemctl mask graphical.target
78+
5079
rm -rf /tmp/* /var/tmp/*
5180
history -c
5281
cat /dev/null > /root/.bash_history
5382
unset HISTFILE
83+
84+
journalctl --rotate
85+
journalctl --vacuum-time=1s
5486
find /var/log -mtime -1 -type f -exec truncate -s 0 {} \;
5587
rm -rf /var/log/*.gz /var/log/*.[0-9] /var/log/*-????????
5688
rm -rf /var/lib/cloud/instances/*
@@ -60,3 +92,14 @@ chmod 600 /etc/ssh/revoked_keys
6092

6193
cat /dev/null > /var/log/lastlog
6294
cat /dev/null > /var/log/wtmp
95+
96+
dd if=/dev/zero of=/zerofile &
97+
PID=$!
98+
while [ -d /proc/$PID ]
99+
do
100+
printf "."
101+
sleep 5
102+
done
103+
sync; rm /zerofile; sync
104+
105+
fstrim /

0 commit comments

Comments
 (0)