Documentation Overview

  1. Operation documentation
    1. Installation
      1. Run UBOS on a PC (64bit)
      2. Run UBOS from a boot stick on a PC (64bit)
      3. Run UBOS in a VirtualBox virtual machine (64bit)
      4. Run UBOS on an Amazon Web Services EC2 virtual server
      5. Run UBOS on Raspberry Pi 5
      6. Run UBOS on ESPRESSObin
      7. Run UBOS in a Linux container on a PC (64bit)
      8. Run UBOS in an aarch64 Linux container
    2. Setting up your first Site and App
    3. Setting up networking and DNS
    4. How to create a website secured by SSL/TLS
    5. Managing Sites and Apps
    6. Backup and restore
    7. Upgrading and keeping UBOS current
    8. The UBOS Staff
    9. App-specific notes
      1. Reliably send e-mail via Amazon Web Services’ Simple E-mail Service: amazonses
      2. Static website hosting with rsync-based upload: docroot
      3. Notes on Mastodon
      4. Notes on Nextcloud
      5. Notes on Redirect
      6. Notes on Wordpress
    10. Device-specific Notes
      1. ESPRESSObin
      2. Raspberry Pi
    11. Advanced management
      1. Enabling non-standard package repositories
      2. Migrating from one App to another
      3. Pinning resources
    12. Command reference
    13. FAQ, HOWTOs and Troubleshooting
      1. “Package not found error” when installing a new App or Accessory
      2. A UBOS container comes up degraded
      3. Booting UBOS on a PC starts out fine, but then the screen goes blank
      4. Can I run UBOS in a Docker container?
      5. Can I use UBOS without purchasing a domain name?
      6. Cannot access MySQL database. File missing: /etc/mysql/root-defaults-ubos.cnf
      7. Cannot boot UBOS from boot stick on a PC
      8. Cannot connect to the public internet from a UBOS container
      9. Cannot create a temporary backup; the backup directory is not empty
      10. Failed to create file /sys/devices/system/cpu/microcode/reload
      11. How are the various UBOS images different from each other?
      12. How can I install more than one web App on the same Device?
      13. How do I set up WiFi?
      14. How to enable non-standard Package Repositories
      15. How to get help
      16. How to log into your UBOS Device
      17. How to modify the configuration of your Site
      18. How to report a bug or issue
      19. How to use Pagekite to reach your UBOS Device behind a firewall
      20. How to use SSH
      21. I need a Package that isn’t in UBOS
      22. I need root
      23. I own a domain name, and I’d like to use it for my UBOS Device. How do I do that?
      24. I want to move from one device to another, or from/to the cloud to/from a device
      25. I want to run ssh on a non-standard port
      26. I’m running out of disk space, what now?
      27. Installing a new Package or updating fails with a message about “invalid or corrupted package” or “key is disabled”
      28. Installing a new Package or upgrading fails with a message about “unknown trust”
      29. Is it safe to have my Site accessible from the public web?
      30. My non-English keyboard layout is all screwed up
      31. My SD card is much larger than the UBOS image. How do I use the rest of the space?
      32. Nothing happens when UBOS is supposed to be booting
      33. Problems with “IPv6 Packet Filtering Framework”
      34. UBOS is in a “degraded” state
      35. ubos-admin status reports “Systemd unit … has failed”
      36. Verify your downloaded UBOS image
      37. What is the default “root” password?
      38. What text editor can I use on UBOS?
      39. Why did you derive UBOS Linux from Arch Linux, and what is the relationship between UBOS Linux and Arch?
      40. Why is it called UBOS?
      41. Writing a disk image to a USB stick or SD card
        1. Writing an image to a USB stick or SD card on Linux
        2. Writing an image to a USB stick or SD card on macOS
        3. Writing an image to a USB stick or SD card on Windows
  2. Developer documentation
    1. Developer setup
      1. Developing using Arch Linux on VirtualBox x86_64 with a systemd-nspawn container
      2. Developing using a UTM Arch Linux VM on Apple Silicon computers with UBOS in a systemd-nspawn container
      3. Alternate developer setups
        1. Developing using a systemd-nspawn container (Linux host only)
        2. Developing using Arch Linux using Parallels on Apple Silicon with a systemd-nspawn container
        3. Developing using a UTM Arch Linux VM on Apple x86_64 computers with UBOS in a systemd-nspawn container
    2. Developer tutorials for standalone UBOS apps (not UBOS Mesh)
      1. Build and run your first UBOS standalone App
      2. How to package UBOS standalone Apps built with a variety of languages
        1. Hello World
        2. Glad-I-Was-Here (PHP, Mariadb)
        3. An Accessory for Glad-I-Was-Here (PHP, Mariadb)
        4. Glad-I-Was-Here (PHP, Postgresql)
        5. Glad-I-Was-Here (Python, Mariadb)
    3. UBOS Gears Reference
      1. UBOS Manifest
        1. Structure of the UBOS Manifest
        2. Info section
        3. Roles section
        4. Customization points section
        5. Appinfo section
        6. Accessoryinfo section
        7. Variables available at deploy or undeploy
        8. Functions that may be applied to variables
        9. Creating random values
        10. Scripts in UBOS Manifests
      2. Site JSON
      3. A complex deployment example
      4. UBOS Networking
      5. Allocating and opening up non-default ports
      6. Logging
      7. UBOS state
      8. UBOS Backup format
      9. Format of the App Status JSON
      10. Testing standalone Apps with “webapptest”
      11. Understanding ubos-admin
        1. Command: ubos-admin backup
        2. Command: ubos-admin backupinfo
        3. Command: ubos-admin createsite
        4. Command: ubos-admin deploy
        5. Command: ubos-admin hostid
        6. Command: ubos-admin init-staff
        7. Command: ubos-admin list-data-transfer-protocols
        8. Command: ubos-admin listnetconfigs
        9. Command: ubos-admin listsites
        10. Command: ubos-admin read-configuration-from-staff
        11. Command: ubos-admin restore
        12. Command: ubos-admin setnetconfig
        13. Command: ubos-admin setup-shepherd
        14. Command: ubos-admin showappconfig
        15. Command: ubos-admin shownetconfig
        16. Command: ubos-admin showsite
        17. Command: ubos-admin status
        18. Command: ubos-admin undeploy
        19. Command: ubos-admin update
        20. Command: ubos-admin write-configuration-to-staff
    4. Release channels and UBOS release process
    5. Miscellaneous
      1. Potentially useful infrastructure for standalone Apps
        1. The UBOS rsync server
      2. Middleware-specific notes
        1. Node.js notes
        2. SMTP notes
      3. Setting up an Arch Linux system as a UBOS development system
        1. How to create a UBOS development VM for VirtualBox on x86_64
        2. How to create a UBOS development VM for UTM on x86_64 Apple computers
        3. How to create a UBOS development VM for UTM on Apple Silicon computers
        4. How to create a UBOS development VM for Parallels Desktop on Apple Silicon computers
      4. Creating cloud images
        1. Amazon Web Services EC2
    6. Developer FAQ
      1. Doesn’t apt / dpkg / yum / pacman etc. does what UBOS Gears does already?
      2. Doesn’t puppet / chef / ansible etc. does what UBOS Gears does already?
      3. Doesn’t Docker do what UBOS Gears does already?
      4. Is it possible to run UBOS Gears or Mesh on an operating system other than UBOS Linux?
      5. Can I manage apps packaged as Docker containers with UBOS?
  3. Architecture
  4. Glossary
    1. Accessory
    2. App
    3. AppConfigId
    4. AppConfigItem
    5. AppConfiguration
    6. Arch
    7. Arch Linux
    8. Attribute
    9. blessing
    10. Bot
    11. Context Path
    12. Customization Point
    13. Data Transfer Protocol
    14. Deployment
    15. Depot
    16. Device
    17. Device Class
    18. diet4j module framework
    19. EntityType
    20. Flock
    21. Gradle
    22. Handlebars
    23. History
    24. Home Server
    25. HostId
    26. Hostname
    27. IDE
    28. Installation
    29. LetsEncrypt
    30. mDNS
    31. MeshBase
    32. MeshObject
    33. MeshObjectIdentifier
    34. MeshType
    35. MeshTypeIdentifier
    36. Middleware
    37. Model
    38. Network Configuration
    39. Package
    40. Pagekite
    41. Parallels Desktop
    42. Personal Server
    43. PKGBUILD
    44. Property
    45. PropertyType
    46. Relationship
    47. RelationshipType
    48. Release Channel
    49. Repository
    50. Retention Bucket
    51. Role
    52. RoleAttribute
    53. RoleProperty
    54. RoleType
    55. Rolling Release
    56. Shepherd
    57. Site
    58. Site JSON
    59. Site JSON Template
    60. SiteId
    61. Transaction
    62. Transaction Log
    63. UBOS Gears
    64. UBOS Linux
    65. UBOS Manifest
    66. UBOS Mesh
    67. UBOS Mesh code generator
    68. UBOS Project
    69. UBOS Staff
    70. unblessing
    71. UTM
    72. VirtualBox
    73. VMWare
    74. Wildcard hostname

