Last active
December 21, 2019 06:14
-
-
Save smurugap/a6c862a76c99331a7f929a14aaa30551 to your computer and use it in GitHub Desktop.
Cirros Image creation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Base Image: | |
Edit /lib/cirros/ds/ec2 or /etc/cirros-init/ds-ec2 based on image (MAX_TRIES=5, SLEEP_TIME=2) | |
v6 support (How dhcpcd was built is not captured here): | |
scp cirros@10.87.118.117:/sbin/dhcpcd /sbin/ | |
scp cirros@10.87.118.117:/sbin/cirros-dhcpc /sbin/cirros-dhcpc | |
scp -r cirros@10.87.118.117:/libexec / | |
dhcpcd-run-hooks 100% 8436 8.2KB/s 00:00 | |
10-wpa_supplicant 100% 2866 2.8KB/s 00:00 | |
30-hostname 100% 3450 3.4KB/s 00:00 | |
01-test 100% 276 0.3KB/s 00:00 | |
02-dump 100% 120 0.1KB/s 00:00 | |
15-timezone 100% 885 0.9KB/s 00:00 | |
20-resolv.conf 100% 4562 4.5KB/s 00:00 | |
50-ntp.conf 100% 2848 2.8KB/s 00:00 | |
10-mtu 100% 957 0.9KB/s 00:00 | |
29-lookup-hostname 100% 811 0.8KB/s 00:00 | |
Change boot order to bring up dropbear first before dhcpcd. <reduces sshable time by 5 seconds> | |
mv /etc/rc3.d/S50-dropbear /etc/rc3.d/S39-dropbear (31 sec to 26 sec) | |
dhcpcd args in cirros-dhcpc file: | |
dhcpcd -h ${hostname:-"hostname"} -A -q -b -L "$iface" | |
# Specifying -x option increases the boot time by 10 seconds | |
Other packages installed for Traffic Image: | |
SFTP Server: | |
Download source and compile with the below args: | |
./configure --disable-libutil --disable-lastlog --disable-utmp --disable-utmpx --disable-wtmp --disable-wtmpx --disable-pututline --disable-pututxline --disable-pam --without-pam --without-stackprotect --without-hardening | |
make sftp-server | |
Copy sftp-server /lib/x86_64-linux-gnu/libnss_files-2.23.so /lib/x86_64-linux-gnu/libc.so.6 /lib64/ld-linux-x86-64.so.2 | |
To increase image size: | |
1. qemu-img resize cirros-traffic.qcow2 100M | |
2. launch the VM | |
3. execute `/sbin/resize-filesystem /dev/root /run/resize.rootfs /dev/console` inside the cirros VM | |
Either statically build the reqd packages from source (or) | |
download the package on ubuntu host and copy the binary and the dependent shared libraries. | |
For eg: | |
TcpDump (download the tcpdump deb package and do below): | |
scp cirros@10.87.118.117:/usr/sbin/tcpdump ./ | |
scp cirros@10.87.118.117:/usr/lib/libpcap.so.1.7.2* ./ | |
scp cirros@10.87.118.117:/usr/sbin/in.tftpd ./ | |
scp cirros@10.87.118.117:/usr/sbin/xinetd ./ | |
scp cirros@10.87.118.117:/usr/sbin/vsftpd ./ | |
scp cirros@10.87.118.117:/usr/sbin/thttpd* ./ | |
scp cirros@10.87.118.117:/sbin/arping ./ | |
scp cirros@10.87.118.117:/etc/init.d/S01logging ./ | |
scp cirros@10.87.118.117:/etc/init.d/S70vsftpd ./ | |
scp cirros@10.87.118.117:/etc/init.d/S90thttpd ./ | |
scp cirros@10.87.118.117:/usr/sbin/xconv.pl ./ | |
To compile Python statically on the Ubuntu host follow the below steps: | |
Compiling Python2.7: | |
./configure LDFLAGS="-static" --disable-shared | |
make LDFLAGS="-static" LINKFORSHARED=" " | |
Apply the workaround - https://github.com/usnistgov/REFPROP-cmake/issues/13 | |
Content of Setup.local is at https://gist.github.com/smurugap/f8f3ce8b96da33d9ad5c782a4c53ff0e | |
mkdir -p /usr/local/lib/python2.7 | |
mkdir -p /usr/local/bin | |
scp <srcdir>/python /usr/local/bin/ | |
scp -r <srcdir>/Lib/* /usr/local/lib/python2.7/ | |
scp <srcdir>/build/lib.linux-x86_64-2.7/_sysconfigdata.py /usr/local/lib/python2.7/ | |
chmod -R 777 /usr/local/ | |
To install any dist-packages modules inside cirros: | |
* pip install the package on the host | |
* copy the contents (directory or .py files) to /usr/local/lib/python2.7/ inside the container |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment