APC Australia

Run Debian Linux on Android 9

Get a genuine Linux LXDE desktop on your Android 9 phone using free software. Darren Yates explains how – and why you’d want it. Best of all, you don’t need root access.

-

Android is a great operating system, no question. But, there are times when you need to run a more feature-rich desktop app on a more traditiona­l desktop operating system. That’s okay – you just pull out your Android phone (and a handy Bluetooth keyboard and mouse). Android is built on the goodness of Linux, but you can now get a real taste of Linux running as an app – and with good speed – on your Android phone. What’s more, your Android OS is never more than a swipe away. So, this month, we’ll show you how to get your Linux on with an Android 9-powered Samsung Galaxy A30 phone.

WAS BROKEN, NOW FIXED

We’ve previously looked at the excellent combinatio­n of XServer XSDL and UserLAnd, both available free from Google Play. XServer XSDL is a neat X Window server backend that delivers the Linux frames to your device screen, while UserLAnd is the front-end installer that builds and runs your Linux operating system. It does this inside a clever ‘chroot’alternativ­e or ‘proot’ environmen­t – think of it as like a virtual machine, but not.

However, the arrival of Android 9 effectivel­y broke XServer XSDL for new Android devices, which was a huge disappoint­ment. But it’s back, bigger and better and now works a treat on Android 9 devices. The instructio­ns have changed since our last take, so we thought we’d update and see what we can get it to do on a lower mid-range phone like the Galaxy A30.

WHAT YOU NEED

In general, you’ll need an Android phone or tablet with at least Android 5.0, although in practice, we’d suggest a screen resolution of at least 1280x720-pixels, plus a reasonably hefty CPU on-board to give it some horsepower. A four-core ARM Cortex A53 CPU, 1.5GB of RAM and 16GB of storage would be our bare minimum.

It’s also highly recommende­d you have a Bluetooth keyboard and mouse, as bashing away on the on-screen keyboard is neither practical nor fun. That said, it doesn’t need to be anything fancy – I bought a cheap $7 Bluetooth mouse and $10 Bluetooth keyboard, both from Ebay and they worked (the mouse, better than the keyboard).

Once that’s sorted, it’s just software from here-on. As we mentioned, you need XServer XSDL (play.google.com/store/apps/details?id=x.org.server) and UserLAnd (play.google.com/store/apps/details?id=tech.ula). Install XServer XSDL first and launch it. Once you get to the big blue screen, you need to write down the entire last command line that should start with ‘export DISPLAY=…’. Once you’ve done that, head off and install UserLAnd, then launch that.

Be aware that if you’re running an Android 9 device and have an XServer XSDL version installed prior to November 6, 2019, it will likely snag itself in a boot-loop, due to a prior incompatib­ility. Make sure you grab the latest version of XServer XSDL.

SETTING UP LXDE

UserLAnd has evolved from the original GNURoot Debian app that offered a similar but slightly lesspolish­ed solution. However, it’s now

expanded to offer a number of pre-set selections that makes the whole process much easier.

We’re setting up a Debian installati­on (Debian is the mothership for Ubuntu) with the lightweigh­t but still very useable LXDE desktop environmen­t. If you have a Galaxy S10 or Pixel 4 XL, you could try running an Xfce4 desktop, however, the Galaxy A30 was just a little sluggish in its operation with Xfce. Obviously, a phone doesn’t have the CPU performanc­e of a PC or laptop, so there are some compromise­s to be made, but choose LXDE and the responsive­ness is fine. Be aware, too, that running a full Linux distro will also require at least 1.5-3GB of storage space, which your phone will need to provide.

With UserLAnd installed and running, scroll down until your see the ‘Lxde’ entry in the ‘Desktop’ sub-menu and tap on it. After that, you’ll need to give UserLAnd permission to access storage, then you create yourself a username, password and VNC password.

The next step is to select a remote connection type on the pop-up panel. If the XSDL option is blanked out, you must not select anything else – just tap ‘continue’.

Now comes the waiting – UserLAnd begins downloadin­g and installing a basic Debian distro. This could take between five and 30 minutes, depending on your connection. Once this first part of the install is complete, you’ll be forwarded to UserLAnd’s console terminal and be asked to type in your password. A tip here – have your Bluetooth keyboard and mouse ready to go (meaning, paired with your phone and working), so you can enter your password. The installati­on script will take over and begin downloadin­g and installing the 40MB or so files that make up the LXDE desktop.

Once this is done, you’ll drop back to the UserLAnd session terminal again.

LAUNCHING LXDE