How to create a UBOS development VM for UTM on x86_64 Apple computers

/docs/development/misc/setting-up-arch-linux/setup-developer-vm-x86_64-utm/

Install UTM

  1. Download and install UTM if you have not done so already.

Obtain an Arch Linux x86_64 image

  1. Download an ISO from a mirror listed on https://archlinux.org/download/ (e.g. archlinux-2024.03.01-x86_64.iso)

Warning

Do not use the UTM-provided Arch Linux ARM image. It would run slowly in emulation mode on an x86_64 computer, and in our experience, has reliability issues.

Run the downloaded Arch Linux VM as the virtual machine to create the development VM with

  1. In UTM, create a new virtual machine:

    • Click “Create a New Virtual Machine”.

    • Select “Virtualize” (not “Emulate”).

    • In “Operating System”, select “Linux”.

    • In “Linux”, in the section “Boot ISO Image”, browse to your downloaded ISO file and select that. Leave the options unchecked. Click “Continue”.

    • In “Hardware”, accept the default and click “Continue.”

    • In “Storage”, enter 60GB as the “size of the drive”. Click “Continue”.

    • In “Shared Directory”, click “Continue”.

    • In “Summary”:

      • Change the name to “ubosdev”.

      • Select “Open VM Settings”

      • Click “Save”.

    • In the now-open settings dialog:

      • In the outline on the left, select the second “IDE Drive” (the one whose Image Type is “Disk Image”, not “CD/DVD”) and in the popup you get by clicking right, click “Delete”. The wizard creates a virtual IDE drive, but we want something else.

      • In the outline on the left, section “Drives”, click “New”, and then Interface “VirtIO” and size 60GB. Click “Create”.

      • Click “Save”.

  2. Now select “ubosdev” in the sidebar, and start it by clicking the run icon (">"). Accept the defaults in the boot loader (or just wait) and wait until the boot sequence ends and the root shell appears.

