Dear lazyweb: Wanted: Linux wranglers

(Thanks to everybody who replied. I still don’t have a working solution yet I eventually managed to find a configuration that works for my purposes, combining some of the advice; more about this in a followup post.)

~

OK, here’s an interesting problem for all you Linux masters/journeymen (or maybe even beginners) out there. The whole story is a bit too long to explain it on IRC or somesuch, so I’m doing it here. I’m also offering a bounty/reward; see below.

But first things first. Last week I got an ASUS 1018P. It’s a 10″ netbook that I specifically got to do a certain Project that I have been thinking about for a while now. It currently has Ubuntu 11.04 desktop on it (most attempts to install other versions of Linux failed, but that doesn’t matter right now). In GUI mode, everything seems to work fine; graphics are correct (it’s a widescreen), wireless is instantly recognized, sound works, etc. No problems there.

Now, what I want, is apparently rather unusual in this day and age. You know how in the old days of MS-DOS (or early Linuxen) the computer would boot, and you would get a 80×25 text screen? Well, that’s basically what I want here. I want an option in my boot menu that does just that; instead of booting into the GUI, it shows you a login prompt in 80×25 text mode, and stays there after logging in.

Sounds simple? Not for me. I know a little about Linux, but not enough to pull it all off, because I run into too many problems that I don’t know how to fix. The way I understand it, the new menu option must boot in runlevel 3, and must use a screen resolution lower than 1024×768 (currently it shows a font with more columns/rows than 80×25, which makes the text unpleasantly small on the 10″ screen).

(The machine is capable of showing 80×25, by the way; it uses it for the BIOS screen, and it also uses it for certain other Linux installations, like Gentoo, so I know it works. It’s just that Ubuntu insists on switching to a higher resolution with a smaller font.)

If you know how to fix this, I would like to hear from you. ^_^ Please leave comments either below, or via email (zephyrfalcon@gmail.com). Assume that I am not very smart and don’t know much about Linux. ;-) In other words, I would need some hand-holding, rather than vague advice.

The first reader to come up with an acceptable solution can pick a “prize” from the list below. To summarize, this is what I need:

  • extra option in GRUB2 boot menu
  • boot in runlevel 3 (necessary for text mode, I think, but feel free to correct me)
  • set screen to a lower resolution, e.g. 640×480 or 800×600, which allows for 80×25 text
  • ideally, the process should be reproducible on other netbooks as well (assuming Ubuntu)
  • BONUS points if everything else still works in text mode (sound, wireless, etc)
  • BONUS points if it’s still possible to switch to a graphics mode using one library or another, and back to text mode (not a GUI, I’m more thinking along the lines of SDL here, etc), and you can tell me a bit about how to do this

~

Now for the rewards. I don’t have money to offer, but I do have a bunch of stuff laying around that I don’t use, and that might be of interest to people. I will send it to you free of charge. NOTE: Sorry, but I can only send it to you if you are in the US or Canada; otherwise the shipping costs will get a little too unwieldy. :( If you are from another country, maybe we can make other arrangements, e.g. I could write some Python code for you, or something.

Books:

  • The Little Lisper, Third Edition
  • Ada 95 Problem Solving and Program Design (Feldman, Koffman)
  • Programming in Ada 95 (Barnes)
  • Unix Ada Programming (Gehani)
  • Data Structures and Algorithms: An Object-Oriented Approach Using Ada 95 (Beidler)
  • Miranda: The Craft of Functional Programming (Thompson)
  • Flex 3: A beginner’s guide (Davis, Phillips)
  • The Art of Computer Programming vol. 1: Fundamental Algorithms, Second Edition (Knuth)
  • Dreaming in Code (Rosenberg)
  • In The Land of Invented Languages (Okrent)
  • Twisty Little Passages (Montfort)
  • Rules of Play: Game Design Fundamentals (Salen, Zimmerman)
  • The Game Design Reader: A Rules of Play Anthology (Salen, Zimmerman)
  • Photoshop CS Bible (McClelland)
  • Magic: The Puzzling (Rosewater)

If none of these are to your liking, I also have a bunch of Magic cards (mostly older ones), fantasy books, video games, disassembled Zoids, etc. Oh, and you get to pick more items if you satisfy the “bonus” conditions listed. :)

Thanks in advance…

