procount / pinn

An enhanced Operating System installer for the Raspberry Pi
1.13k stars 123 forks source link

Problems getting the aditional files for own os #570

Closed Besix2 closed 2 years ago

Besix2 commented 3 years ago

hello, I have tried too add a few of my own os to PINN but i need the additional files (json...) not only the tar.xz file and i dont now how to get them.

procount commented 3 years ago

You have to create them. These files contain information about your OS to inform PINN how to install them, like the partition layout, the size of the files, their release date, URL for more info etc. You can start by copying some meta files from one of the other OSes to get the right structure, but you will have to change the values accordingly for your OS. See https://github.com/procount/pinn/wiki/JSON-fields for details of what the fields mean.

You should look at some of the other OSes and understand how their metafiles work.

Are your OSes modified versions of existing OSes, your own homebrew OSes, or some other distro that hasn't been converted to PINN before?

Besix2 commented 3 years ago

That are some Distros that haven't been converted to PINN before like pwngotchi and picroft.

procount commented 3 years ago

From their website it looks like Picroft is based on Raspbian Buster Lite, so I suggest you start with the meta files from there and adapt them accordingly.

Besix2 commented 3 years ago

But there is my problem im a linux newbie and i dont now how to get the meta files. I've read the description for instaling an custom os in noobs but when i do the steps i dont find any of the listed files. I got so far that i converted the .img files to tar.xz but i dont know where to but the file and where i can get the other needed files..

procount commented 3 years ago

Have you read this article in my wiki? => https://github.com/procount/pinn/wiki/How-to-Create-a-Multi-Boot-SD-card-out-of-2-existing-OSes-using-PINN You will find most PINN OS Installation files at https://sourceforge.net/projects/pinn/files/os/

Besix2 commented 3 years ago

