Skip to content

LiquidGalaxy on ChromeBooks WorkLog

ivancolomer edited this page Aug 9, 2019 · 26 revisions

OPTION 1: CROSTINI

Developer Mode is not needed to install Linux Beta (Crostini) on Chromebook. To enable it you must go to settings and scroll-down until you see the option.

There are some problems when installing LiquidGalaxy into Crostini because it's a Debian OS. Some configurations have to be set in order to make it work (modified install.sh).

Before executing the script, a password must be assigned to the user where LiquidGalaxy is gonna be installed. Execute Crosh by pressing Ctrl + T and type:

vsh start termina

lxc exec penguin -- bash

passwd <username>

Network Manager is not installed, and must be restarted after the script has completed. (Added at the end of install.sh script)

Profile settings (the settings that are executed when OS has been initialized) shows some warnings (it must be checked).

It seems that there’s no error when installing Google Earth. The font size is small, but it can be changed by installing some settings on Qt. To solve it:

sudo apt-get install qt4-qtconfig

qtconfig A window will appear and there you will be able to increase font size and save the current configuration.

The username is not lg, so it must be changed by doing this: CTR-ALT-T

vmc start termina

lxc exec penguin -- bash

USER_BEFORE=$(ls /home)

killall -u $USER_BEFORE

groupmod -n lg $USER_BEFORE

usermod -md /home/lg -l lg $USER_BEFORE

usermod -aG users lg

loginctl enable-linger lg

passwd lg

lgxedu

shutdown -h now

There are problems when restarting Termina, it is a known bug, so it will be fixed soon.

We got some problems with the new virtual interface in order to assign an static ip in the internal net because it is a container inside a virtual machine so those interfaces are not shared. I’m trying to create a bridge between the host computer and the container. There are some solutions that will be tested next:

SOLUTION 1:

The mac (hwaddr) has to be unique: https://www.hellion.org.uk/cgi-bin/randmac.pl

lxc config set penguin lxc.network.type macvlan

4e:ee:d7:31:71:5e

lxc config set penguin lxc.network.type macvlan

lxc config set penguin lxc.network.macvlan.mode bridge

lxc config set penguin lxc.network.flags up

lxc config set penguin lxc.network.link mvlan0

lxc config set penguin lxc.network.hwaddr 4e:ee:d7:31:71:5e

lxc config set penguin lxc.network.name eth0

DOESN'T WORK

lxc profile copy default lanprofile

lxc profile list

lxc profile show lanprofile

ip route show default 0.0.0.0/0

lxc profile device set lanprofile eth0 nictype macvlan

lxc profile device set lanprofile eth0 parent eth0

I couldn’t make it work due to the security ChromeOS offers.

I’ll try this new option explained here: https://blog.simos.info/a-closer-look-at-chrome-os-using-lxd-to-run-linux-gui-apps-project-crostini/ in order to create a macvlan (bridge) in corsitini to be able to set an static ip to router directly.

https://www.reddit.com/r/Crostini/comments/8l9c2a/full_containervm_documentation_available/ From this url we can read the following statement:

Can I access layer 2 networking? Currently, no, networking access is only at layer 3 (i.e. IP). So you won't be able to do any bridging or lower level fun stuff. It's not clear if/when this will change. Bridging with the outside world is difficult with WiFi, and not many devices have Ethernet connections. We could support layer 2 between containers, but it's not clear how many people want this in order to justify the effort involved.

So I understand that we can’t make LiquidGalaxys from different containers in different hosts communicate between them.

We should move back to Crouton or Dual Boot.

OPTION 2: DUAL BOOT

After following the next tutorial: https://saagarjha.com/blog/2019/03/13/dual-booting-chrome-os-and-elementary-os/, there was found the following error: graphics initialization failed. Typing help or enter didn't solve the problem.

OPTION 3: CROUTON

https://www.howtogeek.com/162120/how-to-install-ubuntu-linux-on-your-chromebook-with-crouton

For installing Crouton in your Chromebook you just have to reach 2 steps:

Step one: You have to enable the developer mode

To enable developer mode on modern Chromebooks, hold down the Esc and Refresh keys and tap the Power button to enter recovery mode. Older Chromebooks have physical developer switches that you’ll need to toggle instead.

At the recovery screen, press Ctrl+D, agree to the prompt, and you’ll boot into developer mode.

When you switch to developer mode, your Chromebook’s local data will be erased, this process may take about 15 minutes on our system. From now on, whenever you boot your Chromebook, you’ll see a warning screen. You’ll need to press Ctrl+D or wait 30 seconds to continue booting.

