Lucas . Villa Real IBM Research - Brazil [email protected]

About GoboLinux

● Alternative distribution born in 2002

● Explores novel ideas in the distribution ecosystem

● Introduces a rather different directory hierarchy

How different? lucasvr@fedora ~] ls / bin dev home lib64 media opt root sbin sys usr boot etc lib lost+found mnt proc run srv tmp var lucasvr@fedora ~] ls /usr bin games include lib lib64 libexec local sbin share src tmp lucasvr@fedora ~] ls /usr/local bin etc games include lib lib64 libexec sbin share src lucasvr@gobolinux ~] ls / Data Mount Programs System Users

GoboLinux File System Hierarchy

/Programs

Self-contained programs: no need for a

~] ls /Programs AbsTk DiffUtils GnuTLS Kerberos LibXML2 ACL Dit GoboHide Kmod LibXSLT Acpid DosFSTools GParted Lame Linux AGNClient E2FSProgs Gperf LCMS Linux-Firmware ALSA-Lib EFIBootMgr GPM Less Linux-PAM ALSA-Utils ELFUtils Grep LibDRM Lsof APR EncFS Groff LibEvdev Lua APR-Util ExFAT GRUB LibExif LuaRocks …

/Programs

Multiple versions of a given program can coexist

~] ls /Programs/GTK+ 2.24.22 2.24.30 3.10.6 3.21.4 Current Settings

~] ls /Programs/GTK+/2.24.22 bin doc include lib Resources share

~] ls /Programs/GTK+/2.24.22/bin -builder-convert gtk-demo gtk-query-immodules2.0 gtk-update-icon-cache

~] ls /Programs/GTK+/2.24.30/bin gtk-builder-convert gtk-demo gtk-query-immodules2.0 gtk-update-icon-cache

/Programs

Easy to tell which files belongs to which packages

lucasvr@fedora ~] ls -l /bin/bash -rwxr-xr-x. 1 root root 1072008 Sep 30 05:25 /bin/bash

lucasvr@gobolinux ~] ls -l /bin/bash lrwxrwxrwx 1 root root 35 Dec 1 23:42 /bin/bash -> /Programs/Bash/4.4/bin/bash

/Programs

● Binary packages and packages built from their source code are both 1st class citizens

● Removing a program is easy

● Listing available packages is easier

● The whole system becomes intuitive

/System

~] ls /System Aliens Environment Index Kernel Settings Tasks

Aliens: packages handled by third-party managers

~] ls /System/Aliens Cabal CPAN LuaRocks RubyGems

/System

~] ls /System Aliens Environment Index Kernel Settings Tasks

Environment: variables and aliases exported by programs

~] ls /System/Environment BootScripts—016 —2.0.2 LibTool—2.4.6 LuaRocks—2.4.0 Lua—5.3.3 …

~] cat /System/Environment/Htop—2.0.0 alias top=htop /System

~] ls /System Aliens Environment Index Kernel Settings Tasks

Index: indexes to entries under /Programs

~] ls /System/Index bin include lib lib64 libexec sbin share

/System

~] ls /System Aliens Environment Index Kernel Settings Tasks

Kernel: pseudo-file systems and boot images

~] ls /System/Kernel Boot Devices Modules Objects Status

/System

~] ls /System Aliens Environment Index Kernel Settings Tasks

Settings: system settings

~] ls /System/Settings acpi cron.d fam.conf gtk-3.0 limits cups fonts hosts localtime asciidoc cupsinit fstab ImageMagick-7 login.access avahi dbus-1 gconf inittab luarocks ...

/System

~] ls /System Aliens Environment Index Kernel Settings Tasks

Tasks: start/stop scripts

~] ls /System/Tasks Acpid Avahi CUPS Firewall MessageBus OpenSSH Portmap Alsactl CheckFS FAM GoboHide Mouse Pommed PowerTOP ...

Backwards Compatibility

Backwards Compatibility

● #!/bin/sh ?

● #!/usr/bin/env ?

● /dev/null?

Backwards Compatibility

~] sudo gobohide -l /bin /boot /dev /etc /lib /lib64 /mnt /proc /run /sbin /sys /tmp /usr /var Backwards Compatibility

/bin -> /System/Index/bin /boot -> /System/Kernel/Boot /dev -> /System/Kernel/Devices /etc -> /System/Settings /lib -> /System/Index/lib /lib64 -> /System/Index/lib64 -> /System/Index/lib /mnt -> /Mount /proc -> /System/Kernel/Status /run -> /Data/Variable/run /sbin -> /System/Index/sbin -> /System/Index/bin /sys -> /System/Kernel/Objects /tmp -> /Data/Variable/tmp /usr -> directory with “local” link to self plus links to /System/Index /var -> /Data/Variable

Backwards Compatibility

Having fun with GoboHide