sorry for the late answer, I read the article in the wiki and from my point of understanding i have to do the following: 1: Go in the /os folder on the PINN sd card and create a new folder for your os 2: In the folder Put the 5 meta files (i finaly checked how to get them, you need to download and modify them) and the boot- and root.tar.xz files (i have no clue how to get them because im on windows and the commands in the wiki dont work. I thought i can use a compresser like quick zip to compress the boot partiton to .tar and and change it to tar.xz with something like Filestar. The root.tar.xz file is more difficult to get because windows cant read the root partition (this is the point where i need help to get the file).

  1. Now you have to change the partions and os .json to your needs
  2. Finaly put the files in your sd card with PINN and it should work.

Correct me if i'am wrong Thanks for your help

procount commented 3 years ago

Sorry, I had misunderstood your first email - I thought you were only stuck at downloading the metafiles and had already created your tar.xz files. So you are not as far along in your understanding as I had thought. My bad.

The wiki article provides instructions to be used under Linux. You cannot really do this on Windows. Fortunately, you already have a linux computer - it's called a Raspberry Pi! Just load Raspbian on to an SD card and put your SD card with Picroft or whatever into a USB adaptor and then you can follow the instructions more easily.

Just FYI, you can use 7Zip on Windows to (de-)compress tar and xz files, but that doesn't help you much in creating the files because Windows cannot understand the ext4 partition format that your OS (i.e. Picroft) probably uses to store them on.

Some comments on your steps above:

  1. you don't need to do it on the PINN sd card. In fact when developing, this can be a hinderance. An alternative is to use a FAT32 formatted USB Stick. Create a /os folder on that with a /picroft folder in it to store your picroft files.
  2. As I mentioned above, use Raspbian on a RPi to create your boot.tar.xz and root.tar.xz from your original Picroft OS. I recommend that you install bsdtar as described in either the wiki or in README_PINN,md to create your tar files because it provides better support. You need plenty of storage space when you are converting/archiving an OS, so a fairly decent sized USB stick is required. It will need to be about 2-3 times bigger than your original Picroft OS.
  3. (Where is 3? There is no 3)
  4. Yes. You will need to identify the size of the download files, and also the minimum size of each partition that is required to store the data on. The boot partition is typically 256MB these days. For the root partition, get the size of root.tar and add some margin to it. Adding a few 100MB may allow it to boot and run, but may not be enough to allow it to upgrade. Providing a margin that is too big (e.g. several GBs) will prevent users installing it on the smallest drives. There is no hard and fast rule here. Somewhere around 400MB-1GB is probably about right, but it depends on the OS
  5. Yes, or in the /os/picroft folder of your USB stick

For a local installation, PINN uses os.json and partitions.json. For network installs, PINN uses the os_list.json files (that are all concatenated into a single file on the repository which contains just enough of a subset of os.json and partitions.json to allow it to download everything, and then it uses os.json and partitions.json to install the OS.

Besix2 commented 3 years ago

I got it to work i can see the OS´ses in the PINN loading screen but i can´t install it. In my view i made all things in the wiki correct

procount commented 3 years ago

Well done for getting this far!

"But I can't install it. In my view i made all things in the wiki correct"

Oh dear. But that doesn't really tell me much. I don't have X-ray vision or a crystal ball, so you need to provide more information. Did you follow the instructions to the letter? Was there any point where you deviated? If there was a choice, which one did you make? What error messages were shown?

You can also post screenshots, debug logs and the meta files you created to help narrow down the problem. Have a look at the troubleshooting section of the wiki about how to provide logs.

Besix2 commented 3 years ago

This is my Os folder, i only resived a error when i converted the .tar files to tar.xz but the files were generated anyways.https://drive.google.com/file/d/1SR5TOsG-JxtiHXwSAV4rdX58gb0PGSE1/view?usp=sharing

procount commented 3 years ago

@Besix2 - You haven't shared the above folder with me, so I cannot access it. I have sent a request, which is probably in your gmail account.

Besix2 commented 3 years ago

Sorry for that, I accepted the shearing request.

procount commented 3 years ago

You have a couple of errors on each OS.

  1. When you modified partitions.json, you deleted the sha256sum, which is ok, but you also need to remove the trailing comma on the previous line, otherwise the json syntax is not correct. http://jsonlint.com is a good place to cut and paste your json files to make sure their syntax is correct before using.

  2. There is something wrong with your root.tar.xz files. The extraction programs complain that these files are truncated. If I view them in 7zip, then many of the folders are empty. Did you run out of disk space when you created them? I would allow about twice as much space as the rootfs requires. So if the rootfs is 400MB in size, make sure you have 800MB free space on your drive to create the tar file and then to compress it.

Other than those small mistakes, you've made a valiant attempt - well done.

Besix2 commented 3 years ago

im back, i got pwngotchi to work thx to your steps but i cant get picroft to work because pinn installs it with errors. In the creation process are no error so i think its the fault of PINN.

https://www.file-upload.net/download-14740039/debuglog.zip.html

procount commented 3 years ago

That is the same error I got with your last attempt. I suspect your tar file is not complete. Try opening your tar or tar.xz file in 7-zip for Windows and see if any of your files/folders have 0 bytes. Use 'du -sh' on the root of your source partition and see how much space is required. Your tar file should be about the same size before you compress it with xz.

Besix2 commented 3 years ago

When i open the tar.xz file some folders are empty. But raspian ist unable to do it right. I tried it like 6 times, even on windows with exfat drivers, with other tar compression programms... I have no clue how to continue because when ever i use bsdtar command it loads like 10min and i have the root.tar than i format it to tar.xz and change the partition stuff and when i want to install it in pinn it installs with errors. Thx for your time

procount commented 2 years ago

I can only suggest you post a link to your original image.

Besix2 commented 2 years ago

https://drive.google.com/file/d/1BxFQnUTk88HJqSp6vn53tqvhDt17ILpm/view?usp=sharing

this is my finished picroft folder with all the files needed to install.

procount commented 2 years ago

Thanks but does it include the original image file? I need that to see why your tar.xz file is not working.

Besix2 commented 2 years ago

https://drive.google.com/file/d/1xOcSKoI0IVOUP4tk1gNLBcdi5WSFA3lI/view?usp=sharing

This is the .img file

procount commented 2 years ago

Your root.tar file is missing the /bin and /opt folders. This could be because you didn't have enough storage space when creating the tar file, or it might be a permissions problem. Did you use sudo?

In partitions.json, your partition sizes are all too small. They should be the size of the space required. So for example, the root partition needs at least 5GB, whereas yours indicates only 2.6GB is required. Did you measure the size of the .tar.xz file by mistake?

There may be more issues. Let me investigate a bit further.

procount commented 2 years ago

Please try unzipping the attached os_list_v3.zip to obtain os_list_v3.json and copy this to your PINN partition then boot it. You should find picroft under the Testing category. You can download all the files from https://sourceforge.net/projects/pinn/files/testing/picroft/, or just use PINN to download them to a USB stick (if it has a /os folder on it) Not quite sure why your tar file was incorrect, but mine seems to boot ok, although it doesn't work on a Pi400. I forgot to copy your logo across, proper marketing slides could do with being created, and I didn't check compatibility with USB booting, different models or backing up.

Besix2 commented 2 years ago

thanks it worked but i have a final question can it be that my pwngotchi os is not working because i have given it to little space in partition.json and if yes how much should i give.

procount commented 2 years ago

Normally, the space specified in partitions.josn is the MINIMUM space required. PINN will allocate at least that amount and will share anything else out between the OSes. Pwngotchi is quite small isn't it? So most likely you will have more than enough space. But if you got the boot partition wrong it would probably fail to install because that's normally a fixed size, so it won't have anything added to it.

But if you made the same mistake as on picroft, you should correctthe json file and reinstall it to test.

Besix2 commented 2 years ago

im back, The partitions are all correct but im struggeling to get pwngotchi to work it boots up and then i get the error message "kernel panic no working init" i googled it and i think my rootfs is missing some files ore so but when i extract root.tar.xz in windows and check it with a working root from another pwngotchi instalation it looks identical but a few files are on other places and 1 ore 2 new files can be found. Can it be that PINN creates new files on my rootfs and this is creating this error message.

Thanks for your help and time

procount commented 2 years ago

The conversion from an image file to a tar.xz file is just a change in format. It should not add or delete files. PINN just decompresses and extracts the files. The result should be identical to the original image. Once you boot an OS though, the OS itself may change some files, so be careful you are comparing the same files.

The OS will be located on different partitions, so some files need to be adjusted. This is the purpose of the partition_setup.sh file - to adapt the OS to the new location.

The partition_setup.sh file will be specific to each OS. Are you using the same file as you used for PiCroft? Is it appropriate? Does it need adapting? The 2 places that generally need adapting are cmdline.txt on the boot partition and /etc/fstab on the root partition, but in some cases (e.g. Android) it can be completely different.

When I get some time I may take a look at pwnagotchi for you.

EDIT: I see pwnagotchi is based on Raspbian-lite, so the partition_setup.sh should be fine if you took it from there.

Besix2 commented 2 years ago

Im back im experiemented a little bit and i think raspian is unable to perform bsdtar commands on root partitions. Because when ever i try it nothing happens and the terminal freezes for about 5 minutes and than i have a root.tar but this root.tar is always corrupted. Im gonna go search for a other way to get the root.tar

procount commented 2 years ago

Did you use sudo? You need to be root to capture all files.

Besix2 commented 2 years ago

yes i used sudo otherwise i get a warning that i need to be sudo

Besix2 commented 2 years ago

so i tried to get the root.tar on another linux distro (kali) and i was able to get the boot.tar but the root.tar gave me a couple of errors

https://drive.google.com/file/d/12prZpObZz4j9vIVWGsqMXMi0-aNVZxeb/view?usp=sharing

Besix2 commented 2 years ago

I tried to install pwngotchi but the os list v3.json didnt work so i out it in a json validator and fixed it. Then i started the instalation and got the first error: the boot.tar.xz is missing checksums i continued the download and later on i got the same error but with the root.tar.xz at the end the download was completed with errors and didnt install. Now i go try to fuse my working boot.tar.xz with the root.tar.xz

procount commented 2 years ago

Sorry I didn't have time to check this out thoroughly. I'll take a look when I have a minute.

Besix2 commented 2 years ago

I think i go gonna ask on stack overflow because i get the same error over and over again no matter what im doing.