First step completed!

Step Two: Download and Install Crouton

  1. Download crouton from this link
  2. Open a shell (Ctrl+Alt+T, type shell and hit enter) and run sudo sh ~/Downloads/crouton -t gnome
  3. Wait patiently and answer the prompts like a good person.
  4. Done! You can jump straight to your Gnome session by running sudo enter-chroot startgnome or, as a special shortcut, sudo startgnome
  5. Cycle through Chromium OS and your running graphical chroots using Ctrl+Alt+Shift+Back and Ctrl+Alt+Shift+Forward.
  6. Exit the chroot by logging out of Gnome. You have succesfully installed Crouton!

crouton gnome

Configuring Network on Crouton for our LiquidGalaxy instances

Since Chromebooks can have eth0 or wlan0 interfaces (depends on whether device is connected via wifi or via ethernet), a mechanism to create the virtual interface eth0:0 or wlan0:0 should be made in order to be able to connect to the other Chromebooks.

This should be done with the following commands:

sudo apt update && sudo apt upgrade -y sudo apt install iptables

sudo tee "/etc/network/interfaces" > /dev/null 2>&1 << EOM auto eth0 iface eth0 inet dhcp

auto wlan0 iface wlan0 inet dhcp

EOM

in personality.sh:

sudo tee "/etc/network/if-up.d/$OCTET-lg_alias" > /dev/null 2>&1 << EOM #!/bin/sh PATH=/sbin:/bin:/usr/sbin:/usr/bin sudo ifconfig $IFACE:0 10.42.${OCTET}.${MACHINE_ID} netmask 255.255.255.0 up if [ "$IFACE" = "eth0" ]; then sudo ifconfig wlan0:0 down else sudo ifconfig eth0:0 down fi EOM chmod 0755 /etc/network/if-up.d/$OCTET-lg_alias

Some edits to install.sh have been done...

In order to check the installation again we can use

delete-chroot xenial

to remove ubuntu and reinstall it.

If you have some problems with the screen (colors) after going back to ChromeOS, press Ctrl+Alt+RefreshKey and then Ctrl+Alt+BackKey

Learn to talk to Crouton

  • List targets (-t): sh ~/Downloads/crouton -t help
    or sh ~/Downloads/crouton -t list
  • List supported Linux releases (-r): sh ~/Downloads/crouton -r list
  • List all installed chroot names (-a): sudo edit-chroot -a
  • List all installed chroot names with croutonversion (-al): sudo edit-chroot -al
  • Check the crouton version (must run within a chroot): croutonversion -u -c (run croutonversion -h for more info)
  • Update a chroot: sudo sh ~/Downloads/crouton -u -n chrootname. Note: this will update crouton and all installed targets.
  • Update a chroot while adding new target(s): sudo sh ~/Downloads/crouton -u -n chrootname -t targets_you_want_to_install_separated_by_commas
  • Backup a chroot to an SD Card: sudo edit-chroot -f /media/removable/SD\ Card/ -b chrootname (assumes the name of your SD Card is "SD Card")
  • Backup a chroot to a USB drive: sudo edit-chroot -f /media/removable/your_path_on_drive -b chrootname
  • Restore from a backup: sudo edit-chroot -f /media/removable/your_path_on_drive -r chrootname
  • Learn more about edit-chroot (i.e., man page): edit-chroot
  • Delete a chroot: sudo delete-chroot name_of_evilchroot
  • Rename a chroot: sudo edit-chroot source -m destination
  • Switch between xorg and xiwi if both installed: sudo startxfce4 -X xiwi or sudo startxfce4 -X xorg (replace startxfce4 with your interface shortcut from the setup).
  • Mount a chroot and enter the 'shell': sudo enter-chroot -n chrootname (run mount-chroot for more info)
  • Unmount a chroot: sudo unmount-chroot chrootname (run unmount-chroot for more info). Using the -f switch can be helpful for freeing up orphaned processes from 'xiwi -T' apps that mounted in the background using the 'enter-chroot -b' background exec.
  • Launch a single app in a Window in the background1: sudo startxiwi -b -n chrootname app_name (e.g., xterm)
  • Launch a single app in a Tab: sudo startxiwi -n chrootname -T app_name (e.g., -T xterm)

