Tiny Core Linux

Tiny Core Extensions => TCE Talk => Topic started by: Lachu on May 05, 2020, 05:34:34 AM

Title: Flatpak
Post by: Lachu on May 05, 2020, 05:34:34 AM
Is there a way to install Flatpak? How to add repository or on which name package is using?
Title: Re: Flatpak
Post by: GNUser on May 05, 2020, 07:46:42 AM
Lachu, I was able to install  flatpak  on TCL in a roundabout way (just to see if I could help you--I'm not a flatpak user). However, I can't get any flatpak applications to work in TCL. Here's an example:
Code: [Select]
bruno@box:~$ flatpak run --verbose org.gnome.Recipes
F: No installations directory in /nix/store/8rj42gd89vzji98vg8406khv2cqp3yz5-flatpak-1.6.3/etc/flatpak/installations.d. Skipping
F: Opening system flatpak installation at path /var/lib/flatpak
F: Opening user flatpak installation at path /home/bruno/.local/share/flatpak
F: Opening user flatpak installation at path /home/bruno/.local/share/flatpak
F: Opening system flatpak installation at path /var/lib/flatpak
F: Opening user flatpak installation at path /home/bruno/.local/share/flatpak
F: Opening system flatpak installation at path /var/lib/flatpak
F: Regenerating ld.so.cache /home/bruno/.var/app/org.gnome.Recipes/.ld.so/59d51f0236f09d8006d0957ea20ec10eab34b125018c670def91a3bc153d903b
F: Running: '/nix/store/7sm1z3jcnkpr37s7g7c1khp1lpw6qyd6-bubblewrap-0.4.1/bin/bwrap --args 14 ldconfig -X -C /run/ld-so-cache-dir/59d51f0236f09d8006d0957ea20ec10eab34b125018c670def91a3bc153d903b'
bwrap: pivot_root: Invalid argument
error: ldconfig failed, exit status 256
Apparently the  pivot_root  issue on TCL has been around for a few years: https://github.com/flatpak/flatpak/issues/1007
Maybe juanito would know if there's a solution for it.

Is/are the application(s) you need available in the TCL repository or as AppImages? For the record, most AppImages I've tried worked perfectly on TCL. For the few that didn't work right away, usually the solution was to run one or more of these commands:
Code: [Select]
$ tce-load -wi bash
$ sudo ln -s /lib /lib64
$ sudo ln -s /usr/local/etc/fonts /etc/fonts
$ sudo ln -s /usr/local/etc/ssl /etc/ssl
Title: Re: Flatpak
Post by: Juanito on May 05, 2020, 08:06:26 AM
Maybe juanito would know if there's a solution for it.

Not that I know of  :)
Title: Re: Flatpak
Post by: hiro on May 05, 2020, 08:25:25 AM
Generally, with all those modern unprivileged container dreams...

On the one side there are the people who want to make sure containers can only be run from a user ("rootless"), so that there is no attackable daemon with root/kernel privileges. those people are scared that bec. everything is so complicated somebody will be able to gain full privileges by attacking that daemon from the VM, so they want to have no such daemon.
On the other side there are those people who now can only run as user, who try to get more and more privileges from the kernel into userland...

companies like google, facebook, redhat, are actually spending ludicrous amount of work on all the many related issues creating more and more fine-grained privilege escalation possibilities for these use cases.

it can only end badly IMO.

don't bother, guys :)
Title: Re: Flatpak
Post by: GNUser on May 05, 2020, 08:47:09 AM
those people are scared that bec. everything is so complicated somebody will be able to gain full privileges

Haha, indeed. If KISS principle were followed, then there'd be nothing to be afraid of.
Truth be told, I really dislike flatpak for the very reason that it's quite complicated.

AppImages are conceptually quite simple: At runtime, the AppImage mounts the squashfs archive inside of it, which contains the application's binaries and any libraries it might need. The portability "magic" is achieved by a wrapper script that exports LD_LIBRARY_PATH and, in some cases, a handful of other environmental variables. It's really as simple as that.
Title: Re: Flatpak
Post by: hiro on May 05, 2020, 01:19:06 PM
yep, and i do like the idea of user namespaces in principle...

there was just no way to make a unix lest a posix or linux do these things either correctly, securely or efficiently.
sometimes the legacy just weighs too much. so they made a new OS instead: the first plan9 release was 27 years ago.

and since then, while they are trying to nail on more and more cruft to get those user namespaces in there at any cost, all those meltdown & spectre things happened, and we realize even the most basic guarantees like virtual memory and thus process and user separation aren't upheld any more.

too late to go full circle. there is no more left to do.

