Categories: Chrome<< | Page list | >>
How to setup Lyx on a Chromebook
The Chromebook was launched in 2011 as a pure netbook, but has come a long way since then. It now has many offline facilities, runs Android apps from the Google Play Store (including Microsoft Office apps), and also many Linux apps. This makes it increasingly attractive as a low cost Windows laptop alternative. We here describe how to install and set up the Lyx Linux app, particularly for a Windows user unfamiliar with Linux.
The Chromebook runs Google's Chrome OS operating system. This includes a virtual machine manager (CrosVM) which in particular hosts 2 VMs, one for Android apps, and one for Linux (currently Debian 10 Buster). Support for Linux is labelled beta, but seems very stable. The Gnome GUI is supported but not installed by default. In fact it seems superfluous as integration with Chrome OS is actually very good: Linux apps appear as normal apps on the Chrome OS desktop, and files downloaded in Chrome or in Google Drive can be shared with Linux (and hence Lyx). Unfortunately for Windows users, this filesystem integration does not extend to OneDrive, but there is a native Linux workaround described later in this entry.
Any modern (2019 or later) Chromebook will host Linux apps, and also many earlier ones - a complete list can be found here. The author is running Lyx on an HP Chrome 14 (dating from early 2019) with an AMD A4 CPU (2.2GHz), 4Gb RAM and 32Gb disk. The Lyx installation takes around 5Gb of disk (including Linux/TexLive/Lyx/Okular). This configuration happily supports the following (concurrent) workload configuration with no obvious issues: several Word docs, several pdfs, OneNote, 25 Chrome browser tabs, 40 page Lyx math paper.
The Chromebook keyboard is different!
Gone are the Windows key, Caps Lock and Delete keys, and Fn keys! The Delete function is accessed via alt-backspace. The old Caps Lock key has been repurposed as a universal search key called "Everything", although alt-Everything will still invoke the Caps Lock function. The Fn keys have been replaced by brightness/volume/power keys, some new dedicated browsing keys (Back/Forwards, Refresh, Fullscreen) and a display all open windows key (which rapidly becomes essential once more than a few apps are open). These latter keys can be reassigned to function as Fn keys, but they seem better used as designed.
The touch panel has a left click action only! The right click action is invoked via a two finger tap.
The taskbar (called the "shelf", and possibly auto-hidden) when anchored at screen bottom shows a seemingly arbitrary selection of apps (center), a soft "Everything" key (left), and status icons (notifications/wifi/battery/clock) on the right. To find open apps not on the shelf (even when using the scroll buttons!), hit the "Open all windows" key in the top row.
Click the clock icon to access more status detail, and give access to the settings screen (via the gear icon).
Invoke "Everything" (via the keyboard button, or the taskbar button) to display recently used apps and the search bar. The search bar is used to search for installed apps, internet, and settings. If visible, the upper arrow above the search bar provides access to screens of installed apps (similar to a phone).
Linux is case sensitive, so commands need to be typed exactly, and "a.doc" and "A.doc" are different files! The strong Windows convention of giving files a file-type (such as ".doc") is a weaker convention in Linux, so a document file may just be labelled "a". Names starting with '.' are the equivalent of Windows hidden files, although in practice the Lyx dialogues always appear to show them. However if you use a file manager in Chrome OS or Linux, you will probably need to switch an appropriate setting to see hidden files.
The user "home" directory (a bit like your Windows Documents directory) is named by the user name you will set up during the install step - let's say we use 'Jo'. When you first run Lyx and then click 'File/Open', Lyx will open this directory ('Jo').
By convention, all Linux users run as users rather than administrators. To run a command which requires administrator privileges, the command is prefixed with "sudo" (for "superuser do").
If you are starting from scratch that is all you need to know to get started and you can skip the rest of this section.
Most will need to gain access to existing files in the cloud, and to do this we need to understand more.
Linux uses '/' in file paths rather than the Windows '\'. Linux does not use drive letters - effectively everything is lumped together to appear as one huge hybrid drive, and every absolute path starts from the root '/'.
The equivalent of the Windows "C:\Users" directory is "/home", so Jo's home directory actually has a path name of "/home/Jo". A special symbol '~' is also used as a shortcut to the current user's home directory (Windows Powershell has also adopted this convention), so '~/Documents' points to the "Documents" folder (if I have one) at the absolute path "/home/Jo/Documents".
New disks are "mounted" in the hybrid drive by assigning them to an existing but empty folder. This folder then appears to contain the contents of the new drive. We will see this in action when we need to access drives in the cloud (GoogleDrive, OneDrive, Dropbox etc).
Enter the settings screen (via the taskbar clock, followed by the gear icon) Click the Developers tab, then follow the instructions to install the hosted Linux environment. You will need to provide a user name (like an old fashioned Windows local user name - ie not an email!) - we will use Jo in the sequel. This is used to set up a user directory in the Linux file system.
It takes a few minutes to download and install the environment, then a command line window (called a Terminal window in Linux) will open.
To follow the instructions below, type a given line of text (up to the comment character '#') into the window and press enter. Alternatively you can cut and paste, but (crucial tip!) the key sequences in the Terminal window are Ctrl-Shift-V to paste and Ctrl-Shift-C to copy. Be warned that the usual Ctrl-C sequence does not copy text, it cancels a running program! Pasting the comment is harmless.
To open the Terminal window at any time in future, hit "Everything", and type "Terminal" into the search bar.
In the Terminal window, before installing Lyx, there are 2 optional but recommended steps to update the Linux system.
1) Update the repository indexes by typing in the following line (and hitting enter):
We can now install Lyx via:
Once finished, the Terminal window can be closed. We can now launch Lyx: invoke Everything, then type Lyx into the search bar, and click the Lyx icon to launch it.
Useful tip: Invoke Everything, then right click (2 finger tap) on the Lyx icon, then pin it to the shelf for easy access in future.
Hit the Everything button and search for the "Files" app (Windows explorer equivalent). Once open, navigate to any folder you wish to share and double tap it, then select "Share with Linux". The obvious candidates are GoogleDrive and MyFiles/Downloads. This causes the top of the directory tree to be mounted in Linux at /mnt/chromeos (so MyFiles is found at /mnt/chromeos/MyFiles). Lyx should now be able to use files in the shared directories.
For convenience, you may want to mount directories in your home directory. To mount the directory /Documents/MyLyxDocs from GoogleDrive as LyxFiles in your home directory, open a Terminal and type:
There is a OneDrive app in the Android PlayStore but it only provides read only access. To obtain access for Lyx, a native Linux app is required. We use rclone, but the level provided with Debian is too old so we install it directly. Open a Terminal window and enter:
The next step is to configure rclone to access OneDrive. First go back to the Chrome browser, and sign in to Microsoft (https://www.office.com/) with the user credentials of the OneDrive account you wish to access (if you have multiple, sign out of Microsoft after each "rclone config", then repeat these steps for each id). Go back to the Terminal and enter the following line and subsequent answers (replacing OneDriveA with any name of your choice).
Provide the following answers: N OneDriveA 26 (Enter) (Enter) 1 n y (After this answer Microsoft window should open asking you to authorise rclone for access - allow it, close the window, and return to the Terminal) 1 (unless you want Sharepoint) 0 (or any other valid choice, if multiple options) y y
On completion, rclone is ready to mount OneDriveA as a folder in the Linux filesystem. To mount it as MyOneDrive in your home directory, enter:
Lyx should now be able to see MyOneDrive in your home directory. If your Lyx files are in a directory buried deep in OneDrive, you may wish to mount that directory for easier access as we did with GoogleDrive above.
Warning: The rclone mount command needs to be issued every time you start Linux for the first time after restarting Chrome OS. This can be set up to happen automatically, but that is beyond the scope of this article.
Dropbox can be treated in the same way as OneDrive using rclone. Of course some of the answers need to be altered appropriately, but this is straightforward.
If you have set up a carefully customised Lyx environment you will want to move it across into the Chromebook environment as far as possible. This is not supported directly in Lyx, so the best we can currently offer are the following hard won tips.
We assume customisations are limited to the Lyx user directory (as they should be!). The user directory can be found by opening "Help/About in Lyx" (in both Windows and Linux). Given the username Jo, the Lyx 2.3 Windows user directory will normally be "C:\Users\Jo\AppData\Roaming\LyX2.3" and the Linux user directory will be "/home/Jo/.lyx" (we'll call these wud and lud respectively). Basically we need to copy the contents from wud to lud but with caveats which we will point out below.
First, Windows text files differ from Linux text files, most significantly in line endings, and need converting. Fortunately cloud technology is pretty good at managing this process automatically these days, so the simplest way to transfer files is to copy them on the host Windows machine from wud into a cloud folder, then on the Chromebook copy them from the cloud folder into the Linux directory lud. In particular copy each folder in wud to lud, but do NOT copy the files in wud which are not in a folder. The most important folders are: "bind" (contains any shortcuts you have set up), "templates", "examples" (self-explanatory), and "layouts" (any modifications to Lyx document classes). You do not need to copy empty folders, but it is probably just simplest to copy everything.
This leaves 2 of the files NOT in a folder of wud which we need to work with.
Your personal dictionary (if you have one) is the file pwl_*.dict in wud, where the * represents your language (eg mine is "pwl_british.dict"). Copy this to your home directory "/home/Jo" in Linux (not lud). In Linux Lyx add a word to the personal dictionary (to force creation of the Linux dictionary), then exit Lyx. In the Terminal type:
Identify the file ".aspell.*.pws" where * will represent your language (eg mine is ".aspell.en.pws") Using your filenames in place of mine, type:
The file "preferences" in wud can be copied to lud and edited if you know what you are doing. However it contains Windows paths which need to be converted to Linux paths plus some Windows only stuff. It is therefore much safer to reenter your preferences using Lyx (under "Tools/Preferences"). In particular, browse to the correct Linux paths for your working directory, templates and examples (under "Editing/Paths") and your "bind" file (under "Editing/Shortcuts").
There is a default PDF viewer which the Lyx installation will use, however it does not support forward and backward search (between Lyx and the viewer). If you need this you will need to install a suitable viewer, and unfortunately Sumatra is Windows only. A good replacement is Okular, and this can be installed as follows:
In Terminal type:
After the installation follow the Lyx wiki steps here: https://wiki.lyx.org/LyX/SyncTeX