Sortix
Sortix is a new self-hosting modern POSIX operating system providing: a capable server platform, a powerful and fun development platform, and a clean implementation that's easy to learn from.
The entire operating system was written from scratch with its own kernel,
standard library, base system, with many ports of third-party software.
It's easy to download and
install Sortix,
spin up lightweight servers, and put it into production running your own
programs. Sortix is built on Sortix and its whole infrastructure runs Sortix.
Releases come with the source code in
/src
ready for development
out of the box.
Sortix focuses on being clean and correct, stable and reliable, lightweight and modular, well documented, and being largely compatible with modern POSIX.1-2024, but also being free to redesign and innovate without existing compatibility constraints. Sortix focuses on actually being useful and production-ready.
It has been in development since February 08 2011 by a lead developer and contributors. The system is still young, and future releases will add missing features such as SMP and USB support. It's easy to upgrade installations to new releases, and there's a friendly community that's happy to help you.
Sortix 1.0 was released in March 2016. Its goal was to be a self-hosting system, installable on virtual machines and real hardware alike. Since then the project has switched to a rolling distribution with nightly stable builds and the Sortix 1.1 milestone release is nearing completion.
Sortix is free software licensed under the ISC license. This website is self-hosted on a Sortix server.
Quick start |
---|
qemu-img create -f qcow2 sortix.hdd 4G && |
Features
- Available for 32-bit and 64-bit x86 systems.
- Installable, upgradable, and self-hosting.
- Lightweight, powerful, and customizable.
- Standard POSIX command line environment.
- Lots of ports including: gcc, git, emacs, irssi, links, nano, qemu (no kvm), vim, ffmpeg, and many more.
- Includes server ports such as: ssh, nginx, sqlite, ntpd, and more.
- Easy to obtain HTTPS TLS certificates using acme-client from e.g. Let's Encrypt.
- Includes the programming languages: C, C++, python, perl, sh, awk, and lua.
- A new init(8) system with parallelism, dependencies, and daemon readiness.
- Network stack with UDP and TCP via IPv4.
- A simple desktop environment with a graphical user interface and multiple graphical terminals.
- A coherently designed kernel, libc, and base system written from scratch.
- Ability to amend release .iso's with additional keys, logic, scripts, and behaviors.
- ATA and AHCI harddisk and CD-ROM drivers.
- Filesystem driver for ext2.
- Partition editor with MBR and GPT support.
- Works well in virtual machines and in common clouds.
- Games such as asteroids.
- Includes the system source code in
/src
. - This release was built natively under itself including all ports.
- ... and it's all well documented in the manual.
Limitations
It is important to understand what limitations Sortix currently has:
- The system protects against network threats but not yet against local multi-user attacks.
- Network driver support is limited. IPv6 is not implemented.
- No support for USB.
- No dynamic linking.
- No graphics drivers (graphics only if bootloader support or in VMs).
- No sound drivers.
- No support for symmetric multiprocessing (SMP).
- The manual pages only partially document Sortix specifics.
- Not all parts of POSIX are implemented. POSIX-1.2024 is in progress.
These areas are being worked on and will addressed be in future releases. Nonetheless, the underlying system is surprisingly capable and the lead developer dual boots it on his computers, and runs it on all of the Sortix infrastructure including sortix.org and the irc.sortix.org chat network.
Sortix is easy to deploy
Sortix is easy to install interactively from the live environment. Installations
can be upgraded to the next release by booting the live environment of a newer
release. The sshd
daemon makes it easy to
remotely administer your system.
Ports such as nginx, sqlite, and acme-client lets you run common web applications.
You can easily amend a release .iso live environment with your custom configuration to set defaults and start daemons. It's easy to spin up a stateless server instance from a live environment with static data.
You can automatically install the operating system on a fleet of machines by preconfiguring the installer with your preferences and invoking your scripts during the installation. Organizations can maintain their own ports collections to centrally manage local software.
Sortix is lightweight
Sortix scales all the way down and up. You can choose which ports you wish to install on top of the supported minimal installation and which daemons to start. The init system is fast with parallel daemon initialization with dependency readiness. You choose whether to boot to a graphical environment, a shell environment, or no user environment at all. Sortix boots in less than a second on the lead developer's machines. The secret is to initialize everything else not strictly required for interactivity in the background.
A 32-bit installation can boot in as little as 32 MiB of memory out of the box. Sortix has been successfully run on a Pentium II. It's possible to do a custom build and golf out anything you don't need and boot to a single user shell in just 17 MiB. Sortix is modular on a build system level and you can build a custom system with a subset of the base system.
Sortix is a fun development platform
Sortix ships all the development tools out of the box including the C, C++,
Python, Perl, Shell, Awk, and Lua programming languages. All the system
source code is included in /src
and you
only need to invoke make
to build the entire operating system including ports
out of the box. It's supported to upgrade to newer versions by upgrading from
source, if you prefer.
With the ssh
, git
, wget
, tar
ports along with the emacs
, nano
, vim
editors and the many development tools and libraries, you'll have your own
programs running in no time. See the
portability(7)
guide for caveats where Sortix might differ, and the
porting(7)
guide on how to package ports. You can share your ports using the
port(5)
format for inclusion in the official ports collection or in the community ports
collection.
If you're looking to learn more about operating systems development, please feel
free to join our welcoming community and
have a look at our list of
known issues suitable for new contributors.
Sortix focuses on being a real operating system and doesn't compromise on
quality for educational purposes, but that doesn't mean we can't have
straightforward and well-documented implementations of the best designs. The
source code is well laid out, e.g. libc's <sys/stat.h>
chmod(2)
system call
is defined in libc/sys/stat/chmod.c
. There're a lot of manual pages
documenting the Sortix specifics, and most undocumented aspects are what one
would expect from a standard POSIX environment.
Try it out and have some fun. :)
Sortix benefits the ecosystem
Sortix contributes to the public operating system ecosystem:
- Contributing back to our countless upstream projects to:
- Improve portability to new and unknown operating systems to lower the barrier to entry and encourage competition.
- Support cross-compilation out of the box to enable cleanly bootstraping systems from a trusted source system. All Sortix ports cross-compile cleanly after being patched.
- Encourage adopting standardized interface when superior to non-standard interfaces.
- Fix bugs and contribute our own improvements.
- Our os-test project provides extensive open portability data
across every single Unix-like operating system:
- Testing POSIX compliance across suites.
- Testing system call behavior on interesting unspecified cases.
- Finding bugs in every known OS and helping them improve.
- Supporting standardization efforts with definitive data for edge cases for rare operating systems.
- Being an example for the hobbyist operating system community:
- Showing how to implement difficult features.
- Showing how to port common pieces of third-party software.
- Exploring new designs that might be adopted elsewhere if successful.
Differences
Sortix experiments with new designs:
- No
/usr
directory./usr
is a symlink to.
for compatibility. /etc
is 100% owned by the system administrator. All system default configuration is in/etc/default
.- Running filesystems in user-space.
- The kernel initializes thread-local storage before
_start
and errno is declared as__thread int errno;
and works immediately. - 64-bit
time_t
,off_t
,ino_t
,gid_t
,uid_t
; pointer-sizeddev_t
,pid_t
,timer_t
. - Refusing to implement obsolete interfaces like
gethostbyname(3)
and only implementing modern replaces likegetaddrinfo(3)
, which creates mild problems with ports. - A new init system inspired by the best qualities of systemd that's minimal yet reliable and powerful.
- Selecting the best parts of Linux, BSD, or coming up with alternatives.
Our philosophy is to pick our battles carefully. We've stopped experiments in the past that weren't worth the cost, but we also consider Sortix a unique opportunity to explore designs that would be very costly to try on existing systems.
Details
Sortix is developed by Jonas 'Sortie' Termansen and contributors.
Sortix is written in C with a C++ kernel. It has a monolithic kernel and uses the System V ABI. It has its own system call ABI. ext2 is implemented as a user-space filesystem. This release contains NetBSD's libm but may be replaced by musl's libm in a future release. The kernel is fully multi-threaded with 1:1 preemptive scheduling, where only interrupt handlers run with interrupts disabled.
The operating system implements primarily modern POSIX interfaces, while refusing to implement obsolete or troublesome interfaces unless the compatibility constraints are overwhelming. Poor third-party code tends to not compile, which draws attention to it and is an opportunity to fix it. Standards are embraced and not deviated from without good reason. The lack of compatibility constraints compared to other operating systems makes a cleaner implementation possible.
Sortix should be secure against remote attacks. Sortix is not secure against attacks from local users; the system is halfway through becoming secure for multi-user purposes. Production systems should isolate users that don't trust each other on different virtual machines.
The master branch towards Sortix 1.1 currently has 262k lines of source code, the Sortix 1.0 release has 169k lines of source code (released 28 Mar 2016), version 0.9 had 144k lines of source code (released 30 Dec 2014), version 0.8 had 117k lines of source code (released 19 Dec 2013), version 0.7 had 43k lines of source code (released 10 Sep 2012), version 0.6 had 30k lines of source code (released 18 Mar 2012), version 0.5 had 23k lines of source code (released 06 Dec 2011), version 0.4 had 16k lines of source code (released 08 Sep 2011), and version 0.3 had 8k lines of source code (released 28 May 2011). Development of Sortix began around 8 Feb 2011. These counts don't include the ports collection, but as of Sortix 0.8, it does count the netbsd libm which is 28k lines.
Contact
The #sortix IRC channel on irc.sortix.org is a community where you can get support and where development is coordinated. Please feel free to drop by to show your support.
Bugs can be filed at the issue tracker. Please feel free to submit pull requests here as well as reproducible bugs. If uncertain, ask on IRC or send a quick email.
Jonas 'Sortie' Termansen can be contacted at sortie@maxsi.org. See also his personal website.