Skip to content

Commit

Permalink
docs: add post - use latest gnome and kde with distrobox
Browse files Browse the repository at this point in the history
  • Loading branch information
89luca89 committed Jan 10, 2022
1 parent 897a62d commit 0f7ddc2
Show file tree
Hide file tree
Showing 3 changed files with 153 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ graphical apps (X11/Wayland), and audio.
- [Compatibility](compatibility.md)
- [Usage](usage.md)
- [Useful tips](useful_tips.md)
- [Posts](posts/posts.md)
* [Run latest GNOME and KDE using distrobox](posts/run_latest_gnome_kde_on_distrobox.md)
- [Featured Articles](featured_articles.md)
* [Run Distrobox on Fedora Linux](featured_articles.md#featured-articles)
* [Distrobox - A great item in the Linux toolbelt](featured_articles.md#featured-articles)
Expand Down
8 changes: 8 additions & 0 deletions docs/posts/posts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
- [Distrobox](README.md)
* [Run latest GNOME or KDE using distrobox](run_latest_gnome_kde_on_distrobox.md)

---

## Latest posts

- [Run latest GNOME or KDE using distrobox](run_latest_gnome_kde_on_distrobox.md)
143 changes: 143 additions & 0 deletions docs/posts/run_latest_gnome_kde_on_distrobox.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
- [Distrobox](../README.md)
* [Run latest GNOME and KDE using distrobox](run_latest_gnome_kde_on_distrobox.md)
- [Using a stable-release distribution](#using-a-stable-release-distribution)
* [Initializing the distrobox](#initializing-the-distrobox)
* [Running Latest GNOME](#running-latest-gnome)
+ [Generate session file](#generate-session-file)
* [Running Latest KDE](#running-latest-kde)
+ [Generate session file](#generate-session-file-1)
+ [Add a couple of fixes](#add-a-couple-of-fixes)

---

# Using a stable-release distribution

Lots of people prefer to run a distribution following a stable-LTS release cycle like Debian, UbuntuLTS or
CentOS family (Almalinux, Rocky Linux). This ensures great stability on one hand, but package staling on the other.

One way to counter this effect is to use a pet-container managed by Distrobox to run packages from much newer distributions
without giving up on core base os stability.

## Initializing the distrobox

For this experiment we'll use Fedora Rawhide as our distrobox, and Centos 8 Stream as our host, so:

`distrobox create --name fedora-rawhide --image registry.fedoraproject.org/fedora:rawhide`

and

`distrobox enter fedora-rawhide`

## Running Latest GNOME

First we need to change a couple of bits in the distrobox container to make host's systemd session
accessible from within the host:

```shell
~$ distrobox enter fedora rawhide
user@fedora-rawhide:~$ rm -rf /run/systemd/{seats,sessions,system,users}
user@fedora-rawhide:~$ ln -s /run/host/run/systemd/{seats,sessions,system,users} /run/systemd
```

Then we can proceed to install GNOME in the container:

```shell
user@fedora-rawhide:~$ sudo dnf groupinstall GNOME
```

And let's grab a coffee while it finishes :-)

After the `dnf` process finishes, we have GNOME installed in our container, now how do we
use it?

### Generate session file

We need to add a desktop file for the session on the host's file system, so that it appears
on your login manager (Be it SSDM or GDM)

```shell
[Desktop Entry]
Name=GNOME on Wayland (fedora-rawhide distrobox)
Comment=This session logs you into GNOME
Exec=/usr/local/bin/distrobox-enter -n fedora-rawhide -- /usr/bin/gnome-session
Type=Application
DesktopNames=GNOME
X-GDM-SessionRegisters=true
```

This file should be placed under `/usr/share/wayland-sessions/distrobox-gnome-wayland.desktop`

Let's log out and voilá!

![image](https://user-images.githubusercontent.com/598882/148703229-82905d23-f3d0-41bc-a048-d12cdf8066d0.png)
![Screenshot from 2021-12-25 19-56-52](https://user-images.githubusercontent.com/598882/147391814-cb49e7b8-64bc-4975-a8d1-93f6fb23f28b.png)
![Screenshot from 2021-12-25 20-03-16](https://user-images.githubusercontent.com/598882/147391867-ca29576b-8fb9-448c-a181-579482fb448d.png)

We now are in a GNOME 42 session inside Fedora Rawhide while our main OS remains
Centos.

## Running Latest KDE

We can do the same with KDE also, let's first set up the host's systemd session sharing with the container:

```shell
~$ distrobox enter fedora rawhide
user@fedora-rawhide:~$ rm -rf /run/systemd/{seats,sessions,system,users}
user@fedora-rawhide:~$ ln -s /run/host/run/systemd/{seats,sessions,system,users} /run/systemd
```

Then we can proceed to install KDE in the container:

```shell
user@fedora-rawhide:~$ sudo dnf groupinstall KDE
```

### Generate session file

We need to add a desktop file for the session on the host's file system, so that it appears
on your login manager (Be it SSDM or GDM)

```shell
[Desktop Entry]
Exec=/usr/local/bin/distrobox-enter -- /usr/libexec/plasma-dbus-run-session-if-needed /usr/bin/startplasma-wayland
DesktopNames=KDE
Name=Plasma on Wayland )fedora-rawhide distrobox)
X-KDE-PluginInfo-Version=5.23.3
```

This file should be placed under `/usr/share/wayland-sessions/distrobox-plasma.desktop`

### Add a couple of fixes

To make KDE work we need a couple more fixes to run both on the host and in the container.

First in the host we need a reliable way to fix the permissions problem of the `/tmp/.X11-unix` directory.
This directory should either belong to `root` or `$USER`. But in a rootless container, host's `root` is not
mapped inside the container so we need to change the ownership from `root` to `$USER` each time.

Let's add:

```shell
chown -R $USER:$USER /tmp/.X11-unix
```

to `~/.profile` file.

We also need to add a process in autostart on which Plasma shell relies on a process called `kactivitymanagerd`.
Not having host's systemd at disposal we can start it simply adding it to the ~/.profile file, add:

```shell
if [ -f /usr/libexec/kactivitymanagerd ]; then
/usr/libexec/kactivitymanagerd & disown
fi
```

to `~/.profile` file.

Let's log out and voilá!

![image](https://user-images.githubusercontent.com/598882/148704789-3d799a85-51cc-4de7-9ee3-f54add4949bc.png)
![image](https://user-images.githubusercontent.com/598882/148705044-7271af0c-0675-42f8-9f45-ad20ec53deca.png)

We now are in latest KDE session inside Fedora Rawhide while our main OS remains
Centos.

0 comments on commit 0f7ddc2

Please sign in to comment.