~] sudo gobohide -h /* ~] ls / ~] find /

Compile Tool

Compile Tool

● GoboLinux’s own tool to compile programs from their sources

● “Recipes” describe build rules

● The majority of the build process complexity is hidden in the tool – New users can learn how to write recipes in a heartbeat

(Simplified) Gentoo Ebuild file EAPI=6 Compile Tool inherit autotools linux-info HOMEPAGE="http://hisham.hm/htop/" SRC_URI="http://hisham.hm/htop/releases/${PV}/${P}..gz" SLOT="0" IUSE="kernel_FreeBSD kernel_linux openvz unicode vserver" RDEPEND="sys-libs/ncurses:0=[unicode?]" DEPEND="${RDEPEND} virtual/pkgconfig" DOCS=( ChangeLog README ) CONFIG_CHECK="~TASKSTATS ~TASK_XACCT ~TASK_IO_ACCOUNTING ~CGROUPS" PATCHES=( "${FILESDIR}/${PN}-2.0.2-tinfo.patch" ) pkg_setup() { linux-info_pkg_setup } src_prepare() { rm missing || die; default; eautoreconf } src_configure() { [[ $CBUILD != $CHOST ]] && export ac_cv_file__proc_{meminfo,stat}=yes #328971 local myeconfargs=() myeconfargs+=( --disable-hwloc --enable-taskstats $(use_enable kernel_linux cgroup) $(use_enable kernel_linux linux-affinity) $(use_enable openvz) $(use_enable unicode) $(use_enable vserver) ) econf ${myeconfargs[@]} } (Simplified) SuSE RPM spec file

Source0: %{name}-%{version}.tar.bz2 Compile Tool Patch0: htop-desktop-file-fix-thoenig-01.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: ncurses-devel python update-desktop-files Recommends: strace lsof AutoReqProv: on

%prep %setup %patch0 -p0 %build export CFLAGS="%{optflags} `ncursesw6-config --cflags`" export LDFLAGS="`ncursesw6-config --libs`" %configure --enable-unicode --enable-taskstats --enable-cgroup make %{?_smp_mflags} %install %makeinstall %suse_update_desktop_file -i %name System Monitor %clean rm -rf %{_buildroot} %files %defattr(-,root,root) %doc COPYING %{_bindir}/%{name} %{_datadir}/applications/%{name}.desktop %{_datadir}/pixmaps/%{name}.png %{_mandir}/*/%{name}* Compile Tool

GoboLinux Recipe file

~] cat /Data/Compile/Recipes/Htop/2.0.2-r1/Recipe

# Recipe for version 2.0.2 by Hisham Muhammad compile_version=1.8.0 url="http://hisham.hm/htop/releases/2.0.2/htop-2.0.2.tar.gz" file_size=476364 file_md5=7d354d904bad591a931ad57e99fea84a recipe_type=configure

Compile Tool

Recipe meta data

~] ls /Data/Compile/Recipes/Htop/2.0.2-r1 Recipe Resources 01-example.patch 02-another_example.patch

~] ls /Data/Compile/Recipes/Htop/2.0.2-r1/Resources BuildInformation Dependencies Description Environment

Compile Tool

Recipe Dependencies file

~] cat /Data/Compile/Recipes/Htop/2.0.2-r1/Resources/Dependencies Glibc Ncursesw >= 5.6

~] ls /Programs/Glibc 2.24 Current Settings

~] ls /Programs/Ncursesw 6.0 Current Settings

File System Virtualization

File System Virtualization

● GoboLinux Runner

● Dynamically changes a process’ view of /System/Index – Resources/Dependencies – Per-process name space – True conflict resolution

● Container-free virtualization

● Transparent multi-arch support (32/64-bit)

File System Virtualization Runner under the hoods

~] Runner -v bash creating new namespace adding dependency at /Programs/Glibc/2.24 adding dependency at /Programs/Ncurses/6.0 adding dependency at /Programs/Readline/7.0 ~] ~] grep overlay /proc/self/mounts | awk {‘print $1 “ “ $2’} overlay /System/Index/bin overlay /System/Index/include overlay /System/Index/lib overlay /System/Index/libexec overlay /System/Index/share File System Virtualization Multi-arch support /Programs/AGNClient/Current] ./bin/vpnCLI zsh: no such file or directory: ./bin/vpnCLI

/Programs/AGNClient/Current] uname -m; file ./bin/vpnCLI x86_64 ./bin/vpnCLI: ELF 32-bit LSB executable, interpreter /lib/ld-linux.so.2

/Programs/AGNClient/Current] ls -l /lib/ld-linux.so.2 ls: cannot access ‘/lib/ld-linux.so.2’: No such file or directory

/Programs/AGNClient/Current] Runner ./bin/vpnCLI Usage: vpnCLI [SMX Server] ( [Proxy Addr:Port] [Proxy User] [Proxy Name] ) File System Virtualization Multi-arch support /Programs/AGNClient/Current] cat Resources/Architecture i686

/Programs/AGNClient/Current] cat Resources/Dependencies Bash 3.1_i686 CoreUtils 8.12_i686 Curl 7.15.3_i686 DiffUtils 2.8.1_i686 …

Programs/AGNClient/Current] cat /Programs/Bash/3.1-i686/Resources/Architecture i686 Highlights from the Past

Highlights from the Past

● Long, descriptive directory names – “Programs”, “Settings”, “System”

● Results – No clashes with the Linux name space (e.g., sysfs’ /sys – 2003) – Seamless lower- to upper-case TAB-completion on ZSH and Bash

Highlights from the Past

● Configurable super-user name – Why “root”? – POSIX only states that super-user has an UID of 0

● Results – Way too many patches to third-party programs! – Not worth the effort

Highlights from the Past

● BootScripts – Experimented with Runit – Used a dependency-based boot sequence

● Results – Hard to describe and maintain the dependencies chain – Added complexity for no significant gain – Stale daemons for no reason – Embraced our own BootScripts

Highlights from the Past

● /System/Links/{Executables,Libraries,Headers,Shared,Manuals} – Cannot compile with prefix=/System/Links – Programs end up with different prefixes

● Results – Switched to /System/Index/{bin,lib,include,share,man} – All programs are compiled with the same prefix – An overlayfs sandbox moves installed files to the /Programs tree

Highlights from the Past

● Compatibility links – /bin, /sbin, /usr/bin, /usr/sbin are all the same – /usr/local is a link to /usr

● Results – We’re even more compatible than other distros! – Red Hat embraced the merge of /usr (2012), others followed

Highlights from the Past

● Experimenting with Linux can be – There are many open problems – There are many problems with poor solutions

● Lack of standardization is terrible... and terrific

Visit us now at gobolinux.org