Now you’re ready to get UserLAnd and XServer XSDL talking to each other. At the terminal prompt, type the following and press ‘enter’:

export DISPLAY=127.0.0.1:0 PULSE_ SERVER=tcp:127.0.0.1:

Replace with the final four digits from the command you wrote down before from the XServer XSDL blue-screen. For us, that was ‘4713’. This not only sets up the display server, but also the audio server, so your Linux distro can play sounds via your Android audio engine.

Now we’re ready to launch LXDE, so type the following and press ‘enter’:

startlxde

Go back, open up XServer XSDL and within a second or two, the screen should change and the LXDE desktop appear. If so, congrats – you now have a Linux desktop running on your Android phone.

GETTING THE SCREEN FONT SIZE RIGHT

Depending on your device’s screen size and resolution, the preset desktop font size might not be right for your screen, particular­ly if you’re running a device like the Galaxy A30 with its 2340x1080-pixel panel. Adjusting it will be a bit of trial and error, but here’s what you do. Drag down the Android notificati­on panel and you should see an entry for XServer XSDL with a ‘stop’ button to the right. Tap it. Now go back and relaunch XServer XSDL, but this time, wait for the XSDL logo to disappear and tap the screen as soon as you see the white-on-black text screen. This allows you to set the virtual screen resolution and the font

“It’s also fun watching heads turn when they realise you’ve got Linux running on your phone. ”

scale size.

If you have a high-pixel-density screen, you may want to reduce the virtual screen resolution from ‘native’ to something around 70% of ‘native’. For example, we’ve dropped the 2340x1080-pixel native resolution down to 1504x720-pixels and that works well for us. Once you’ve made your choice, the next option is setting the font scale size. Default is 0.7x, but if the LXDE button text was too big, go for something smaller – either 0.6x or possibly 0.5x, but no smaller than that. Once you make your selection here, XServer XSDL will go into ‘blue screen’ mode and wait.

What you do now is head back to UserLAnd, tap on the ‘Lxde’ entry, which should quickly take you back to the console terminal. Type in those two code lines above as before, go back to XServer XSDL and the LXDE desktop should appear. Ideally, you want the LXDE panel button text to be in proportion to your screen’s resolution. Again, if you’re not happy, you can experiment by stopping and restarting the XServer XSDL server and going through the process again, but choosing different options.

INSTALLING APPS

Just like Android, distros based on Debian should have an app repository. They’re not usually as well stocked as Google Play, but there’s normally more than enough to keep you busy. However, first things first, tap the LXDE ‘Start’ button at bottom-left, then choose ‘System’, ‘LXTerminal’. When it appears, update the online repository server list, by typing the following and pressing ‘enter’:

sudo apt-get update

Once that’s done, you can start installing apps. If you’re thinking gaming, you’ve probably missed the point a bit – you won’t get GPUacceler­ation here, so any gaming is going to be fairly ordinary, compared with native Android apps. However, it doesn’t mean you’re limited to text-based apps:

• Productivi­ty – If you don’t need a full office suite, all the better. Libre Office is fine, but a bit unwieldy for a phone. We’d suggest the classics here – ‘Abiword’ for word-processing and ‘Gnumeric’ for spreadshee­t. Need an image editor? GIMP works nicely too. To find out the available hardware specs, ‘hardinfo’ is a lightweigh­t CPU-Z alternativ­e for Linux. Get ‘em all with this:

sudo apt-get install abiword gnumeric gimp hardinfo

• Multimedia – it’s important to make sure you entered the initial ‘PULSE_SERVER’ code correctly, otherwise you won’t get any audio. If you want to create some of your own audio, Audacity is the go-to app in most Linux distros and it works well. VLC installs and runs, but gave us

weird decoding errors – your mileage may vary.

sudo apt-get install audacity vlc

• Programmin­g – For me personally, this is where running a Linux desktop earns its keep. While you can run Python on Android already via the pretty decent Qpython3 app on Google Play, this is an opportunit­y to get the genuine article, installing Python 3.7 and the IDLE editor.

sudo apt-get install idle

Beyond that, you have pretty much the full Debian ‘arm64’ software repository to play with, but just be prepared for some apps not to work correctly. Wearing my ‘machine learning’ hat for a second, we tried installing the Weka data mining app, for example, and while it installed, it just produced a yellow window. We also installed the Arduino IDE, but unfortunat­ely (as you’ll see below), there’s no USB support, so while it loads and compiles code, there’s no wired way to get compiled code to your Arduino board.

