apt-get problem and hang. DPKG was interrupted error afterwards
To fix dpkg: http://lydonchandra.com/content/failure-installing-jre-java-runtime-env-ec2-ubuntu-10
I am having the same problem too, ami-00067852 ap-southeast-1a zone. What on earth is going on?
There is a way to get your dpkg running again. Alas, I still don't know how to install jre on my debian, since exactly the same thing happens each time jre install is attempted.
In a nutshell, you need to purge incompletely installed packages, after you have killed dpkg and java processes (java process consumed 100% cpu on my box). Then your dpkg should be operational again.
Detailed instructions follow. These may serve as a guide for someone else with same issues.
- open up another console/ssh session, and kill java and dpkg processes (use
ps -A |grep -E "(java|dpkg)"
to find them) - run
dpkg -l |grep -v -E "^ii"
- this will list all packages that are either not in perfectly installed state; either incompletely installed, or that have config files remaining behind them after they have been uninstalled (or some other variant). You can tell them apart by value in first column. (rc = removed & conf-files; iU = install & unpacked). See listing header (dpkg -l | head
for detailed meanings). - run
dpkg -P package_name [package_name2] [package_name3 ...]
in order to purge those incomplete packages. Personally, I have removed all listed packages (as they were all related to broken jre install), and dpkg was running afterwards. - optionally, reboot your system to get rid of that defunct java process (it kept hanging in process list after I killed it)
Update: after some more research, turns out that this bug is exclusively related to running a 32-bit t1.micro instance of debian-based-distro AMI on Amazon EC2.
A solution that worked for me (credited to DanielDaniel - thanks, @Yuval), is to:
- stop (or halt) a running instance (prior to which you need to make sure that it will not terminate on halt)
- change instance type to m1.small (either using EC2 console, or using CLI)
- start an instance
- install java package that you want
- stop an instance (again)
- change instance type back to t1.micro
- start an instance (again)
This will cost you probably only as much as it costs to run m1.small instance for 1 hour. Should be up and running in no time.
Update 2: after going through all troubles, it appears that Java won't work on t1.micro instance at all. Running anything java-based will have same effect on your system as running installation of jre/jdk. So, in order to use java on t1.micro either use some other non-debian-based distro (however, I'm not 100% sure it would work, either), or upgrade instance to m1.small or better.
Update 3: as of 08/11/2011, issue has not resolved. See https://bugs.launchpad.net/ubuntu/+source/linux-ec2/+bug/634487 for further updates. Right now it's up to Amazon to review proposed patch... Basically, they'll fix it when they do...