but enjoy the firework.
Title: Re: Flatpak
Post by: Lachu on May 06, 2020, 02:48:53 AM
Is/are the application(s) you need available in the TCL repository or as AppImages?
I created custom application as Flatpak and need to install it on TCE. I will try to create AppImage with this application. I think I could create gaming console platform using TCE, because it is light OS and starting fast. Application I need to install is my gaming shop/platform created for GNU/Linux. As I said, I will try to create AppImage with my app.
Title: Re: Flatpak
Post by: curaga on May 06, 2020, 09:38:41 AM
Why would you need to use a container at all, if it's a custom application?
Title: Re: Flatpak
Post by: GNUser on May 06, 2020, 11:20:23 AM
@Lachu - I haven't used this, but it may be of interest to you: https://github.com/sudo-give-me-coffee/flatpak2appdir
Title: Re: Flatpak
Post by: Lachu on May 07, 2020, 09:06:45 AM
I created AppImage. It worked under OpenSUSE, but not on TinyCore. I must download another appimage (appimagetool) to made last step of creation my own appimage. Problem is ever appimagetool not worked under tinycore.
On both cases I got message: bash: <name of appimage file>: No such file or directory
I installed fuse, but this didn't helps.
As I remember No such file or directory also means executable doesn't support your current architecture, but my AppImage contains 64 bit application and I have 64 bit linux kernel installed.
Title: Re: Flatpak
Post by: GNUser on May 07, 2020, 09:12:20 AM
In my experience, "No such file or directory" errors on TCL (when the file or directory in question clearly exists) is usually due to one of 2 things:
a) the interpreter (in this case bash) can't be found or
b) the linker (ld-linux-x86-64.so.2) can't be found

Please run the commands below then try again. The first command takes care of the interpreter here, the second command helps applications looking for linker in /lib64 to find them in /lib (where it is actually located in TCL).

Code: [Select]
$ tce-load -wi bash
$ sudo ln -s /lib /lib64
$ sudo ln -s /usr/local/etc/fonts /etc/fonts
$ sudo ln -s /usr/local/etc/ssl /etc/ssl
Title: Re: Flatpak
Post by: Lachu on May 07, 2020, 09:26:14 AM
I probably found an issue.
Running normal linux/elf with assets in subdirectories application causes the same problem. I migrated to 64bit version by downloading 64bit kernel, rootfs and modules64 and added these files to initrd command. Maybe there's something I do wrong.
Title: Re: Flatpak
Post by: GNUser on May 07, 2020, 09:37:40 AM
Code: [Select]
sudo ln -s /lib /lib64
Title: Re: Flatpak
Post by: Lachu on May 09, 2020, 06:56:05 AM
I created symbolic link to /lib under /lib64 and symbolic link to /usr/lib under /usr/lib64. So games runs without problems, but to made AppImage working I must install fuse. There's also error with my app (bundled to appimage). Assertion inside g_subprocess_launcher_spawnv complains and program segfaults. On other systems this app works.
Title: Re: Flatpak
Post by: GNUser on May 09, 2020, 01:07:54 PM
Assertion inside g_subprocess_launcher_spawnv complains
This is just a shot in the dark, but does it help if you do this?
Code: [Select]
$ tce-load -wi gobject-introspection
If not, please copy the exact error and paste it here. I'd like to help but need more information.
Title: Re: Flatpak
Post by: Lachu on May 11, 2020, 05:00:05 AM
It won't worked even if I installed suggested package.

Application uses WebKit2Gtk+ .
Message:
(RCGstore:3633): GLib-GIO-CRITICAL **: 11:54:19.364: g_subprocess_launcher_spawnv: assertion 'argv != NULL && argv[0] != NULL && argv[0][0] != '\0'' failed
Segmentation fault

Previously gdb segfaults, when I try to debug exe file, but if application loads into memory, probably I can debug.
Title: Re: Flatpak
Post by: Lachu on May 11, 2020, 05:11:33 AM
(RCGstore:3508): GLib-GIO-CRITICAL **: 12:07:34.326: g_subprocess_launcher_spawnv: assertion 'argv != NULL && argv[0] != NULL && argv[0][0] != '\0'' failed

Thread 1 "RCGstore" received signal SIGSEGV, Segmentation fault.
0x00007ffff46225c1 in ?? ()
(gdb) backtrace
#0  0x00007ffff46225c1 in ?? ()
#1  0x0000000000000000 in ?? ()

