Slax USB GNU Linux

Slax GNU/Linux Live USB drive prepared for the R course taught at the OMD-AjBCN

1.1. Setup

1.1.1. Slax base iso

Slax 9.x: https://slax.org

1.1.2. USB setup

  • Get a 16Gb USB3 disk
  • Make two partitions
    leave 4Mb of NO free space at the beggining of usb disk (if you leave some empty space, windows doesn't search for the ntfs or fat32 partition, regardless of being the first or the second in sort order at the disk).
    1. ~7.5Gb ntfs (labelled as 7gb_ntfs, in our case; adapt to your preferences)
    2. ~8.5Gb ext4 (labelled as 8gb_ext4, in our case; adapt to your preferences)
  • uncompress slax.iso in your linux disk (with isomaster for instance)
  • copy your slax folder to your usb ext4 partition
  • run as root the file in your usb ext4 partition: sudo bash ./slax/boot/bootinst.sh to make your usb bootable
  • shutdown your computer, and boot it again this time from your usb stick. Slax should boot
  • make your desired changes following guidelines on slax.org website (see more details below, also)
  • change keyboard by hand tweaking a file in the persistent changes folder
    • Edit this file /root/.fluxbox/startup and add there near the top a line such as
      setxkbmap es
  • reboot slax to check that your changes were kept as desired. Power off the machine.
  • test the usb disk in a computer booting MS Windows or Mac OSX, to double check that the disk is recognized by default and you can read and write to this partition from that OS.
  • clone your usbdisk (with partitions and all) with dd.
    • find your usb-disk device name (-+/dev/sdc+- in this example). You can find out with command sudo lsblk or sudo fdisk -l
    • make image with dd. Example:
      sudo dd if=/dev/sdc of=/media/xavi/mollero_ext4/usbdisk/backup_slaxomdr_yymmdd.img bs=4M status=progress
    • clone back over another usb with dd again (or theoretically with a dd GUI, but gdiskdump fails for me on Kubuntu 16.04)
      To restore the image to another USB drive just invert the process. Just make sure that the new USB drive (-+/dev/sdd+- in this example) is as big or bigger than the original one
      sudo dd if=/media/xavi/mollero_ext4/usbdisk/backup_slaxomdr_yymmdd.img of=/dev/sdd bs=4M status=progress

1.1.3. Customizations

  1. Keyboard
  2. Add parcellite to systray (ideally run by default when booting in).
  3. Add kupfer to systray (ideally run by default when booting in). But fails to say when you clonse the konsole that is shown up when running it.
  4. Background
  5. Clock
  6. Installed programs
    1. firefox-esr
    2. R RStudio et al. (see bash script below)
    3. gnumeric
    4. abiword
    5. clamTk
    6. testdisk
    7. git-cola
    8. filezila

You can place new files in teh usb disk so that they show up in the default "home" folder of the default root user once the usb is booted. Example:

  • Custom directory (e.g. curs-r-introduccio) with files under the Documents folder of the default root user.
    • You need to place the folder "curs-r-introduccio" at (adapt path to your case):
  • Alternatively, you can place those files under the ntfs partiton ( 7gb_ntfs ), so that they are viewable from the slax system ANd from another computer with MS Windows (or Mac OSX) operating systems and operate with those files normally as with any other usbdisk.

Pending to test/implement

  • set parcellite to boot by default by means of tweaking whatever system file is needed?
  • test synaptic instead of kupfer?
  • add some terminal window program that allows copy & paste (default one doesn't). Terminator didn't work (didn't install properly for some reason, in some tests I did in the early stages of customizing the usbdisk).

1.1.4. Troubleshooting Your customized slax usbdisk can't enter the graphical mode

Setting up the slax-usb stick in one computer, might set the temp path under the "changes" directory as a symbolic link to a temp folder in a hard disk (e.g. +/dev/sda5/tmp/+- ) of the physical computer where you are testing or tweaking the usb disk in. The first time I saw this, the temp folder was set to reuse an ext4 partition on the host computer where the usbdisk was plugged in.

However, when you place your customized usbdisk into another computer, that tmp folder might no exist in that other computer, and therefore, your customized slax wouldn't be able to boot into the graphical mode, due to being unable to create temp files or folders for the Xorg graphic display, or others.

Therefore, if the customized slax usbdisk is not able to boot into the graphical mode but only in text mode, you can log in that text screen with the usual credentials (user root, password: toor, as indicated in that login screen itself), and attempt to start the graphical mode by hand by means of running the command startx. See the error message that will be displayed in the screen. If it says anything related to being not able to create a file or folder under tmp, then you need to double check that the folder where the symbolic links points to does exist.

One quick workaround to solve this problem is to remove the tmp symbolic link and create a real tmp folder in the usbdisk instead. It might make things slower, but at least it will work.

1.1.5. Custom modules (.sb)

Following the guidelines on how to make custom slax modules:

  • Background image: /modules/slax_wallpaper_ajbcn.sb
  • Firefox: 06-firefox.sb

1.1.6. Install extra system programs

apt install -y default-jre default-jdk
add-apt-repository ppa:webupd8team/java
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C2518248EEA14886
apt update
apt install oracle-java8-installer
apt install -y gfxboot-theme-ubuntu squashfs-tools syslinux-utils libnss-winbind winbind cifs-utils oracle-java8-installer nfs-common git git-cola mc htop parcellite kupfer p7zip-full printer-driver-cups-pdf meld sendemail gigolo
apt install dirmngr apt-transport-https ca-certificates software-properties-common gnupg2
apt-key adv --keyserver keys.gnupg.net --recv-key 'E19F5F87128899B192B1A2C2AD5F960A256A04AF'
add-apt-repository 'deb https://cloud.r-project.org/bin/linux/debian stretch-cran35/'
apt install -y  r-recommended  r-cran-xml libgraphviz-dev libcairo2-dev r-cran-cairodevice freeglut3 freeglut3-dev r-cran-rglpk r-cran-rgl r-cran-misc3d libx11-dev libxt-dev libcurl4-gnutls-dev libxml2-dev r-cran-xml libgraphviz-dev libcairo2-dev bwidget tk-table libv8-dev r-cran-rjava libmpfr-dev libc6 libssl-dev texlive-latex-extra texlive-lang-spanish libx11-dev libxml2-dev libxt-dev r-cran-misc3d subversion git texmaker tk-dev unaccent xvfb libgdal-dev libproj-dev libmagick++-dev r-cran-rcolorbrewer r-cran-doparallel libssh2-1-dev libudunits2-dev libgdal-dev libgeos-dev libproj-dev libjq-dev libprotobuf-dev protobuf-compiler libssl-dev libcairo2-dev libapparmor-dev
R CMD javareconf

1.1.7. Install R packages

if (!require(devtools)) install.packages("devtools"); library(devtools)
# If you have R < 3.5, you won't be able to install pacman from repos since latest pacman requires R 3.5+. Therefore, install an earlier version with:
install.pacman <- function(){
  # Check Availability of package manager "PacMan" (and install it, if missing)
  # if you have R < 3.5
  if (version$major==3 && version$minor < 5) {
    if (!require("pacman")) {
      # Instal.la devtools si et cal
      if (!require("devtools")) install.packages("devtools"); require("devtools")
      cat("R Version: ", paste0(version$major,".",version$minor), ". ")
      cat("Tens una versió de R anterior a 3.5, per tant, instal.lem la versió corresponent de PacMan (0.4.1)\n")
      # Instal.la la darrera versió de pacman (0.4.1) que anava abans de la que va només amb R 3.5+ (pacman v0.5)
      install_version("pacman", version = "0.4.1"); require("pacman")      
  } else {
    # if you have R 3.5 or higher
    if (!require("pacman")) install.packages("pacman"); require("pacman")
# Llista de màxims
p_load(addinslist, aplpack, autocogs, bitops, brew, cartogram, cartography, caTools, checkpoint, collapsibleTree, colorspace, condformat, cowplot, CRANsearcher, crosstalk, cshapes, d3heatmap, data.table, devtools, doMC, doParallel, dplyr, DT, editData, esquisse, eurostat, ff, flextable, foreign, formattable, fs, future.apply, GADMtools, gapminder, geofacets, geogrid, geofacet, GGally, gganimate, ggiraph, ggmap, gitlabr, googleVis, htmltools, htmlwidgets, huxtable, janitor, kableExtra, knitr, leaflet, leaflet.extras,  leaflet.minicharts, magick, mapdeck, maps, mapview, marmap, mclust, Nozzle.R1, oce, officer, openxlsx, pacman, parallel, pivottabler, plotly, plotrix, plyr, png, purrr, purrrlyr, RColorBrewer, RCurl, raster, readr, readxl, relimp, reshape2, rhandsontable, rio, rJava, rjson, rLandsat, rmapshaper, rmarkdown, rnaturalearth, rnaturalearthhires, RODBC, rosm, rpivotTable, rsvg, R.utils, sem, sf, SnowballC, stringr, svglite, svgPanZoom, tictoc, tidyverse, tm, tmap, treemap, trelliscopejs, vembedr, VennDiagram, webshot, widgetframe, wordcloud, wordcloud2, XML, xml2, xtable)

# Llista de mínims
p_load("devtools", "plotly", "stringr", "xml2", "data.table", "xtable", "plyr", "dplyr", "reshape2", "rjson", "d3heatmap", "htmlwidgets", "googleVis", "knitr", "rmarkdown",  "addinslist", "tidyverse", "magick", "webshot", "officer", "flextable", "huxtable", "RODBC", "leaflet", "gitlabr", "colorspace", "mapdeck", "rsvg", "png", "cartography", "rJava", "sf", "tmap", "rio", "caTools", "bitops", "kableExtra", "RCurl", "XML")

1.2. Screenshots

Slax Ajbcn CursR 00 Escriptori

Slax Ajbcn CursR 00 Menu Progs

Slax Sjbcn CursR 01 RStudio Exemple

Slaxusb Connexio Wifi Ajbcn

Alias names for this page:
Slax | SlaxUSB

Image Seed: noun \ˈsēd\ : the beginning of something which continues to develop or grow

Knowledge seeds

Switch Language