WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Poll

(see Reply #24) For you, guix.tcz is :

A TCZ building helper ?
0 (0%)
A "GCZ" building helper ? (keeping isolated guix files hierarchy)
1 (33.3%)
A curious crazy toy
0 (0%)
obi wan kenobi (a geek's joke!)
1 (33.3%)
Or simply guix.tcz
1 (33.3%)

Total Members Voted: 3

Author Topic: Request guix for TC9 x86  (Read 9099 times)

Offline mocore

  • Hero Member
  • *****
  • Posts: 633
  • ~.~
Re: Request guix for TC9 x86
« Reply #15 on: January 15, 2019, 02:01:57 PM »


Quote
..the program names differ in TC afair , and installing some dependent programs

I'm not 100% sure, but theorically guix does not care about.

this was to run the : https://git.savannah.gnu.org/cgit/guix.git/plain/etc/guix-install.sh on just core.gz + whatever needed depeds for the script !

eg (afaik) groupadd and useradd , in the tc domain have difrent name / and perhaps args .. so those parts of guix-install.sh needed some modification to get the install to finish!

i think i got the install working , before the holidays
---

after the install is done , some method is needed to restore  the created  folders in the case of guix : /gnu/store and /var/guix


i have modified parts of the nix install ,
 and used this on other 'live' non-persistent systems with some success ,
creating a bind mount from /some/other/place to /nix ,
then ruining the mock_install to add some links / files back into user home 



« Last Edit: January 15, 2019, 02:23:28 PM by mocore »

Offline mocore

  • Hero Member
  • *****
  • Posts: 633
  • ~.~
Re: Request guix for TC9 x86
« Reply #16 on: January 15, 2019, 02:40:37 PM »

After dCore, Guix Core ?  :P

In a moment of madness i started thinking about (nomad) BSDcore  ;)

Offline flavien

  • Newbie
  • *
  • Posts: 25
Re: Request guix for TC9 x86
« Reply #17 on: January 15, 2019, 04:16:00 PM »

After dCore, Guix Core ?  :P

In a moment of madness i started thinking about (nomad) BSDcore  ;)

Lol! Why not... Or this :
GNU
HURD Core
Rock'n ROLling Release
 8) 8) 8)

I got it run, but i'm face to a big problem. I can't install the first package.
First, instructions to make it "running"

I - MAKE GUIX "RUNNIG"

In a real file system (like /dev/sda mounted on /mnt/sda), extract the GUIX binary tar.
You got /mnt/sda1/gnu and /mnt/sda1/var/guix.

Code: [Select]
sudo mount /mnt/sda1/gnu /gnu
sudo mount /mnt/sda1/var/guix /var/guix

Then, with attached guix.tcz (just a few folders with some symlinks and a tce.installed script) , run :

Code: [Select]
tce-load -i guix.tcz
For information, my install script contains :

Code: [Select]
GUIX_PROFILE="`echo ~root`/.config/guix/current" ;
source $GUIX_PROFILE/etc/profile

addgroup guixbuild
chgrp guixbuild -R /gnu/store
chmod 1775 /gnu/store
builders=10 ;\
  for i in `seq 1 $builders` ; do \
    adduser -S guixbuild$i guixbuild ;\
    adduser guixbuild$i guixbuild ;\
  done

~root/.config/guix/current/bin/guix-daemon --build-users-group=guixbuild &

guix archive --authorize < ~root/.config/guix/current/share/guix/ci.guix.info.pub