If electrical engineerin­g is more your thing, you can install KiCad, the open-source circuit and board layout suite. It works well, but a mouse here is an absolute must.

WHAT DOESN’T WORK

At time of writing, there were a few things not working, including:

• no web browser – the built-in Firefox web browser, which was working for us a few days earlier, stopped working again. The alternate Firefox install workaround also didn’t work. If Firefox gives you a black-screen, use your Android browser, save your downloads and access them using PCManFM file manager within your Linux build (see ‘accessing Android storage’ below).

• no USB – there’s no USB-OTG support, so even if your device has USB-OTG, it just doesn’t work. If you need USB storage access, our work-around is to shuffle to and from internal storage via Android (see accessing Android storage’ below).

• no power monitor – Debian can’t see your phone’s battery, so there’s no obvious way to know the battery level. Not a deal-breaker, but not great, either.

• no hardware video accelerati­on – video playback sort-of works, but it depends on your phone’s CPU to do the job, so the faster your phone, the better. It also means GPU-based games don’t work either. Still, Android can cover these bases.

ACCESSING ANDROID STORAGE

It looks like plenty of changes are coming to Android Q, particular­ly for file manager apps that access your device storage. At the moment, UserLAnd allows you access to your Android internal storage from the PCManFM file manager – but there’s a trick. The Android device storage path in Debian is /host-rootfs, but if you try to open this inside PCManFM, you’ll get a ‘permission denied’ error.

The workaround is you specify the specific storage subfolder instead – for example, type ‘/host-rootfs/sdcard’ (internal flash storage path on the A30) into the address bar, press Enter and you should sail over that permission error and get full access. You should also be able to create a bookmark to this subfolder in PCManFM. The ‘sdcard’ subfolder won’t be visible in /host-rootfs, so you’ll just have to try it via the address bar (it works perfectly on a Galaxy A30).

Having a desktop OS on your phone might also raise questions about wearing out your phone’s flash storage if there’s too much RAM-paging going on. We don’t know if this is the case or not, but if we took a guess, we’d suspect it’d be a function of the amount of RAM your device has, how often you use the Linux OS and how much RAM-paging the Linux OS has to do. If this will keep you awake at night, simple – don’t do it.

GETTING RID OF IT

If you’ve had enough of running Linux on your phone, just uninstall UserLAnd and XServer XSDL. The apps will go, along with the LXDE/ Debian filesystem (just backup anything you want to keep first). Your phone should return to its pre-install state.

WHY DO I NEED THIS?

This is the great existentia­l question, but there’s an easy answer – Android is great, but it doesn’t do everything. Having a Linux desktop on your phone might seem just short of barking-mad, but it gets you access to a second eco-system without carrying a second device. For example, I’ve already used this during a data-mining conference to operate a Microsoft Azure enterprise server just using my phone and X2Go remote desktop.

It’s also fun watching heads turn when they realise you’ve got Linux on your phone.

 ??  ?? Audacity installs easily and runs nicely on an LXDE desktop.
Audacity installs easily and runs nicely on an LXDE desktop.
 ??  ?? We had Firefox working at one point, but then later, it stopped working again.
We had Firefox working at one point, but then later, it stopped working again.
 ??  ?? Samsung’s Galaxy A30 makes a passable mini Linux portable.
Samsung’s Galaxy A30 makes a passable mini Linux portable.
 ??  ?? This $10 Bluetooth keyboard is all over Ebay, not great but mostly works.
This $10 Bluetooth keyboard is all over Ebay, not great but mostly works.
 ??  ?? You can even draw electronic circuits via KiCad design software.
You can even draw electronic circuits via KiCad design software.
 ??  ?? Install ‘HardInfo’ to find out the Android hardware Debian can ‘see’.
Install ‘HardInfo’ to find out the Android hardware Debian can ‘see’.
 ??  ?? Tap ‘Lxde’ to begin installing a Debian OS/LXDE desktop on your phone.
Tap ‘Lxde’ to begin installing a Debian OS/LXDE desktop on your phone.
 ??  ?? Create a username and password for yourself.
Create a username and password for yourself.
 ??  ?? The XServer XSDL blue screen – write down that last code line before you start.
The XServer XSDL blue screen – write down that last code line before you start.
 ??  ?? Ignore the ‘XSDL’ warning – it does work, just tap nothing, but ‘continue’.
Ignore the ‘XSDL’ warning – it does work, just tap nothing, but ‘continue’.
 ??  ?? Enter your new password to continue the installati­on.
Enter your new password to continue the installati­on.

Newspapers in English

Newspapers from Australia