Install Arch on the empty disk and configure it

  1. Update the bootstrap VM and install some packages we need:

    # pacman -Sy
    # pacman -S btrfs-progs gptfdisk parted dosfstools arch-install-scripts vi
    
  2. Zero out the first bytes on the disk for extra robustness:

    # dd if=/dev/zero of=/dev/vda bs=1M count=8 conv=notrunc
    
  3. Clear the partition table:

    # sgdisk --clear /dev/vda
    
  4. Create the partitions (UEFI, /boot and /) and change them to the right types:

    # sgdisk --new=1::+1M /dev/vda
    # sgdisk --new=2::+512M /dev/vda
    # sgdisk --new=3:: /dev/vda
    # sgdisk --typecode=1:EF02 /dev/vda
    # sgdisk --typecode=2:EF00 /dev/vda
    
  5. Make sure changes are in effect:

    # sync
    # partprobe /dev/vda
    
  6. Create filesystems for partitions other than the UEFI partition:

    # mkfs.vfat  /dev/vda2
    # mkfs.btrfs /dev/vda3
    
  7. Mount the partitions so we can install:

    # mount /dev/vda3 /mnt
    # mkdir /mnt/boot
    # mount /dev/vda2 /mnt/boot
    
  8. Perform the actual install:

    # pacstrap /mnt base
    
  9. Generate the right fstab:

    # genfstab -U -p /mnt >> /mnt/etc/fstab
    
  10. Chroot into your future root disk and continue the installation:

    # arch-chroot /mnt
    
    1. Add the UBOS keyring so we can install our own packages:

      # curl -O https://depot.ubosfiles.net/yellow/$(uname -m)/os/ubos-keyring-0.9-2-any.pkg.tar.zst
      # pacman -U ubos-keyring-0.9-2-any.pkg.tar.zst
      # rm ubos-keyring-0.9-2-any.pkg.tar.zst
      
    2. Add the UBOS tools repo:

      # echo '' >> /etc/pacman.conf
      # echo '[ubos-tools-arch]' >> /etc/pacman.conf
      # echo 'Server = https://depot.ubosfiles.net/yellow/$arch/ubos-tools-arch' >> /etc/pacman.conf'
      
    3. Install more packages:

      # pacman -Sy
      # pacman -S linux mkinitcpio sudo vim btrfs-progs spice-vdagent qemu-guest-agent \
        gdm gnome-console gnome-control-center gnome-session gnome-settings-daemon \
        gnome-shell gnome-keyring nautilus \
        ubos-tools-arch
      

      If asked which alternatives to install, choose the defaults.

    4. Create a ramdisk:

      # mkinitcpio -p linux
      
    5. Configure the boot loader:

      # bootctl --path /boot install
      
    6. Install a locale:

      # perl -pi -e 's!#en_US.UTF-8 UTF-8!en_US.UTF-8 UTF-8!' /etc/locale.gen
      # locale-gen
      
    7. Set up networking:

      # echo '[Match]' > /etc/systemd/network/wired.network
      # echo 'Name=en*' >> /etc/systemd/network/wired.network
      # echo '' >> /etc/systemd/network/wired.network
      # echo '[Network]' >> /etc/systemd/network/wired.network
      # echo 'DHCP=ipv4' >> /etc/systemd/network/wired.network
      # echo 'IPv4Forwarding=1' >> /etc/systemd/network/wired.network
      # echo 'IPv6Forwarding=1' >> /etc/systemd/network/wired.network
      
      # systemctl enable systemd-networkd systemd-resolved systemd-timesyncd
      
    8. Create a user with the right permissions and no password:

      # useradd -m ubosdev
      # chmod 755 ~ubosdev
      # passwd -d ubosdev
      # echo ubosdev ALL = NOPASSWD: ALL > /etc/sudoers.d/ubosdev
      # chmod 600 /etc/sudoers.d/ubosdev
      
    9. No root password:

      # passwd -d root
      
    10. Exit from the arch-chroot shell with ^D.

  11. Remainder of networking setup:

    # rm /mnt/etc/resolv.conf
    # ln -s /run/systemd/resolve/stub-resolv.conf /mnt/etc/resolv.conf
    
  12. Configure UEFI:

    • Loader configuration:

      # echo timeout 4 > /mnt/boot/loader/loader.conf
      # echo default arch >> /mnt/boot/loader/loader.conf
      
    • Boot entry configuration:

      # echo title Arch > /mnt/boot/loader/entries/arch.conf
      # echo linux /vmlinuz-linux >> /mnt/boot/loader/entries/arch.conf
      # echo initrd /initramfs-linux.img >> /mnt/boot/loader/entries/arch.conf
      # echo options root=PARTUUID=$(lsblk -o PARTUUID /dev/vda3 | tail -1 ) rw >> /mnt/boot/loader/entries/arch.conf
      
  13. Power off the virtual machine:

    # systemctl poweroff
    
  14. Select VM “ubosdev” in the outline, and the at the bottom in the right pane, in the CD/DVD popup menu, select “Clear”.

