lunes, 28 de diciembre de 2020

Minimal Ubuntu 18.04 on Aspire One Cloudbook

 Hi,

Here's a cookbook of tips to setup a Aspire One Cloudbook 14 with a minimal (but usable for your parents) Ubuntu.

  1. Setup the BIOS
    1. Press F2 when the Acer logo appears, and then change the EFI system to legacy.
    2. Reboot and then press F12 when the logo appears (to choose the installing media).
  2. Installation. I have selected a Lubuntu 18.04 installation but it's not a critical choice. More on this onwards.
    1. When prompted, specify the following options for the partitions: discard (as the Cloudbook 14 has a eMMC drive) and noatime.
    2. When prompted, install nothing but "OpenSSH Server" (as it won't be a standard desktop)
  3. After-install setup
    1. Update the dependencies with apt update && apt upgrade.
    2. In other linux machine, download and compile a recent kernel (currently 5.10.3):
      1. make clean menuconfig; make -j $(nproc);
      2. make bindeb-pkg # as we're going to scp the generated kernel to the aspire1
        In the parent directory there'll be a "linux-image-5.10.3*.deb" file
    3. In the Cloudbook, scp the remote .deb file into local (i.e. scp john@remotelinux:/tmp/linux-image-5.10.3*.deb .)
    4. Install it with sudo apt install ./linux-image-5.10.3*.deb and reboot.
    5. Now you're running with the latest trouble-free kernel.
    6. Additional installations:
      1. apt install python x11-utils x11-apps xinit xterm xinput xserver-xorg-input-synaptics openbox firefox pm-utils
      2. (optional) apt install lxterminal.
    7. Try the X system with the command xinit. Everything should be fine here: an xterm window is ready and the trackpad clicks perfectly.
      If you exit the terminal window you'll be back to the console.
    8. Prepare the graphical system to launch automatically the browser with (remember it's targeted to your parents) echo 'openbox & firefox' > $HOME/.xinitrc

Hope you like it!

sábado, 23 de mayo de 2020

Working like WSL2 (without having it)

TL;DR

Here is an approach to work with a non-WSL Linux guest (with VirtualBox or VmWare) and launching native Windows commands (f.e. MS Office Excel)

--

Hi all,

Some people have WSL2. Some people not, like me, and we are in the middle-of-nowhere with WSL1, as we are not able to do real stuff with Docker, Kubernetes, and so on, because WSL1 lacks the needed capabilities that a real Linux kernel has, so the only solution (see rants section below) is to stick with VirtualBox (or VmWare if you prefer) and work isolated from Windows apps.

But here's a way to overcome such limitations.

The idea is to run a small agent in the Windows side (the host) that will be capable of running whatever command you send from the Linux side (the guest).

In order to do that, you'll need:
  • Windows:
    • Java 11 (https://adoptopenjdk.net/?variant=openjdk11&jvmVariant=hotspot)
    • Groovy (https://dl.bintray.com/groovy/maven/apache-groovy-binary-3.0.4.zip)
  • Linux:
    • Netcat

Once you have them installed, you'll have to do:

1. Create the agent in Groovy

Create a file (f.e. c:\GroovySocketServer1070.groovy) with the following content:

new groovy.ui.GroovySocketServer (new GroovyShell(), // false"println line.execute().text", // true1070);

That's all: A poor-man's telnet server written in three lines of Groovy, that will execute whatever command it receives at port 1070!
There's a caveat: If there's an error it will be lost, as STDERR is not captured.

You can run the agent  with a command like (the paths must reflect the exact locations of the Java and Groovy installations) this:

C:\>PATH=C:\p\groovy-3.0.4\bin;C:\p\jdk-11\bin;%PATH% C:\>groovy C:\GroovySocketServer1070.groovy


2. Launch the commands from Linux

From the Linux guest you can launch any Windows program like this:

$ echo "C:\\Windows\\System32\\cmd.exe /C dir" | nc -N 10.0.2.2 1070 $ echo "C:\\Program Files (x86)\\Microsoft Office\\root\\Office16\\EXCEL.EXE" | nc -N realhost 1070 &

Bonus point: The GroovySocketServer allows multiple concurrent executions (so you don't have to wait for the termination of other commands)!

Sweet and easy: You can execute any host program from the guest.

Hope you like it!

Rants