cd /usr/local/share/info
for i in /var/guix/profiles/per-user/root/current-guix/share/info/* ;
do ln -s $i ; done


This is okay.........BUT :


II - THE PROBLEM :

When i try "guix package -i hello", i got this error :
Code: [Select]
guix package: error: build failed: while setting up the build environment: cannot pivot old root directory
Guix use pivot_root, while TC mount rootfs on ram by the "/init" script.
pivot_root needs rootfs to be mounted on a real file system.
BUT, by "chance", TC does not use initramfs, but inird (core.gz), witch IS a real FS.
Next, the /init script mount the RAM content as "/".
Theorically, if the init script
1 ) mount "/" on a real FS
2 ) mount RAM content in a real FS subfolder "/ram0" (for exemple)
3 ) Then first pivot_root to "/ram0"
This could work without breaking the bootstrap rcS. I hope  :'(
And make pivot_root available on TC...
If it's possible, it should be integrated optionnally as a custom boot code like this :
realrootfs="/dev/sda1".
If core developpers doesn't want to integrate this, that means Guix Core is finished, or need to fork TC  :-\ :'( :'( :'(

But before requests them for adding this great feature ("pivot_root compatibility"), we need to try by ourself, because we must overcome possible future problems.
(After all, maybe it will never work. Maybe.... Noooooo! It will!)

    [EDIT] Removed attached extension due to forum policy violation.  Rich
« Last Edit: March 03, 2019, 08:05:16 AM by Rich »

Offline flavien

  • Newbie
  • *
  • Posts: 25
Re: Request guix for TC9 x86
« Reply #18 on: January 15, 2019, 04:19:50 PM »

Offline flavien

  • Newbie
  • *
  • Posts: 25
Re: Request guix for TC9 x86
« Reply #19 on: January 16, 2019, 10:39:15 AM »
Forget my previous post.

Related post : http://forum.tinycorelinux.net/index.php?topic=21089.0
Same problem for docker. (but docker provide an environment variable to resolve it)

andyj said :
Quote
Part of your problem may be related to what I alluded to in another thread. In a fat distro like Ubuntu, the initial ram disk is compiled into the kernel, then another file system on the hard drive is "pivoted" to so as to become the new root file system. In TCL, the ram disk is loaded as an initrd (initial ram disk), then continues to be the root file system after the boot process is complete. No other file system is pivoted to. If you want to use TCL as your docker OS then you will need to build another file system image to load after the stock core.gz (or modify the supplied core.gz) instead of trying to pivot to another FS. As you say, it works when you don't pivot, which makes sense. Pivoting is for the classic install where all the OS files are on a hard drive.


Is there a pivot_root & ramdisk compatibility trick?

Explanation : https://unix.stackexchange.com/questions/126217/when-would-you-use-pivot-root-over-switch-root
It's not exactly the same situation because TCL doesn't use initramfs, but initrd.
https://stackoverflow.com/questions/10603104/the-difference-between-initrd-and-initramfs
Theorically, there is no problem to use pivot_root because initrd is ramdisk and ramdisk is a file system while initramfs is not. But "/" is mounted as tmpfs, witch is not like ramdisk, a "real" mounted FS, and i think that's the problem.
If there is a way to mount exactly the same, but copying it in the ramdisk initial "real" file system, then we were probably able to use pivot_root instead of switch_root.
We can just draw inspiration from https://www.slax.org/blog/18438-initramfs-pivot-root-solution.html

Here, see the /init file content from core.gz ramdisk (https://github.com/tinycorelinux/Core-scripts/blob/master/init)

Code: [Select]
#!/bin/sh
mount proc
grep -qw multivt /proc/cmdline && sed -i s/^#tty/tty/ /etc/inittab
if ! grep -qw noembed /proc/cmdline; then

  inodes=`grep MemFree /proc/meminfo | awk '{print $2/3}' | cut -d. -f1`

  mount / -o remount,size=90%,nr_inodes=$inodes
  umount proc
  exec /sbin/init
fi
umount proc
if mount -t tmpfs -o size=90% tmpfs /mnt; then
  if tar -C / --exclude=mnt -cf - . | tar -C /mnt/ -xf - ; then
    mkdir /mnt/mnt
    exec /sbin/switch_root mnt /sbin/init
  fi
fi
exec /sbin/init

Not sure about how to do the trick without break the bootstrap, and I don't know if there is a performance or a ram space cost.
In the upper slax post link, we can read :

Quote
we make a directory /m (or something) and copy the current initramfs filesystem to it. This doubles RAM usage for a while, but don't worry, since the next step we do is to switch root to /m. This does two things. First, it frees all the memory used by initramfs, and second it simply restarts the init process from a mounted filesystem. And as soon as root is mounted, the real startup procedures of LiveKit can be started (mounting union, and so on), and finally pivot_root is now magically available again. Voila!

I don't understand this /init line :
Code: [Select]
if tar -C / --exclude=mnt -cf - . | tar -C /mnt/ -xf - ; thenIt's probably about core.gz extraction, but we desn't see any file name...  :o



Someone?
« Last Edit: January 16, 2019, 10:54:31 AM by flavien »

Offline flavien

  • Newbie
  • *
  • Posts: 25
Re: Request guix for TC9 x86
« Reply #20 on: January 16, 2019, 11:08:06 AM »
I'm wrong.

https://www.jamescoyle.net/knowledge/951-the-difference-between-a-tmpfs-and-ramfs-ram-disk

I don't understand why pivot_root doesn't work. Sorry.

Offline mocore

  • Hero Member
  • *****
  • Posts: 633
  • ~.~
Re: Request guix for TC9 x86
« Reply #21 on: January 16, 2019, 01:07:10 PM »

i made a topic hear http://forum.tinycorelinux.net/index.php/topic,22449.0.html
 wrt the tc int root question!

wrt to guix

the mail list has some hints to get to the "root" ;) of the problem with gix
https://lists.gnu.org/archive/html/help-guix/2018-03/msg00104.html

Quote
It would be nice to know the error code returned by the pivot_root syscall.
It might point to the reason of the failure.
Most probably you can get that using strace.
Stracing the daemon is possible using strace -fp pid_of_daemon.



Offline flavien

  • Newbie
  • *
  • Posts: 25
Re: Request guix for TC9 x86
« Reply #22 on: January 16, 2019, 01:17:21 PM »
Thank you mocore :)

I've already tried get output error by strace after installing "util-linux.tcz", but today i don't know yet how it works.  ;)


Offline flavien

  • Newbie
  • *
  • Posts: 25
Re: Request guix for TC9 x86
« Reply #23 on: January 16, 2019, 02:27:07 PM »
It works!!!!!  ;D ;D ;D ;D

Code: [Select]
if ! grep -qw noembed /proc/cmdline; then
means if boot code noembed isn't present then...
But if we have this boot code then :

Code: [Select]
umount proc     <--- already mounted to detect bootcodes
if mount -t tmpfs -o size=90% tmpfs /mnt; then
  if tar -C / --exclude=mnt -cf - . | tar -C /mnt/ -xf - ; then
    mkdir /mnt/mnt
    exec /sbin/switch_root mnt /sbin/init
  fi
fi
exec /sbin/init

We got exactly what https://www.slax.org/blog/18438-initramfs-pivot-root-solution.html is talking about!

And, from Into the Core book, we can read :

Quote
10.32. noembed - use a separate tmpfs

This is an advanced option that changes where in RAM Core is run
from. By default, Core uses the tmpfs setup by the kernel; with this
bootcode, Core will setup a new tmpfs file system, and use that
instead.
Using this bootcode temporarily doubles the RAM use, as both
copies are kept in RAM at once during boot. As an extra copy is
made, it also slows the boot time. It allows GNU df to detect the
free space in /, used by some proprietary software installers.

I deduce that pivot_root just need noembed bootcode!
Then i'have added it, and i test :

Code: [Select]
guix package -i hello
SUCCESS!!!!! (hello is only installed in the GUIX user part^^)

What we need to test :
- Install some graphicals applications with GUIX and see if it works
- Try to generate conflicts with TC, witch is theorically impossible! (but I'm not a GUIX expert)

YEAH!!!  8)
Welcome to tcGUIX distribution^^
« Last Edit: January 16, 2019, 02:32:51 PM by flavien »

Offline flavien

  • Newbie
  • *
  • Posts: 25
Re: Request guix for TC9 x86
« Reply #24 on: January 16, 2019, 04:31:58 PM »
After export PATH environement variable to point to the /home/tc/.guix-profile/bin and sbin folder, and run startx, it works.  ::)

Code: [Select]
guix package -i gedit
gedit

For archlinux users, we got a yaourt-like system, but isolated in user space : it's GUIX.
For gentoo user, we got a emerge-like system, but isolated in user space : it's GUIX.
(a full building system on TCL, without conflict)

mocore said :
Quote
...also in theory it should be possible to create a tcz package using nix/guix
(sounds like an historical sentence!  ;D  lol )

If someone (a GUIX advanced user for exemple) know how to transform some guix building result packages to a classic POSIX files hierarchy, to separate building dependencies and runnig dependencies, then we have a nice TCZ building system.
Else, by keeping /gnu + /var/guix + $HOME/.guix-profile hierarchy way, we have a nice "GCZ" building system. (for exemple, we can store these "GCZ" files in a "$TCEDIR/optionnal/guix" sub directory)

But i don't know how! lol^^
« Last Edit: January 16, 2019, 04:42:49 PM by flavien »

Offline flavien

  • Newbie
  • *
  • Posts: 25
Re: Request guix for TC9 x86
« Reply #25 on: January 16, 2019, 05:12:15 PM »

Another essential thing:

https://www.gnu.org/software/guix/blog/2017/creating-bundles-with-guix-pack/

Quote
Recipients of a binary tarball are expected to either extract it in their root file system (yes!) where it will create /gnu and /opt/gnu in this case:

Code: [Select]
# cd /
# tar xf /path/to/pack.tar.gz
# /opt/gnu/bin/guile --version
guile (GNU Guile) 2.2.0

… or they can chroot into it, possibly relying on user namespaces and thereby avoiding root privileges:

Code: [Select]
$ mkdir /tmp/pack
$ cd /tmp/pack
$ tar xf /path/to/pack.tar.gz
$ unshare -mrf chroot . /opt/gnu/bin/guile --version
guile (GNU Guile) 2.2.0

The good thing with this is that, because Guix captures the complete dependency graph of packages, the tarball contains everything that’s needed to run Guile and is going to work in exactly the same way on any system that runs the kernel Linux!

(without guix)

Offline flavien

  • Newbie
  • *
  • Posts: 25
Re: Request guix for TC9 x86
« Reply #26 on: January 16, 2019, 07:55:49 PM »
https://www.gnu.org/software/guix/manual/en/html_node/Invoking-guix-pack.html

Quote
Yet another option is to produce a SquashFS image with the following command:

Code: [Select]
guix pack -f squashfs guile emacs geiser
The result is a SquashFS file system image that can either be mounted or directly be used as a file system container image with the Singularity container execution environment, using commands like singularity shell or singularity exec.

Offline flavien

  • Newbie
  • *
  • Posts: 25
Re: Request guix for TC9 x86
« Reply #27 on: January 18, 2019, 09:59:38 AM »

Offline mocore

  • Hero Member
  • *****
  • Posts: 633
  • ~.~
Re: Request guix for TC9 x86
« Reply #28 on: March 03, 2019, 05:42:01 AM »
It works!!!!!  ;D ;D ;D ;D
...
YEAH!!!  8)
Welcome to tcGUIX distribution^^

cool!
i missed the attached tcz in http://forum.tinycorelinux.net/index.php/topic,22443.msg140616.html#msg140616
all though it appears to contain broken links   ???
Code: [Select]
$file /tmp/tcloop/guix/usr/local/bin/guix
/tmp/tcloop/guix/usr/local/bin/guix: broken symbolic link to /var/guix/profiles/per-user/root/current-guix/bin/guix

with the exception of

cat /tmp/tcloop/guix/README-GUIX
Quote
To see installation script
# cat /usr/local/tce.installed/guix

If all it's OK, you can use GUIX^^
# guix package -i hello

and

cat /usr/local/tce.installed/guix
Code: [Select]
GUIX_PROFILE="`echo ~root`/.config/guix/current" ;
source $GUIX_PROFILE/etc/profile

addgroup guixbuild
chgrp guixbuild -R /gnu/store
chmod 1775 /gnu/store
builders=10 ;\
  for i in `seq 1 $builders` ; do \
    adduser -S guixbuild$i guixbuild ;\
    adduser guixbuild$i guixbuild ;\
  done

~root/.config/guix/current/bin/guix-daemon --build-users-group=guixbuild &

guix archive --authorize < ~root/.config/guix/current/share/guix/ci.guix.info.pub

cd /usr/local/share/info
for i in /var/guix/profiles/per-user/root/current-guix/share/info/* ;
do ln -s $i ; done


how did you setup guix ?
using modified binary install script ??

i would be happy to test guix
it would be helpful
if could you post more detail of the method ,eg steps or scripts used to get a working setup



« Last Edit: March 03, 2019, 05:50:00 AM by mocore »