Tiny Core Linux
General TC => General TC Talk => Topic started by: GNUser on April 12, 2021, 02:39:22 PM
-
... i'm mostly using tinycore, and i use alpine inside a chroot when i'm lazy to compile missing stuff myself, debian packages are often too outdated for my usage. ...
Hi, hiro. Alpine inside TCL as a chroot sounded interesting, so I decided to try it. These directions work like a charm for CLI applications:
https://wiki.alpinelinux.org/wiki/Alpine_Linux_in_a_chroot
For GUI applications it seems much more tricky (X, fontconfig, and dbus seem to create complications). Have you been able to run GUI applications from inside the chroot? If so, can you please share how you made it work?
P.S. Rich, I just realized that my question is unrelated to the thread subject. Please feel free to move my post to a new thread if you think it would be better.
-
Hi GNUser
I split your post off into its own topic. I also added the quote from hiro to provide context to your post.
-
I've run X apps in a chroot by bind-mounting /tmp into it. As long as the UID inside matches the one outside, the apps can access the unix socket there.
Without that, you would have to run them over the network (loopback, but still). Enable TCP listening on your X server, and tell the chroot apps to go over the network with a proper DISPLAY variable. This is insecure unless you firewall off external TCP connections, and slower.
-
Thanks for the tip, curaga. I've made progress, but am running into font issues. Here are commands run in TCL host:
TCL$ chroot_dir=/opt/alpine
TCL$ sudo mount -o bind /dev ${chroot_dir}/dev
TCL$ sudo mount -t proc none ${chroot_dir}/proc
TCL$ sudo mount -o bind /sys ${chroot_dir}/sys
TCL$ sudo mount -o bind /tmp ${chroot_dir}/tmp
TCL$ xhost +local:
TCL$ sudo chroot ${chroot_dir} login bruno
Now in chroot, using gvim as a representative GUI application:
Alpine:~$ export DISPLAY=:0
Alpine:~$ gvim
E665: Cannot start GUI, no valid font found
Press ENTER or type command to continue18;0M
Any ideas how to solve the font problem? I've already tried bind-mounting /usr/local/etc/fonts to chroot's /etc/fonts, to no avail.
P.S. UID inside and outside are the same:
TCL$ id
uid=1000(bruno) gid=50(staff) groups=50(staff)
Alpine$ id
uid=1000(bruno) gid=1000(bruno) groups=1000(bruno)
-
xterm also fails in the chroot:
Alpine$ xterm
xterm: Error 32, errno 2: No such file or directory
Reason: get_pty: not enough ptys
But xeyes works fine. So it seems barebones GUI apps work, but more complicated GUI apps (e.g., gvim, xterm) need access to things (e.g., fonts, ptys) that are not readily available in a chroot environment.
I prefer to contribute missing packages to TCL rather than run them in a chroot, so this is not a big deal. I just thought it would be an interesting experiment.
-
It turns out that the /dev bind mount doesn't include /dev/pts, which seems to be a separate filesystem.
I ran this in the TCL host system and now xterm works in the chroot :)
sudo mount -t devpts devpts ${chroot_dir}/dev/pts
It would still be nice to figure out how to satisfy gvim in the chroot.
-
IIRC I didn't have to do anything with fonts, but my chroot had its own fonts and font libs installed.
-
I figured it out.
This allows X to work generally (it makes host's /tmp/.X11-unix available to the chroot) (thanks curaga!):
TCL_host$ sudo mount -o bind /tmp ${chroot_dir}/tmp
This is required for xterm to work in the chroot:
TCL_host$ sudo mount -t devpts devpts ${chroot_dir}/dev/pts
Installing a suitable font in the chroot is required for some apps (e.g., gvim) to work:
Alpine_client$ sudo apk add ttf-hack
Other GUI applications may have their own quirks.
Thread may be marked as solved :)
In case it helps anyone, I attached my initial setup notes and the script that I use to subsequently start the alpine chroot.
-
IIRC I didn't have to do anything with fonts, but my chroot had its own fonts and font libs installed.
Thanks, curaga. I should have tried such easy things first ::) Maybe next time.
-
Hi GNUser
... Thread may be marked as solved :) ...
Done. ;D