Conty/README.md

217 lines
13 KiB
Markdown
Raw Normal View History

2021-03-26 18:03:50 +01:00
## Conty
2021-08-06 22:58:01 +02:00
This is an easy to use compressed unprivileged Linux container packed into a single executable that works on most Linux distros. It's designed to be as simple and user-friendly as possible. You can use it to run any applications, including games (Vulkan and OpenGL).
2021-03-26 18:03:50 +01:00
2023-04-02 18:52:31 +02:00
In its default configuration it includes, among others, these apps: `Wine-GE, Steam, Lutris, PlayOnLinux, GameHub, Minigalaxy, Legendary, Bottles, MultiMC, MangoHud, Gamescope, RetroArch, PPSSPP, PCSX2, DuckStation, OBS Studio, OpenJDK, Firefox`. If these applications are not enough, you can install additional applications or run external binaries from, for example, your home directory.
2021-09-27 14:18:35 +02:00
2021-09-07 13:23:08 +02:00
Besides, Conty supports true filesystem and X11 sandboxing, so you can even use it to isolate applications.
2021-03-26 18:03:50 +01:00
2021-05-20 10:22:02 +02:00
## Features
2021-03-26 18:03:50 +01:00
2021-09-27 14:18:35 +02:00
* A single executable - download (or create) and run, nothing else is required. And it's portable, you can put it anywhere (even on a usb stick).
* Works on most Linux distros, even very old ones and even without glibc (such as Alpine or Void with musl).
2021-03-26 18:30:03 +01:00
* Root rights are **not required**.
* Compressed (with squashfs or dwarfs), so it takes a lot less disk space than uncompressed containers and may provide faster filesystem access in some cases.
2021-08-06 22:56:11 +02:00
* Contains many libraries and packages so it can run almost everything. And you don't need to install anything on your main (host) system. **You can even run 32-bit applications on pure 64-bit systems**.
* Based on Arch Linux, contains latest software (including latest videodrivers).
* Almost completely seamless experience. All applications that you run with Conty read and store their configs in your HOME directory as if you weren't using the container at all.
* No performance overhead. Since it's just a container, there is virtually no performance overhead, thus all applications will run at full speed. Regarding memory usage, Conty uses a bit more memory due to compression and because applications from the container can't share libraries with your system apps.
2021-06-17 14:20:35 +02:00
* Supports Xorg, Wayland and XWayland.
2021-09-07 13:23:08 +02:00
* Supports filesystem and X11 sandboxing (thanks to bubblewrap and xephyr).
2021-03-26 18:03:50 +01:00
## Requirements
2021-08-06 22:56:11 +02:00
The only requirements are **bash**, **fuse2** (or **fuse3**), **tar**, **gzip** and **coreutils**. And your /tmp directory
2021-05-02 14:38:31 +02:00
should allow files execution (which it does by default on most distros).
2021-03-26 18:03:50 +01:00
Your Linux kernel must be at least version 4.4 and should support unprivileged user namespaces. On some
2021-03-26 18:03:50 +01:00
Linux distros this feature is disabled by default and can be enabled with sysfs:
```
2023-01-05 09:52:50 +01:00
# sysctl kernel.unprivileged_userns_clone=1
2021-03-26 18:03:50 +01:00
```
2022-07-17 15:44:10 +02:00
Even if unprivileged user namespaces are not supported by your kernel, you can still use Conty if you have bubblewrap with the SUID bit installed on your system, in this case just tell Conty to use system-wide utils instead of the builtin ones.
2021-04-01 16:17:49 +02:00
```
2023-01-05 09:52:50 +01:00
$ export USE_SYS_UTILS=1
$ ./conty.sh command command_arguments
2021-04-01 16:17:49 +02:00
```
2021-03-26 18:03:50 +01:00
## Usage
2021-08-06 22:56:11 +02:00
Either download a ready-to-use release from the [**releases**](https://github.com/Kron4ek/Conty/releases) page or create your
2021-03-26 18:03:50 +01:00
own (the instructions are below). Make it executable before run.
```
2023-01-05 09:52:50 +01:00
$ chmod +x conty.sh
$ ./conty.sh command command_arguments
2021-03-26 18:03:50 +01:00
```
2022-07-17 15:44:10 +02:00
Conty contains Steam, Lutris, PlayOnLinux, Bottles, Wine-GE and many more.
2021-03-26 18:03:50 +01:00
```
2023-01-05 09:52:50 +01:00
$ ./conty.sh steam
$ ./conty.sh lutris
$ ./conty.sh playonlinux4
$ ./conty.sh bottles
$ ./conty.sh wine someapplication.exe
2021-03-26 18:03:50 +01:00
```
2021-03-27 11:52:26 +01:00
It has a builtin file manager (pcmanfm):
```
2023-01-05 09:52:50 +01:00
$ ./conty.sh pcmanfm
2021-03-27 11:52:26 +01:00
```
2022-07-17 15:44:10 +02:00
To check if hardware acceleration (OpenGL and Vulkan) works, you can use these tools:
2021-03-26 18:03:50 +01:00
```
2023-01-05 09:52:50 +01:00
$ ./conty.sh glxinfo -B
$ ./conty.sh glxgears
$ ./conty.sh vulkaninfo
$ ./conty.sh vkcube
2021-03-26 18:03:50 +01:00
```
2021-03-27 11:52:26 +01:00
You can even use Conty for compilation:
```
2023-01-05 09:52:50 +01:00
$ ./conty.sh gcc src.c
$ ./conty.sh git clone https://something.git
$ cd something && ./conty.sh ./configure
$ ./conty.sh make
2021-03-27 11:52:26 +01:00
```
There are many more integrated programs. You can list all of them with:
2021-03-26 18:03:50 +01:00
```
2023-01-05 09:52:50 +01:00
$ ./conty.sh ls /usr/bin
2021-03-26 18:03:50 +01:00
```
2021-08-07 01:08:24 +02:00
It is also possible to run binaries from your storage. For example, if you want to run an application that resides on your HOME, run something like:
2021-08-06 22:56:11 +02:00
```
2023-01-05 09:52:50 +01:00
$ ./conty.sh /home/username/SomeApplication/binaryfile
2021-08-06 22:56:11 +02:00
```
2021-03-27 11:53:39 +01:00
2021-03-28 16:45:18 +02:00
There are some other features, see the internal help for more information.
```
2023-01-05 09:52:50 +01:00
$ ./conty.sh --help
2021-03-28 16:45:18 +02:00
```
## About Wine
Conty releases from the releases page include `Wine-GE`, and if you build your own Conty you will get `Wine-Staging` by default (but you can change that).
2023-01-05 09:52:50 +01:00
As for prefix management, it's the same as with any other Wine build, the container does not affect it. The default prefix is `~/.wine`, but you can specify a custom prefix path with the `WINEPREFIX` environment variable.
`DXVK` and `vkd3d-proton` are not installed by default (unless they are already in your prefix), but can be easily installed, for example, via `winetricks` if you need them:
```
2023-01-05 09:52:50 +01:00
$ ./conty.sh winetricks dxvk vkd3d
```
As already mentioned in the [Usage](https://github.com/Kron4ek/Conty#usage) section, Windows applications can be launched like this:
```
2023-01-05 09:52:50 +01:00
$ ./conty.sh wine someapplication.exe
```
If you have new enough Linux kernel (5.16 or newer), it's a good idea to enable `FSYNC` to improve Wine performance:
```
2023-01-05 09:52:50 +01:00
$ WINEFSYNC=1 ./conty.sh wine someapplication.exe
```
2021-03-26 18:03:50 +01:00
## Sandbox
2021-09-07 13:43:21 +02:00
Conty uses bubblewrap and thus supports filesystem sandboxing, X11 isolation is also supported (via Xephyr). By default
sandbox is disabled and almost all directories and files on your system are available (visible and accessible) for the container.
2021-03-26 18:03:50 +01:00
2021-06-04 19:05:27 +02:00
Here are the environment variables that you can use to control the sandbox:
* **SANDBOX** - enables the sandbox feature itself. Isolates all user files and directories, creates a fake temporary home directory (in RAM), which is destroyed after closing the container.
2021-09-07 13:23:08 +02:00
* **SANDBOX_LEVEL** - controls the strictness of the sandbox. There are 3 available levels, the default is 1. Level 1 isolates all user files; Level 2 isolates all user files, disables dbus and hides all running processes; Level 3 does the same as the level 2, but additionally disables network access and isolates X11 server with Xephyr.
2021-06-04 19:05:27 +02:00
* **DISABLE_NET** - completely disables internet access.
* **HOME_DIR** - sets a custom home directory. If you set this, HOME inside the container will still appear as /home/username, but actually a custom directory will be used for it.
And launch arguments:
* `--bind SRC DEST` - binds (mounts) a file or directory to a destination, so it becomes visible inside the container. SRC is what you want to mount, DEST is where you want it to be mounted. This argument can be specified multiple times to mount multiple files/dirs.
* `--ro-bind SRC DEST` - same as above but mounts files/dirs as read-only.
Other bubblewrap arguments are supported too, read the bubblewrap help or manual for more information.
Note that when **SANDBOX** is enabled, none of user files are accessible or visible, for any application that you run in this mode your home directory will be seen as completely empty. If you want to allow access to some files or directories, use the aforementioned `--bind` or `--ro-bind` arguments.
2021-03-26 18:03:50 +01:00
Also note that `--bind`, `--ro-bind`, **HOME_DIR** and **DISABLE_NET** can be used even if **SANDBOX** is disabled.
Example:
2021-03-26 18:03:50 +01:00
```
2023-01-05 09:52:50 +01:00
$ export SANDBOX=1
$ export SANDBOX_LEVEL=2
$ ./conty.sh --bind ~/.steam ~/.steam --bind ~/.local/share/Steam ~/.local/share/Steam steam
2021-03-26 18:03:50 +01:00
```
2021-06-04 19:05:27 +02:00
Another example:
2021-03-28 16:45:18 +02:00
```
2023-01-05 09:52:50 +01:00
$ mkdir "/home/username/custom_home_dir"
$ export DISABLE_NET=1
$ export SANDBOX=1
$ export HOME_DIR="/home/username/custom_home_dir"
$ ./conty.sh lutris
2021-03-28 16:45:18 +02:00
```
2021-03-26 18:03:50 +01:00
2021-05-02 14:42:51 +02:00
If you just want a sandboxing functionality but don't need a container with a full-size Linux distro inside (which is what Conty mainly is), i recommend to take a look directly at these projects: [bubblewrap](https://github.com/containers/bubblewrap) and [firejail](https://github.com/netblue30/firejail). Sandboxing is a good additional feature of Conty, but is not its main purpose.
2021-03-31 11:00:09 +02:00
2021-03-29 10:31:33 +02:00
## Known issues
2023-04-02 15:55:49 +02:00
* Nvidia users with the proprietary driver will experience graphics acceleration problems (probably graphical applications won't work at all) if their Nvidia kernel module version mismatches the version of the Nvidia libraries inside Conty. This applies only to the proprietary driver, Nouveau should work fine without any additional actions (of course, if your GPU is supported by it). AMD and Intel GPUs are not affected by this issue.
2021-03-29 10:31:33 +02:00
2023-04-02 15:55:49 +02:00
For example, if the version of your Nvidia kernel module is 460.56 and the libraries inside the container are from 460.67 version, then graphics acceleration will not work.
2021-03-29 10:31:33 +02:00
2023-04-02 15:55:49 +02:00
There are two solutions to this problem:
* The first and probably the easiest solution is to install the same driver version as included inside Conty, which is usually the latest non-beta version. You can see the exact driver version in pkg_list.txt attached to each Conty release. Of course if your GPU is not supported by new drivers, this is not an option for you.
* The second solution is to (re)build Conty and include the same driver version as installed on your system. Read the "**How to create your own Conty executables**" section below, you will need to edit the **create-arch-bootstrap.sh** script or use the **enter-chroot.sh** script to include a different driver version. For instance, if you want to include legacy 470xx or 390xx drivers, edit the **create-arch-bootstrap.sh** script and replace `nvidia-utils` and `lib32-nvidia-utils` with `nvidia-470xx-utils` and `lib32-nvidia-470xx-utils` (replace 470xx with 390xx if you need 390xx drivers) in the `video_pkgs` variable, and then build Conty following the instructions.
2023-04-02 16:07:15 +02:00
* Some Windows applications running under Wine complain about lack of free disk space. This is because under Conty root partition is seen as full and read-only, so some applications think that there is no free space, even though you might have plenty of space in your HOME. The solution is simple, just run `winecfg`, move to "Drives" tab and add your `/home` as an additional drive (for example, `D:`), and then install applications to that drive. More info [here](https://github.com/Kron4ek/Conty/issues/67#issuecomment-1460257910).
* AppImages do not work under Conty. This is because bubblewrap, which is used in Conty, does not allow SUID bit (for security reasons), which is needed to mount AppImages. The solution is to extract an AppImage application before running it with Conty. Some AppImages support `--appimage-extract-and-run` argument, which you can also use.
2023-04-02 15:55:49 +02:00
* Application may show errors (warnings) about locale, like "Unsupported locale setting" or "Locale not supported by C library". This happens because Conty has a limited set of generated locales inside it, and if your host system uses locale that is not available in Conty, applications may show such warnings. This is usually not a critical problem, most applications will continue to work without issues despite showing the errors. But if you want, you can [create](https://github.com/Kron4ek/Conty#how-to-create-your-own-conty-executables) a Conty executable and include any locales you need.
2021-09-18 22:21:23 +02:00
2021-06-08 20:20:23 +02:00
## How to update
2021-08-06 22:56:11 +02:00
There are three main ways to update Conty and get the latest packages, use whichever works best for you.
2021-06-08 20:20:23 +02:00
* First of all, you can simply download latest release from the [releases page](https://github.com/Kron4ek/Conty/releases), i usually upload a new release about every three weeks.
2021-08-06 22:56:11 +02:00
* You can use the self-update feature (`./conty.sh -u`) integrated into Conty, it will update all integrated packages and will rebuild the squashfs/dwarfs image. Read the internal help for more information about it.
2021-06-08 20:20:23 +02:00
* You can manually create a Conty executable with latest packages inside, read the "**How to create your own Conty executables**" section below.
2021-03-26 18:14:38 +01:00
## How to create your own Conty executables
2021-03-26 18:03:50 +01:00
2022-02-12 09:53:23 +01:00
If you want to create an Arch-based container, use the **create-arch-bootstrap.sh** script, it will download latest Arch Linux bootstrap and will install latest packages into it. If you want to use any other distro, then you need to manually obtain it from somewhere. Root rights are required for this step, because chroot is used here.
2021-03-26 18:03:50 +01:00
```
2023-01-05 09:52:50 +01:00
# ./create-arch-bootstrap.sh
2021-03-26 18:03:50 +01:00
```
2021-03-26 21:24:50 +01:00
You can edit the script if you want to include different set of packages inside
2021-03-26 18:03:50 +01:00
the container.
2022-02-12 09:53:23 +01:00
When distro is obtained, you can use the **enter-chroot.sh** script to chroot
into the bootstrap and do some manual modifications (for instance, modify some
files, install/remove packages, etc.). This step is optional and you can
skip it if you don't need it.
After that use the **create-conty.sh** script to create a squashfs (or dwarfs) image and pack everything needed into a single executable.
2021-03-26 18:03:50 +01:00
```
2023-01-05 09:52:50 +01:00
$ ./create-conty.sh
2021-03-26 18:03:50 +01:00
```
2021-08-06 22:56:11 +02:00
By default it uses the lz4 algorithm for the squashfs compression, but you can edit it and choose zstd to get better compression ratio (keep in mind though that your squashfs-tools should support zstd for that to work).
2021-03-26 18:03:50 +01:00
Done!
2021-06-08 19:21:41 +02:00
2021-08-06 22:56:11 +02:00
For the sake of convenience, there are compiled binaries (**utils.tar.gz**) of bwrap, squashfuse and dwarfs and their dependencies uploaded in this repo, **create-conty.sh** uses them by default. However, you can easily compile your own binaries by using the **create-utils.sh**, it will compile bwrap, squashfuse and dwarfs and will create utils.tar.gz. If you are going to use your own utils.tar.gz, make sure to set the correct size for it in the **conty-start.sh**.
## Main used projects
* [bubblewrap](https://github.com/containers/bubblewrap)
* [squashfuse](https://github.com/vasi/squashfuse)
* [dwarfs](https://github.com/mhx/dwarfs)
2021-09-07 13:23:08 +02:00
* [archlinux](https://archlinux.org/)
* [chaotic-aur](https://aur.chaotic.cx/)