Notes

  • Think of some notations as variables in an equation. For example, substitute the name of your chroot for chrootname or name_of_evilchroot.
  • Similarly, source is the name of the source chroot that you want to change, and destination is the new name of a chroot.
  • Use the -f switch to define the path. The user download directory is ~/Downloads and an external drive begins /media/removable/. To check your path, use cd and ls from within the shell. For example, enter cd /media/removable/ and then ls to check.
  • To run a chroot in a window you need the browser integration extension and you must install -t xiwi. To run the old fashioned way, you need -t xorg. To switch between the two, see above.
  • Once you mount a chroot (see above) you can update and install packages. Stay away from the Ubuntu Software manager, and use the command line. See Ubuntu's AptGet/Howto.

GNOME 2 Application Startup doesn't work well with Crouton. In order to startup the LiquidGalaxy (through startup command) we should press Ctrl+T (to open terminal) and there you will be asked if you want to start the liquidgalaxy.

Added WikiPage of the installation of Crouton and LiquidGalaxy to ChromeBooks devices. Modified the display from :0 to :1 (since Crouton uses :1 for their main display). Added lg-relaunch command and switched ssh command from root to lg user. Checked ip addr over eth0. Added ScreenSaver off to initial startup program.

Found a bug: LiquidGalaxies doesn't sync between each other. It seems that ssh installation was fine, sudo iptables -S is fine, ... It seems to be drivers.ini. A fix has already been done (added symlink to /opt/google/earth/pro and fixed ip address octet) https://www.digitaltrends.com/computing/chrome-caffeine-how-to-disable-chrome-os-sleep-mode/

The bug of the sync not updating was that the symlink was broken.

Now there's an error that makes chromebooks with other $OCTET sync to other LiquidGalaxies installations. It might be due to the iptables configuration. Found the error in iptables: multiport is not supported by the kernel of the crouton. The solution to this bug is just splitting the multiport command on single port commands.

An script has been added to $HOME/bin called ip-reloader.sh that runs in background and check every 3 seconds the connectivity of the device, also that the iptables are configured and some services such us apache2, squid and sshd are active. If something above is not active or not well configured, the script configures it automatically.

Devilspies is used to move the windows of the Google Earth Pro window in order to hide the top bar. Since Google Earth Pro was opened with --fullscreen tag we couldn't move the windows, so we had to remove that. Also, the top bar in chromebooks is 25px height, not 21px. So the generate script in python was modified.

Since ChromeBooks enter on sleep mode every x minutes, and I couldn't find a method to diable it through gnome settings, some lines has been added into ip-reloader.sh that presses the ESC key from the keyboard every 2 minutes.

The installation of LiquidGalaxy on ChromeBooks is finished!!!

How to know the position of the earth

This command is being used to dump the packets sent over the 10.42.OCTET.255 from master. *The parameter -vv shows information about the header of the packet. *The parameter -c stops the dump at n packets. *The parameter -X shows the content of the packet (hex and ascii). *The parameter -A shows the content of the packet (only ascii).

sudo tcpdump host 10.42.31.255 and port 45678 -c 1 -A

We need to cut the text we don't want by using commands from bash.

sudo tcpdump host 10.42.31.255 and port 45678 -c 1 -A 2>/dev/null | tr ',' '\n' | tail -n 9 | head -n 2

Note that 31 is the OCTET, if we execute this bash in master, we know the OCTET by doing:

cat ~/personavars.txt | grep DHCP_OCTET | sed 's/=/\ /g' | awk '{print $2}'

So to sum up, the script would be:

sudo tcpdump host 10.42.$(cat ~/personavars.txt | grep DHCP_OCTET | sed 's/=/\ /g' | awk '{print $2}').255 and port 45678 -c 1 -A 2>/dev/null | tr ',' '\n' | tail -n 9 | head -n 2

In order to execute that bash command to the master we will need the tcpdump command, and also access to sudo for that command.

Added into the installation script and the subroutine (ip-reloader.sh) a way of creating a virtual input device that simulated an spacenavigator device. You can then write inputs to the symlink /dev/input/spacenavigator that points to the virtual input device. More information about this here: https://github.com/ivancolomer/LGxEDU/tree/master/liquid-galaxy/input_event

Added that when SpaceNavigator disconnects a symlink is created to point to VirtualSpaceNavigator automatically.

Added VirtualSpaceNavigator into LiquidGalaxy general installation in order to make Eric's API work there.

Added symlink to virtual SpaceNavgiator when real SpaceNavigator disconnects.

Opened ports 8112 (Eric's API) and 8113 (Sreyas)

There was an error with locales (languages) for Crouton ChromeBooks and it should have been fixed by setting locales on startup.