I can’t give you a full answer, but this may give you something to look up and study. It’s just a lot of random information on what is required to make an X server run with a window manager. X is a lot to chew on, and there is a lot listed below which is general and overly vague…sorry, I can’t be more specific for this case.
First, ignore the window manager, e.g., enlightenment. Get X running by itself. It’ll be an ugly desktop with no windowing, no ability to have menus (though right click will show something), and just an ugly cursor. This is what you had missing when you tried to run IceWM. If you don’t have X, you can’t run a window manager.
An X server is more or less just a normal (but complicated) application. People tend to think of the window manager as an X11 GUI, but it isn’t. People tend to think of X as running multiple applications, but it doesn’t. X runs exactly one application at a time. The window manager is run by X as an argument, and is the only thing X runs during a normal login. X can run any single application which is X protocol compliant (e.g., one could start X with just a GUI based calendar instead of a window manager).
The login manager itself which asks for a password is X running with the display manager as a single application…when login is accepted, then X restarts running the window manager sudo as your user…X gets a new single application to run. X is an application which runs one application.
One identifies which X server to use via the DISPLAY environment variable. If a user sets a DISPLAY going to an application/desktop run by the same user, then security allows this. Options are required if one user is to display on another user’s desktop…otherwise permission is denied. It seems you did not set DISPLAY (usually this is “export DISPLAY=:0” for a local display), or you set it to a DISPLAY owned by a different user. Had this been a case of DISPLAY pointing at another user’s session you would have had a different error, so you simply did not have the environment variable set.
More than one X server can run at once. This is rare. Almost everyone has a single X running and only one GUI session is available. You can have two or more X sessions running at once. The first session is DISPLAY set to “:0”, the second session is DISPLAY set to “:1”. If you set DISPLAY to a server which does not exist, then you might get the error message you saw. Perhaps if you are lucky it will say specifically that the server was not found instead of a generic message which might mean either no server or no DISPLAY. Make sure DISPLAY is set when you try to manually run a window manager (check with command “echo $DISPLAY”).
Typically, if you are running X on the command line, you won’t use sudo. You’ll want to have permission as that user to put what you want on the X server without special options to allow a foreign user name to display there. If there is no current X session running, then DISPLAY is “:0”. If there was already an X server running and you starting one on the command line, then DISPLAY is “:1”. If there is a third X server running and you want to display to that, then you are using DISPLAY of “:2”. When starting on command line as you have, don’t use sudo unless root also started the server and no other user has an application running on X (i.e., there must not be a window manager running sudo under another user’s ID…on a full installation the login/display manager will have used the correct options to allow an X server run by root to run a window manager as that other user).
Take a closer look at your error for not being able to open display: This means that what DISPLAY is set to is not valid. For DISPLAY to be valid there must first be an X server running. An X server is itself tied to a hardware video driver or software framebuffer. If you have an X server running, then you will see “/var/log/Xorg.0.log” with timestamps in it for your current startup. If you manually start your own X server as a different user you might find logging is not to that specific file. In “/var/log/” the log is rotated at each reboot, so Xorg.1.log is from the previous boot, and is not an indicator of DISPLAY.
For a hardware driver the Xorg.0.log will mention an ABI version…the Application Binary Interface. The driver must be compiled to match the ABI version the X server expects. No driver matching the X server software’s expected ABI implies it isn’t possible for the X server to start. A framebuffer is also a video driver, but it is not hardware-dependent, and cannot use hardware acceleration. Make sure you don’t have an ABI mismatch error listed in your X log. If you use software framebuffers instead of the NVIDIA driver, then the framebuffer driver for NVIDIA hardware would be the Nouveau driver. Avoid Nouveau at all costs if you have the NVIDIA-specific hardware accelerated version available for that X server’s ABI.
Note that a VGA device using the 15-pin D-sub connector is a bad choice when it comes to configuration. These older connectors do not have the wire used for query of a monitor, thus the monitor cannot tell the X server what its capabilities and valid settings are. For a VGA connector to work you have to either get lucky with the default settings of the system being something the monitor can use, or you have to do a lot more configuration. If you do not have a configuration setting for the monitor in the xorg.conf file (the section related to actual hardware), then the screen section (the virtual/logical place an X server displays to) won’t be valid and X can’t start…and of course the window manager will make a complaint similar to what you got.
Perhaps you don’t have X software running. Perhaps you have X software running, but DISPLAY did not point at it. Perhaps X software simply had no screen to point at because it didn’t have a configured monitor tied to the screen. Perhaps you couldn’t display to a valid display because X was running as root and the user you wanted to log in was not root and security options were not set to allow your user to talk to that server. Perhaps X tried to run but couldn’t even make the attempt because your video driver was the wrong ABI…or perhaps no video driver was even configured (see “/etc/X11/xorg.conf”).
Make sure X is running before you try to run a window manager (e.g., “ps ax | grep X” will show something like “/usr/lib/xorg/Xorg -core -listen tcp :0 -seat seat0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch”). Make sure you have DISPLAY set (e.g., “echo $DISPLAY” will show something like “:0”…note this matches the previous grep for X process). If you have a default server already running when you run X on command line, then expect DISPLAY will be “:1” instead of “:0”. If you can go to a console and start X and get an ugly gray mouse pointer you’re on the right track. Once you have that, and if DISPLAY points at this, then that user should be able to start the window manager (e.g., IceWM).