Ubuntu not booting: "Could not write bytes: broken pipes"

The problem When I boot Ubuntu 11.10, the boot process hangs, before even getting to the login screen of the display manager, with the message

Could not write bytes: broken pipes

at the top of the screen, followed by some lines of text (where one yellow star left of "PulseAudio" is - don't know if this is important...), the last being

* Stopping System V runlevel compatability                                          [Ok] 

After that I can only press Ctrl+Alt+Del to reboot.

The cause The problem occured after I did an update on feb., the 18th. In the process of the update a window popped up in which I had to choose the default display manager. Being in a hurry, I just clicked "ok" (gdm was the default selection in that window). Afterwards I found out that Ubuntu 11.10 us es lightdm so I figured, that maybe this was the cause of my problem. Before this update everything worked fine.

{What I tried so far to do to fix it [skip this, if its too long] I logged in as root in recovery mode and tried to reinstall lightdm. Using the apt-get command I get error that spans over 3 lines of text, the first of which is

Not using locking for read only lock file /var/lib/dpkg/lock;

but I don't know of any process that is using apt-get, that is preventing it from being run.

After that I used dpkg-reconfigure lightdm and selected lightdm as the default display manager. This exited with the line

mv: cannot move 'etc/X11/default-display-manager' to '/etc/X11/default-display-manager.pdkg-tmp': Read-only file system".

When I then booted in normal mode it still hung, but the message Could not write bytes: broken pipes was gone, there were just two lines of text, the first said something about the battery state and the last was identical to the one above ("* Stopping System V[...]"). I played around a little bit by also trying dpkg-reconfigure gdm and choosing gdm instead of lightdm, but none of that helped. The system still hangs, just with different lines of text showing up, but "* Stopping System V[...]" is always the last one. }

Other info This may be or not be relevant: I use multiple operating systems (the other ones work) and the kernel I use is 3.0.0-15-generic-pae.

Please help, I invested so much time in setting my Ubuntu system up, I don't want to do it all over again.


Actually, what's going on is when you go into recovery your disks are mounted as read-only. I just did this and for some reason the Mount Disk option didn't work, so I just hit the 'root' option and used:

mount -o remount,rw,errors=remount-ro /

This makes your drive writable. Once you do that you should be able to do your dkpkg-reconfigure lightdm

If it still says "read-only filesystem" then do the opposite and start a disk check:

mount -o remount,ro /
rootpartition=$(cat /etc/fstab | grep -E "# / was on .*installation" | awk '{print $5}')
e2fsck $rootpartition

If you can't remember that big long rootpartition= string, you can also get the device by going to /dev/disk/by-uuid use the file that is a big 36-character string (it should be the only one if you don't have any other Ext partitions). So, it would look something like this (using my UUID): fsck /dev/disk/by-uuid/062b52ee-5df4-4ad2-829e-0734f822748c

If any errors are found, be sure to restart!

In fact, I had this exact same problem when trying to nuke Unity and uninstalling unity-greeter (even though lightdm was still installed). I think it removed /etc/lightdm/unity-greeter.conf but left /etc/lightdm/lightdm.conf (which has a reference to unity-greeter.conf) unchanged. That makes sense why it wouldn't boot, though I didn't think to look and just re-installed unity-greeter once I worked my way past the read-only issue I was having.

Anyway, give it a shot!