I must probably install debug symbols. Is there any way to save list of installed packages and remove installed after backup list creation?
Title: Re: Flatpak
Post by: GNUser on May 11, 2020, 05:25:28 AM
Is there any way to save list of installed packages
This will do it:
Code: [Select]
$ tce-status -i >installed_packages.txtAnother approach is to copy  tce/onboot.lst  and  tce/optional/  somewhere, then go ahead and install whatever you need for debugging. When debugging is done and you want to return to running only pre-debugging set of extensions, just restore the saved  tce/onboot.lst  and  tce/optional/.
Title: Re: Flatpak
Post by: Rich on May 11, 2020, 05:55:24 AM
Hi Lachu
... Is there any way to save list of installed packages ...
This will create a list of all installed packages:
Code: [Select]
ls -1 /etc/sysconfig/tcedir/optional/*.tcz > packages.lstThat's a  one  after the  ls  command.

Save  packages.lst  and a copy of your  onboot.lst  file someplace safe. You might also want to save a copy of your
 /etc/sysconfig/tcedir/mydata.tgz  file in case you have any configuration settings backed up in there.

Quote
... and remove installed after backup list creation?
You want to remove all installed extensions? Boot using the  text base norestore  boot codes. At the prompt, enter:
Code: [Select]
busybox rm -f /etc/sysconfig/tcedir/optional/*
If you want to re-installed all your extensions, boot using the  text base norestore  boot codes. At the prompt, enter:
Code: [Select]
busybox rm -f /etc/sysconfig/tcedir/optional/*
for i in `cat onboot.lst`; do tce-load -iw "$i"; done
Those are  back ticks  surrounding the  cat  command. They should be on your  ~  key.

You can then:
Code: [Select]
ls -1 /etc/sysconfig/tcedir/optional/*.tcz > installed.lst
diff -u packages.lst installed.lst
This will list any discrepancies between your previous and current installations.

Or you can just copy your  tce  directory someplace safe and restore it when you are done.
Title: Re: Flatpak
Post by: Lachu on May 11, 2020, 12:30:43 PM
Thanks. I worked as software developer and known about onboot.lst. I also found optional directory, but don't known the meaning. I don't known that's too simple. I will prepare a list of installed extensions, delete content of optional and reinstall all missing stuff.
Title: Re: Flatpak
Post by: Lachu on May 11, 2020, 12:31:55 PM
One question. Is there name suffix/prefix for debuginfo packages or switch in tce-load to install debug symbol for some application/library?
Title: Re: Flatpak
Post by: Rich on May 11, 2020, 12:41:36 PM
Hi Lachu
Packages are typically stripped. There are no debug packages that I am aware of. If you need any packages with symbols, you
will need to compile them yourself.

If you are planning on tracing with  gdb , then compile with no optimization ( -O0 ). Also, do not use the Link Time Optimizer (-flto)
because it interferes with  gdb  being able to display code listings.
Title: Re: Flatpak
Post by: Lachu on May 12, 2020, 07:05:14 AM
I have a problem. Under other distro I need only install gcc, build-essentials or gcc-c. In tiny core there's no gcc-c package. I install gcc, but it doesn't pull standard C headers.
Title: Re: Flatpak
Post by: Juanito on May 12, 2020, 07:26:28 AM
Install compiletc
Title: Re: Flatpak
Post by: Lachu on May 12, 2020, 11:36:36 AM
Ok. Thanks.
Now it compiles and works, but not working under OpenSUSE Tumbleweed. Error is similar to TC error, when there's no link to linker (no such file or directory). I can keep two version of the same application on the single partition, but prefer to avoid this, for example due to make updates easier. Is there way to found error in TC? Why it doesn't ran my AppImage? How to debug? Is there no other solution than compiling entire system?
Title: Re: Flatpak
Post by: Juanito on May 12, 2020, 10:31:55 PM
Just think how many apps you could have compiled natively on tinycore these last few days  ;)
Title: Re: Flatpak
Post by: curaga on May 13, 2020, 01:38:31 AM
You're probably the only one using AppImages...
Title: Re: Flatpak
Post by: Lachu on May 13, 2020, 07:33:59 AM
Ok. I use two application version (one for OS Tumbleweed and second for TC), but apps installed by my application should fit to both systems. Best solution could be flatpak with external installation for both systems, but TC doesn't support it. AppImages launch on both systems, but there's magic error on TC and I can't find out, what happens (on OpenSUSE everything is working with AppImage, but I prepare AppImage on OpenSUSE from flatpak). Why the no such file or directory message displays, when I tried to ran app on wrong system? Many years ago I read it means that CPU architecture is wrong, but these days with amd64 on PC shouldn't be real problem.
Title: Re: Flatpak
Post by: hiro on May 14, 2020, 03:17:43 AM
i think the idea of appimage and flatpak was that *they* would do the work so that it would work on every OS.
clearly they have failed.
don't get washed away from their marketing, it is *not* distro-agnostic.