Quantcast
Channel: JetsonHacks
Viewing all articles
Browse latest Browse all 339

Save 1GB of Memory! Use LXDE on your Jetson

$
0
0

The introduction of the Jetson Nano 2GB ships with a different desktop environment than the other Jetsons. The desktop environment is LXDE. You can change over to this desktop environment fairly easily. Looky here:

Background

Up till now, the default desktop environment on the Jetson has been Unity/GNOME. Unity is a shell around the GNOME desktop environment. While GNOME is attractive and easy to use this comes at a cost, namely memory. On a fresh install of JetPack, the memory in use is ~ 1.7GB.

With the introduction of the Jetson Nano 2GB this presents a problem. There is only 2GB of memory, so using 1.7GB to get the system up and running is a no go. Fortunately there are other desktop environments which use less memory. Lightweight X11 Desktop Environment (LXDE) is one such environment, and was chosen to be the default on the Jetson Nano 2GB. This saves ~ 1GB of main memory, which makes life much more comfortable on more memory constrained devices.

You may want to follow much the same procedure on other Jetsons, the Jetson Nano (4GB) can also benefit from these memory savings. Fortunately this is easy to do with the latest JetPack 4.4.1 release.

Installation

If you are using JetPack 4.4.1 (L4T 32.4.4), there are a couple of steps. First you will need to select LXDE as your desktop environment. This selection is available when you login (this screen is known as a greeter) in the settings menu (the gear icon):

If you normally login automatically, you can get to the greeter screen by using ‘logout’ in the power down menu.

Once you have logged in (LXDE should now be your desktop environment), you can switch over from the GNOME display manager (gdm3) to lightdm. This will also set the window compositor to Compton. From a LXTerminal (there is a shortcut on the desktop):

$ sudo dpkg-reconfigure lightdm

This will bring up a menu where you can select lightdm as the display manager:

After you make your selection, reboot for the change to take effect.

When you log back in, you can check your memory. You will find that you are saving ~ 1GB in comparison to using GNOME!

JetPack 4.4 and earlier

You can switch over to LXDE if you are using JetPack 4.4 and earlier. The process is described here:

NVIDIA Jetson Linux Developer Guide

Lightweight Window Manager Alternatives

Over on the JetsonHacks account on Github, there is a convenience script to help: installLXDE. Download the repository, switch over to the directory and install:

$ git clone https://github.com/jetsonhacks/installLXDE.git
$ cd installLXDE
$ ./installLXDE.sh

Once installed, you can follow the steps described earlier to switch over to LXDE. See the video for more explanation.

Configuration

As with most desktop environments, LXDE is highly configurable. You can set the desktop background, widget themes, font sizes and so on. See the video for some examples.

You can go back to GNOME of course. Go to the greeter screen, and select Unity/GNOME. GNOME is built with gdm3 in mind, but also seems to work with lightdm which saves some space. Use the dpkg-reconfigure command as shown above if you would like to switch back to gdm3.

Tech Talk

First, as a side note, the Raspberry Pi uses a modified version of LXDE for their desktop environment.

We’ve introduced a lot of different names in this article, such as GNOME, LXDE, lightdm, gdm3. The GUI that you see on the screen represents a stack of software which speaks to the hardware of the machine.

From the bottom up, the software stack looks like the following list. Rather than go through a full explanation, here are links to Wikipedia articles which describe each part to get you started if you have interest.

  • X Window System (aka X11): A network protocol encoding things such as graphic primitives, images, pointer motion, and key presses.
  • X Display Server (e.g. Xorg and XFree86): X server implementing X11 and providing an interface to keyboards, mice, and video cards.
  • X Display Manager (e.g. GDM, and LightDM): Graphical login manager which starts a session on an X server from the same or another computer
  • Widget/GUI toolkit/framework/library (e.g. GTK+ and Qt): Providing things such as buttons, scrollbars, edit boxes, etc.
  • Window Managers (e.g. Mutter which is used by Gnome, OpenBox which is used by LXDE): Decorating X window primitives and supporting various operations such as moving, resizing, and maximizing of windows.
  • Desktop Environments (e.g. GNOME, KDE, XFCE, and LXDE): Providing libraries and specifications that applications use and follow in order to “play nice” with other applications.

Note that some Desktop Environments have shells around them (e.g. Unity for GNOME). Also, some of these programs combine different components of this architecture.

A compositor, such as Compton, usually works with a display manager to composite windows from the Window Manager. In more integrated solutions, this may be a little more hidden.

You may also hear the term “Wayland” which is a X Windows replacement. “Weston” is an reference implementation of Wayland. In this case, Wayland represents the bottom of the stack and works its way up from there. Many of the display managers, window managers and desktop environments have built in Wayland support.

Notes

The demo shown in the video is on a Jetson Nano (4GB). Other Jetsons can also benefit from the steps described above, but we did not test them here.

The summary of the desktop environment stack is taken from:

Unix Stack Exchange description of desktop stack.

This is a surprisingly difficult subject to summarize, especially considering that X Windows originated in 1984. In part, this is because of the overlap and popularization some of these terms.

The post Save 1GB of Memory! Use LXDE on your Jetson appeared first on JetsonHacks.


Viewing all articles
Browse latest Browse all 339

Trending Articles