Clean up the VM

  1. UTM has no direct functionality to do this, so we have to do it manually.

    • In UTM, select the “ubosdev” virtual machine. In the popup, select “Show in Finder”.

    • Quit UTM.

    • In the Finder, keep “ubosdev.utm” selected and in the popup, select “Show package contents”.

    • In the Finder, open “config.plist” with a text editor.

    • In the XML file, find the entry <key>Drive</key> and the two-element array that follows right after. They are likely towards the beginning of the file.

    • This array contains two dicts, the first representing the virtual CD/DVD drive, and the second the new disk.

    • In the text editor, delete the first dict (representing the CD/DVD) in its entirety.

    • Save “config.plist” and close the text editor.

Remaining configuration

  1. Run UTM again.

  2. Start the “ubosdev” VM again and wait until the login prompt appears.

  3. At the console, log in as ubosdev. There is no password.

  4. Fix the locale (command won’t run earlier)

    % sudo localectl set-locale LANG=en_US.UTF-8
    
  5. Enable Gnome:

    % sudo systemctl enable gdm
    
  6. Power off the virtual machine:

    % sudo systemctl poweroff
    

Add virtual graphics for the “ubosdev” VM

  1. In UTM, select the “ubosdev” VM, and in the popup, “Edit”.

  2. Under “Devices”, click “New…” and “Display”.

  3. Click “Save”.

When you start it next, your virtual machine will be in the same state as the pre-configured development VM described in Developer setup. Continue there.

Create a file for distribution

  1. In UTM, select the “ubosdev” VM and in the popup, “Share…”

  2. Save the file with a name that also contains the processor architecture, the current date and an index: ubosdev_x86_64-utm-YYYYMMDD-I.utm, e.g. ubosdev_x86_64-utm-20240405-1.utm. (Don’t add a UBOS channel to the name, as this is Arch.)

  3. The .utm file is actually a directory. Put it into a zip file:

    % zip -r ubosdev_x86_64-utm-YYYYMMDD-I.utm.zip ubosdev_x86_64-utm-YYYYMMDD-I.utm