–Hans who should really turn in his hacker’s license :(

21 Comments

  1. David Boddie said,

    June 26, 2011 @ 10:08 am

    Maybe this discussion will help you get on the right track:

    http://www.linuxquestions.org/questions/linux-newbie-8/how-to-boot-linux-in-text-mode-651072/

    However, you probably want to look at Ubuntu’s own page about Grub2:

    https://help.ubuntu.com/community/Grub2

  2. Rodrigo said,

    June 26, 2011 @ 10:12 am

    Try add 3 in the end of kernel command line in GRUB and your system will boot in the runlevel 3…

    Try add nomodset in the end of kernel command line in GRUB, remove any vga= in it and your system will boot using 80×25.

    Sorry by the poor english, it is not my native language…

  3. Olly Smith said,

    June 26, 2011 @ 10:18 am

    Easy option: ctrl-alt-f[1-6] to switch to a text TTY ctrl-alt-f7 to switch back to X11. Doesn’t guarantee it’ll be 80×25, but at least gets you a text mode without hacking grub.

  4. Vasudev Ram said,

    June 26, 2011 @ 10:20 am

    Solution 1:
    With most recent Linux distros – by which I mean since the last several (10?) years, you already should have what you need – except that it doesn’t show that 80×25 login screen by default, but it is there. Linuxes are set up to show the GUI (X-Windows) screen by default, in the n’th virtual screen (where n is 7 or so). But all the previous virtual screens show the sort of text mode screen you want. Just use Ctrl+Alt+Fn to go to one of those screens – where n is in the range 1 to 6. And you can switch back to the GUI screen anytime with Ctrl+Alt+F7. Not tested as I am not at a Linux box right now, but should work. But not sure about if the resolution will be right for you.
    Check it out.

    Solution 2:
    Again, can’t test right now, for same reason as above.
    Edit the file /etc/inittab with a text editor and set the runlevel to 3 – if it is not 3. May work. IIRC, since 3 is the level for multi-user + all network services, but not GUI, while 4 is all that 3 has plus GUI. If you don’t need GUI at all, you could also set the runlevel to 1, which is maintenance mode – only for superuser (root), but then you may not have many things, like additional file systems mounted, network, devices enabled, etc. And you would have to do an su to some other user id (non-root) unless you are skilled enough and don’t mind working as root – which is dangerous for non-superuser work, since that lets you delete files which are read-only, etc.

    BTW, if my answer works for you, I’d like to get the book “The Little Lisper” :-) Email me if I am right.

  5. Mike said,

    June 26, 2011 @ 10:34 am

    Add vga=785 in your kernel append line to drop your resolution way down, and set your runlevel to be 3 (it used to be set in inittab, but I’m not certain anymore since ubuntu changed init systems.

  6. Mike said,

    June 26, 2011 @ 10:38 am

    Correction on that, here’s an explanation of the numbers:

    785 = 640×480@16
    786 = 640×480@24
    788 = 800×600@16
    789 = 800×600@24
    791 = 1024×786@16
    792 = 1024×768@24

    I’m not sure, but I suspect 787 will give you 640×480@32, 790 will give you 800×600@32, and 793 will give you 1024×768@32.

  7. Hampus Wessman said,

    June 26, 2011 @ 10:41 am

    You need to do two things: 1. disable the framebuffer to get a 80×25 console (or change its resolution instead), 2. disable GDM so that you’ll boot into text mode.

    Some other distibutions have these things disabled by default, but Ubuntu likes graphics so you need to disable them yourself. It’s quite easy to do. The following two links describes how. It should all be possible to do by adding a new grub entry.

    https://wiki.ubuntu.com/FrameBuffer#How_to_disable_the_framebuffer
    https://help.ubuntu.com/community/BootOptions#Text%20Mode

    Basically you create a new Grub menu entry (copy an existing one) in /boot/grub/menu.lst and add/change these kernel options: vga=normal nomodeset text. You’ll probably just have to add them last on the line beginning with “kernel”. See the second link for how to edit the grub menu file.

    You can also add “vga=normal nomodeset” and skip “text” (you’ll still get GDM at startup) and switch to the console with ctrl+alt+1 (or 2-5 for other consoles). ctr+alt+6 (or something similar, may be 7 or 8) will get you back into graphics mode. Graphics will not work in pure text mode. Everything else will. This way you can easily switch between them.

    Perhaps you will also want to remove “quiet” and “splash” (or even add “nosplash”), so you get a nongraphical boot process. Should work in either case.

    Hope that works! I run Arch Linux myself, so haven’t tried this. No need for a reward.

  8. Yaroslav Fedevych said,

    June 26, 2011 @ 11:00 am

    1. For GRUB2 kernel parameters, use “nomodeset” which will make it stay in text mode for the console. The text mode will be, of course, 80×25. There are packages like console-setup which could help you fine-tune it.

    2. Another way is to boot in graphics mode but use a bigger font. The linux kernel comes with a variety of these. For GRUB2, you can use “fbcon:font=10×18″, for example. There is also sun12x22, which is even bigger.

    Please note that Linux console, no matter if it’s a text console or a framebuffer, is nowhere like your old MS-DOS textmode. You cannot poke directly at the VGA video memory, instead you use escape sequences, as if in a terminal (Linux emulates something like VT122 with its own goodies on top). So using a pure text mode does you no good, except that fonts will be distorted and blurry (as the video card struggles to stretch 720×400 to 1024×600 or anything you use). So I would go with 2.

    Now that you’ve got your console right, there are several ways to get into the text console.

    Note that runlevel numbering is just a convention, and runlevel 3 being multi-user textmode and runlevel 5 being a graphical login is a notion coming from Red Hat. Debian-based distributions have historically used runlevel 2 for everything.

    You can use what I use (my laptop started glitching since 3.0 kernel, so I need to boot in text mode first): disable GDM completely. I did it with

    update-rc.d gdm3 -f remove

    run as root. Of course it might get reinstated once gdm3 gets updated, so you could run

    update-rc.d gdm3 stop 0 1 2 3 4 5 6

    Whenever you want to get GNOME or whatever you have back, you can

    startx

    or

    /etc/init.d/gdm3 start

    Also, while in X, you can actually switch to your text consoles by pressing Ctrl-Alt-F1…Ctrl-Alt-F6. Your graphical session is by default on VT7, you get back there by pressing Alt-F7 (if it’s not there, try F8, F9 and so on).

    P. S. If it ever works, I don’t need anything in return for myself. Instead you can choose a ticket on http://twistedmatrix.com/trac/report/10, preferably in red, and fix it. :-) That would serve a great help for the whole community.

    P. P. S. There is a bunch of tutorials on how to configure wireless using console tools and how to make it permanent. I just didn’t care since I use the GUI and NetworkManager sorta works.

    P. P. P. S. SDL is tricky to get out of once you have got in its graphics mode. I have seen buggy programs freezing keyboard completely, so that only SSH’ing into the machine and killing the rogue process would work.

  9. Roger said,

    June 26, 2011 @ 11:03 am

    If you press Ctrl-Alt-F1 in graphical mode do you get a working text console? What is your video card (eg Intel versus Nvidia usually have different solutions)? That proprietary Intel video chip will likely cause lots of issues.

    The solution involves giving grub additional kernel parameters. In particular “vga=XXX” where XXX is an appropriate mode should work for the kernel. Again depending on your video chip you may also use kernel modesetting and framebuffers.

  10. Adam said,

    June 26, 2011 @ 11:20 am

    Edit “/etc/defaults/grub”
    Remove the “#” in front of “GRUB_GFXMODE=640×480″
    Add “GRUB_GFXPAYLOAD_LINUX=640×480″ anywhere

    Edit “/etc/grub.d/00_header”
    After “set gfxmode=${GRUB_GFXMODE}” add “set gfxpayload=${GRUB_GFXPAYLOAD_LINUX}”

    Run “sudo update-grub” in a terminal
    Reboot

    This will still start you up in GUI mode, but using ctrl+alt+f1 to ctrl+alt+f6 should drop you into a 640×480 virtual terminal and ctrl+alt+f7 should bring you back to the GUI.

    I’m only running Ubuntu in a VM at the moment but it works for me. Not sure if you really needed to be able to boot into this mode or if switching VTs works for you.

  11. Adam said,

    June 26, 2011 @ 11:24 am

    P.S. You can also use “GRUB_GFXPAYLOAD_LINUX=keep” instead of “GRUB_GFXPAYLOAD_LINUX=640×480″ — thaty way you only have to edit the resolution on the “GRUB_GFXMODE” line.

    Roger: the vga= parameters don’t work anymore with grub2 which Ubuntu has used for the last two years.

  12. JohnMc said,

    June 26, 2011 @ 11:29 am

    I am sure someone has already provided the solution, but here goes.

    1/ Install Ubuntu as usual in graphics mode. That will sustain your access to graphics mode.
    2/ cd to /etc/init. open up the file rc-sysinit.conf. You will see an entry like this — env DEFAULT_RUNLEVEL=2. Change that 2 to a 3. Save file.
    3/ Reboot box.

    You should now be in command line mode. Once logged in you can get to GUI mode by typing #startkde, or #startxfce or #startgnome. Depends on your desktop choice.

    Having said all that you might consider something that was not on your list. Take a look at xmonad and as an accessory load up terminator. xmonad is a tiling X11 system. Terminator is a user configurable terminal app. Using these two tools you have your cake and eat it too. This might be closer to what you are looking for.

    xmonad — http://xmonad.org/

  13. Anoni said,

    June 26, 2011 @ 12:10 pm

    Yeah, Ctrl-Alt-F1 is your best way to go. If the video card drivers can handle it, there is also a thing call kernel mode setting (KMS) who let you switch instantaneously between graphics and console.

    If you do not want to run a desktop environment for any reason, you can remove the link to gdm in a specific runlevel, who will let you in the console (you can add the runlevel number to the kernel call in grub to start that level directly from grub, keeping the old entry for default runlevel and graphics). And off course yo can run a lot of things in console, like wicd-curses for wireless setup or mplayer for media support.

    In fact, everything that you ask, is just there, ready to use it ;)

  14. Hampus Wessman said,

    June 26, 2011 @ 12:26 pm

    That should be F1, F2, … instead of 1, 2, … above in my answer too.

    Too new hardware can be a problem when running Linux… I generally like integrated Intel graphics cards, though. Many of them have official open source linux drivers, which is really nice. My Thinkpad SL410 with an integrated intel video card works great with Arch Linux.

  15. Charles McCreary said,

    June 26, 2011 @ 12:40 pm

    Hey Hans!

    This URL might be helpful:

    http://ubuntuforums.org/showthread.php?t=258484&highlight=kernel+booting+parameters

  16. Ilya Margolin said,

    June 26, 2011 @ 2:03 pm

    Needed a similair setup on my debian eeepc.
    1. Find out your default runlevel, see /etc/inittab for it. Mine was 2.
    2. Delete symlink to your display manager(kdm, gdm, gdm3) in default runlevel:
    rm /etc/rc2.d/*gdm
    3. Compare default and next runlevels: diff -r /etc/rc{2,3}.d/
    Next-to-default should still have the display manager symlink.
    4. Add a stance to your /boot/grub/grub.cfg with linux command line ending in that non-default runlevel. (I just copied my default and added a 3 to the line staring with linux). If /boot/grub/grub.cfg is generated, read the comment and edit the source. I actually had to edit /etc/grub.d/40_custom and run grub-mkconfig afterwards.

    The trick is, they got rid of that good habit of having text-only runlevel. So we just created it anew.

    Sound will work. Wifi probably not, depending on how you configured it.

  17. Mr Z said,

    June 26, 2011 @ 2:17 pm

    I would think that Olly Smith’s suggestion is the best one. It requires no configuration change and provides what you want. In fact, you get several of them… right out of the box. Simple is better if it achieves the same results. CTRL-ALT-F1 should be all you need there.

    Good luck

  18. ubuntu user said,

    June 26, 2011 @ 2:46 pm

    Well actually, in Debian and Ubuntu there is no difference between runlevels 2-5.
    If what you want is to start your Ubuntu without graphics, you can disable gdm:
    sudo update-rc.d -f gdm remove
    or if you use kde:
    sudo update-rc.d -f kdm remove
    or xdm or any of those login managers.
    Good luck

  19. kerobaros said,

    June 26, 2011 @ 4:19 pm

    Step one: install Arch Linux. (www.archlinux.org) The default install doesn’t even contain X, it boots straight into text mode.
    Step two: configure Grub to boot with your selected resolution, as explained here: https://wiki.archlinux.org/index.php/Grub#Framebuffer_resolution (Arch’s wiki is fantastic.)
    Step three: profit.

  20. Joe Tennies said,

    June 26, 2011 @ 8:07 pm

    To get wifi to work, install “cnetworkmanager”. It’s a command line client for networkmanager (not the most user-friendly as I believe it takes several commands to see the list of networks and then connect to one, but it does work).

    To get sound to work, you need apps that use the sound card (yeah, I know sounds dumb). Most use pulseaudio already, ogg123 or mpg321. ALSA should be there too, but it would only support a single sound at once (probably not a problem at a terminal only). You may need to manually start pulseaudio (`pulseaudio &`).

    SDL would need something to help it along like directfb, though most apps may expect X11. For actual app development should “just work” exactly the same code and all. (Need to double check you have directfb installed). DirectFB support is still in 1.2 and looks to be in SDL 1.3 (under src/video/directfb). Note, I can’t tell if the versions of libsdl in ubuntu are compiled w/ directfb support, you may need to rebuild it yourself.

  21. Kelly Black said,

    June 27, 2011 @ 10:09 am

    Slackware installs without X-Windows using LILO still. You need to manually change the run-level to start X on boot. Might give some hints. I see others have suggested the same thing above. Slack will also let you pick a non-graphical boot mode (i.e. no frame buffer junk by default) if you pick just defaults without fancy fonts.

RSS feed for comments on this post