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 Ubuntu 7.04 and is outdated. With recent versions of Ubuntu, simply add noprompt to the kernel append line in syslinux.cfg

Removal of eject CD prompt Prerequisites:

  • Ubuntu Live CD (7.04 was used in this tutorial)
  • CD-Rom drive
  • 3-4GB 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 7.04 Live CD and reboot your PC

2. Insert a USB hard-drive or use a partition on your local hard drive

3. Open a terminal and type sudo su (to change to root)

4. Type fdisk -l and locate the drive/partition you want to use.

5. Type the following commands, replacing sdxx with your actual drive/partition found in step 4:

  • mkdir /c && mount /dev/sdxx /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
  • exit
  • 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 pendrive 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. Enjoy your Ubuntu that no longer prompts you to remove the disk and close the tray on shutdown.

*Ubuntu is a product of Canonical Ltd