====== Remove unsafe packages from Ubuntu LiveCD ====== **This is an old way, please consider the new and better one instead: http://www.helplinux.ru/wiki/en:kb:make-ubuntu-privacy-friendly** * What? * The script mentioned bellow removes online shopping packages from Ubuntu LiveCD: * unity-lens-shopping * unity-scope-video-remote * unity-scope-musicstores * Why? * Ubuntu sends your search requests through the internet without your direct approval since Ubuntu 12.10, so Ubuntu is not safe anymore. We are fixing it. * Links: * [[https://www.eff.org/deeplinks/2012/10/privacy-ubuntu-1210-amazon-ads-and-data-leaks|Privacy in Ubuntu 12.10: Amazon Ads and Data Leaks]] * [[http://www.fsf.org/blogs/rms/ubuntu-spyware-what-to-do|Ubuntu Spyware: What to do?]] * [[https://bugs.launchpad.net/ubuntu/+source/unity-lens-shopping/+bug/1055952|Direct data leaking to Amazon]] * [[https://bugs.launchpad.net/ubuntu/+source/unity-lens-shopping/+bug/1073114|Shopping Lens Does Not Respect User Privacy]] * [[https://fixubuntu.com|Fix Ubuntu - Ubuntu should protect user privacy by default]] * Applies: * Ubuntu Desktop 12.10 and later * Requirements: * Running Ubuntu (LiveCD is okay) * 5Gb of free space for temporary files ===== make-ubuntu-safe.sh ===== #!/bin/bash -e # packages that have to be purged PACKAGES="unity-lens-shopping unity-scope-video-remote unity-scope-musicstores" [[ $# -ge 1 ]] || { echo "Usage: $0 filename.iso [ temp_dir_path ]"; exit 0; } # ISO file path ISOFILE=$1 # Ubuntu LiveCD version [[ -n $2 ]] && TMPDIR=$2 || TMPDIR=/tmp # create temporary directories EXT4IMG=$(mktemp -p $TMPDIR) # Image file EXT4MNT=$(mktemp -d) # Mounting point for building ISOMNT=$(mktemp -d) # Mounting point for ISO image # set ISO paths ISOFILE=$(readlink -e "$ISOFILE") ISOFILENEW="$(isoinfo -d -i $ISOFILE | grep -i '^volume id:' | sed -r 's/^volume id:\s+//i') safe" # clean up on stop trap "exit 1" INT trap "echo 'Clean up ...'; umount $ISOMNT || true; umount $EXT4MNT || true; rmdir $ISOMNT; rm $EXT4IMG; rmdir $EXT4MNT; exit 0" EXIT # install required tools apt-get install squashfs-tools rsync genisoimage xorriso # create ext4 image file and mount truncate -s 5G $EXT4IMG mkfs.ext4 -F $EXT4IMG mount $EXT4IMG $EXT4MNT -o loop # create temporary directories inside ext4 image ISODATADIR=$EXT4MNT/isodata; mkdir $ISODATADIR SQUASHFSDIR=$EXT4MNT/squashfs # mount livecd mount -o loop,ro "$ISOFILE" $ISOMNT # extract squashfs rsync --exclude=/casper/filesystem.squashfs -a $ISOMNT/ $ISODATADIR unsquashfs -d $SQUASHFSDIR $ISOMNT/casper/filesystem.squashfs # purge unsafe packages chroot $SQUASHFSDIR dpkg -P $PACKAGES # remove unsafe packages from manifest for pkg in $PACKAGES; do sed -i "/^$pkg\s/d" $ISODATADIR/casper/filesystem.manifest done # compress filesystem mksquashfs $SQUASHFSDIR $ISODATADIR/casper/filesystem.squashfs # remove old md5sum.txt and calculate new md5 sums pushd $ISODATADIR find -type f | grep -vE '(\./isolinux/|\./md5sum.txt)' | xargs -l md5sum | tee md5sum.txt popd # build iso xorrisofs -D -r -V "$ISOFILENEW" -J -l -b \ isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot \ -boot-load-size 4 -boot-info-table -o \ "${ISOFILE%.iso}-safe.iso" $ISODATADIR ===== Download Ubuntu safe ISO (ready to use) ===== * ubuntu-12.10-desktop-i386-safe.iso * MD5: 65560e4e68e2a4141aa7cdedc62ac3c3 * Torrent: [[http://thepiratebay.se/torrent/8096770/Ubuntu_12.10_(x86)_safe_(Amazon_free)]] * Direct link1: http://dropmefiles.com/en/v4BSN * Direct link2: https://docs.google.com/file/d/0B7ue80L1_MCWSVhkTDQ0bzlNUEU/edit?usp=sharing * Direct link3: http://yadi.sk/d/q_mGH8Dm2Jnlg