Ubuntu - Remove the prompt to eject CD

How to remove the Ubuntu eject CD prompt. The following tutorial covers the process of removing the "Please remove the disk, close the tray (if any) and press ENTER to continue" prompt entirely from your USB Ubuntu installation. The process is fairly simple and will allow your system to shutdown or restart without prompting you to remove the CD. Those of us booting from a USB stick, will surely be glad to get rid of the remove CD annoyance.

Warning: This tutorial is intended for older versions. With recent versions of Ubuntu, simply add noprompt to the kernel append line in syslinux.cfg

Removal of eject CD prompt Prerequisites:

  • Ubuntu Live USB
  • CD-Rom drive
  • 3-4 GB free space on a USB storage device or hard drive (partitioned as ext2 or ext3) for storing the extracted filesystem

Removing the prompt to eject CD feature in Ubuntu

The procedure follows the same guidelines as the boot to ram tutorial with the exception that we will be removing a couple of files.

The first step is extracting or decompressing filesystem.squashfs:

1. Insert your Ubuntu Live USB
2. Reboot your PC, booting from the Live USB.
3. Open a terminal and type sudo su (to change to root)
4. Type fdisk -l and locate the drive letter/partition number you want to use.
5. Type the following commands, replacing sdx# with your actual drive letter/partition number found in step 4;

mkdir /c && mount /dev/sdx# /c
mount -o loop -t squashfs /cdrom/casper/filesystem.squashfs /mnt
mkdir /c/fix rsync -avx -P /mnt/. /c/fix/.
umount /mnt

6. To remove the prompt to eject CD, type;

rm -r /c/fix/etc/rc0.d/*casper
rm -r /c/fix/etc/rc6.d/*casper

7. To regenerate the initrd.gz, type;

chroot /c/fix /bin/bash
mkinitramfs -o /new-initrd.gz 2.6.20-15-generic
mv /c/fix/new-initrd.gz /c/initrd.gz

8. To rebuild and compress the new filesystem.squashfs, type;

apt-get install squashfs-tools
mksquashfs /c/fix /c/filesystem.squashfs -noappend -always-use-fragments

9. Insert your bootable USB Ubuntu pen drive and replace the old filesystem.squashfs and initrd.gz files with the new files from the "new" directory on your other USB drive or partition.
10. Reboot, and enjoy an Ubuntu Live USB that no longer prompts you on shutdown to remove the disk and close the tray!