diff --git a/minui/graphics.c b/minui/graphics.c
index 4f3026a..05e8763 100644
--- a/minui/graphics.c
+++ b/minui/graphics.c
@@ -57,24 +57,27 @@
     void *bits;
     
     fd = open("/dev/graphics/fb0", O_RDWR);
-    if(fd < 0) {
+    if (fd < 0) {
         perror("cannot open fb0");
         return -1;
     }
 
-    if(ioctl(fd, FBIOGET_FSCREENINFO, &fi) < 0) {
+    if (ioctl(fd, FBIOGET_FSCREENINFO, &fi) < 0) {
         perror("failed to get fb0 info");
+        close(fd);
         return -1;
     }
 
-    if(ioctl(fd, FBIOGET_VSCREENINFO, &vi) < 0) {
+    if (ioctl(fd, FBIOGET_VSCREENINFO, &vi) < 0) {
         perror("failed to get fb0 info");
+        close(fd);
         return -1;
     }
 
     bits = mmap(0, fi.smem_len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
-    if(bits == MAP_FAILED) {
+    if (bits == MAP_FAILED) {
         perror("failed to mmap framebuffer");
+        close(fd);
         return -1;
     }
 
@@ -99,24 +102,14 @@
 
 static void set_active_framebuffer(unsigned n)
 {
-    if(n > 1) return;
+    if (n > 1) return;
     vi.yres_virtual = vi.yres * 2;
     vi.yoffset = n * vi.yres;
-    if(ioctl(gr_fb_fd, FBIOPUT_VSCREENINFO, &vi) < 0) {
-        fprintf(stderr,"active fb swap failed!\n");
+    if (ioctl(gr_fb_fd, FBIOPUT_VSCREENINFO, &vi) < 0) {
+        perror("active fb swap failed");
     }
 }
 
-static void dumpinfo(struct fb_var_screeninfo *vi)
-{
-    fprintf(stderr,"vi.xres = %d\n", vi->xres);
-    fprintf(stderr,"vi.yres = %d\n", vi->yres);
-    fprintf(stderr,"vi.xresv = %d\n", vi->xres_virtual);
-    fprintf(stderr,"vi.yresv = %d\n", vi->yres_virtual);
-    fprintf(stderr,"vi.xoff = %d\n", vi->xoffset);
-    fprintf(stderr,"vi.yoff = %d\n", vi->yoffset);
-}
-
 void gr_flip(void)
 {
     GGLContext *gl = gr_context;
@@ -163,7 +156,7 @@
     
     while((off = *s++)) {
         off -= 32;
-        if(off < 96) {
+        if (off < 96) {
             gl->texCoord2i(gl, (off * font->cwidth) - x, 0 - y);
             gl->recti(gl, x, y, x + font->cwidth, y + font->cheight);
         }
@@ -240,31 +233,29 @@
 
 int gr_init(void)
 {
-    GGLContext *gl;
-    int fd;
-
     gglInit(&gr_context);
-    gl = gr_context;
+    GGLContext *gl = gr_context;
 
     gr_init_font();
-
-    fd = open("/dev/tty0", O_RDWR | O_SYNC);
-    if(fd < 0) return -1;
-
-    if(ioctl(fd, KDSETMODE, (void*) KD_GRAPHICS)) {
-        close(fd);
+    gr_vt_fd = open("/dev/tty0", O_RDWR | O_SYNC);
+    if (gr_vt_fd < 0) {
+        // This is non-fatal; post-Cupcake kernels don't have tty0.
+        perror("can't open /dev/tty0");
+    } else if (ioctl(gr_vt_fd, KDSETMODE, (void*) KD_GRAPHICS)) {
+        // However, if we do open tty0, we expect the ioctl to work.
+        perror("failed KDSETMODE to KD_GRAPHICS on tty0");
+        gr_exit();
         return -1;
     }
 
     gr_fb_fd = get_framebuffer(gr_framebuffer);
-    
-    if(gr_fb_fd < 0) {
-        ioctl(fd, KDSETMODE, (void*) KD_TEXT);
-        close(fd);
+    if (gr_fb_fd < 0) {
+        gr_exit();
         return -1;
     }
 
-    gr_vt_fd = fd;
+    fprintf(stderr, "framebuffer: fd %d (%d x %d)\n",
+            gr_fb_fd, gr_framebuffer[0].width, gr_framebuffer[0].height);
 
         /* start with 0 as front (displayed) and 1 as back (drawing) */
     gr_active_fb = 0;
