TheSin- / rpi-img-builder

Scripts to create custom images for RaspberryPi
MIT License
107 stars 30 forks source link

Fresh clone does not build Raspbian Jessie on Raspberry Pi #6

Closed Turakar closed 7 years ago

Turakar commented 7 years ago

I've cloned your repo on my Raspberry Pi running Raspbian Jessie, ran the sudo apt-get install the stuff and then did a sudo make distclean && sudo make. However, this fails with the following error:

ln: failed to create symbolic link '/etc/locale.gen': File exists
rootfs.mak:64: recipe for target '/home/pi/rpi-img-builder/rootfs' failed
make[1]: *** [/home/pi/rpi-img-builder/rootfs] Error 1
Makefile:21: recipe for target 'build-rootfs' failed
make: *** [build-rootfs] Error 2

Do you know what is going wrong here? (I'm using my Pi to build the image because I have a RedHat based Fedora on my desktop PC)

TheSin- commented 7 years ago

is the pi running Raspbian? if so that isn't the same as Debian and is likely cause of the issue, that being said I can see if I can find a work around for it, at the very least I can make it non fatal and see if it still builds and image for you.

Turakar commented 7 years ago

I think that building using Raspbian is actually quite an interesting feature, as this allows all the people with non-debian distributions to still use your tool.

Besides that: The Pi is running Raspbian Jessie Lite. You can also just tell me what to change and I can test that before you push to the repo.

TheSin- commented 7 years ago

It's likely that the raspbian locale package builds the gun instead of linking it from share, as a quick test you could just check if it exists as a file and skip the linking of it. that being said I'll like to check the contents of it to make sure it doesn't break other pieces so I'm setting up a card now I should HOPEFULLY have time to test it tomorrow and see.

the lines in the code are here

https://github.com/TheSin-/rpi-img-builder/blob/master/postinstall#L47

Turakar commented 7 years ago

Ok thanks! I've attached the log and the generated locale.gen, just in case you need it.

log.txt locale.gen.txt

TheSin- commented 7 years ago

try that and let me know, I don't have a setup yet to test with but I think that'll work

Turakar commented 7 years ago

The problem with the locales is solved, thank you. However, I have a new problem:

Running postinstall script...
Generating locales (this might take a while)...
  en_US.UTF-8... done
Generation complete.
dpkg: error processing package debconf (--configure):
 package debconf is already installed and configured
dpkg: error processing package mawk (--configure):
 package mawk is already installed and configured
Errors were encountered while processing:
 debconf
 mawk
rootfs.mak:64: recipe for target '/home/pi/rpi-img-builder/rootfs' failed
make[1]: *** [/home/pi/rpi-img-builder/rootfs] Error 1
Makefile:21: recipe for target 'build-rootfs' failed
make: *** [build-rootfs] Error 2

Seems like antoher "it's already there"?

TheSin- commented 7 years ago

that is odd that those become fatal, I'll make them none fatal one sec

TheSin- commented 7 years ago

try that please, I also have a build going but I have lots of problems with all raspberrypi.org urls due to IPv4/6 confusing, which makes it hard for me to build.

BTW thank you for helping with this, I agree with you this is very useful and good bugs to find and fix to offer more options of bases systems to use to build images.

TheSin- commented 7 years ago

Are you seeing other failures/warning earlier on, I'm starting to think it's not doing a chroot properly and it's running these things on your main system :\. this would be very bad, maybe I can do a chroot test and bail if it's not chrooted just to be safe

Turakar commented 7 years ago

The image builds now. I do not think it's doing these things on my system, because a) it wants to install apt as a dependency, b) my locale (not en_US) did not change and c) it does not warn me about something bad. I will try that image on my RPi 2 in a moment (have to copy it from Pi to Fedora to new SD-Card), the base system is a RPi 3, but I do not think that will cause a problem (I've set RPI=2 now for the RPi 2). Maybe you want to do a chroot check, but it's failing anyway on errors, isn't it?

Turakar commented 7 years ago

Oh, I've just realized I've sent you the german log ^^ My bad.

TheSin- commented 7 years ago

it's okay I added a check just to be safe, now that I thought that might be possible I wanted to have a safety there anyhow, glad it wasn't the case for you though I'd have felt bad.

RPI=2/3 only changes things on Debian builds, for raspbian builds there is only one variant so it's just ignored.

as for the German it's okay I'm versed in translate.google.com :). But I'm very glad it's now working and again thank you for reporting the issue. If you are happy with it now please feel free to close the issue

Turakar commented 7 years ago

Hm, the image does not seem to be bootable. I've copied it to my Fedora desktop using scp and verified it using sha256sum, after that I've dd'ed it to my SD-card and compared the dd'ed version with my Fedora version using cmp.

Once I boot, the red and green LED turn on, but the attached HDMI screen stays black. According to the wiki, this means that no boot code is ever executed. I've then had a look at the boot partition, here's the tree:

.
├── cmdline.txt
└── config.txt

That does not seem to be correct. Main partition looks ok, however. (The problem is not dd related, as mounting the image directly produces the same results)

TheSin- commented 7 years ago

that is forsure not correct, what was your make line if I might ask? it seems the raspberrypi-bootloader package is missing if it was a raspbian build

Turakar commented 7 years ago
sudo make distclean && sudo make RPI=2

EDIT: RPI=2

Turakar commented 7 years ago

I'm doing a new build with a log right now.

TheSin- commented 7 years ago

okay I'm just about to get my RPI up so I can test on it too, on Debian it's building it properly I haven't' tested with RPI=2 though maybe that is messing things up I'll check that

Turakar commented 7 years ago

This one was produced using sudo make distclean && sudo make > log.txt 2>&1. Same error, the boot partition only contains those two files. log.txt regenerating that one in english...

TheSin- commented 7 years ago

oh man that is very odd, on raspbian multistep is doing configure, it shouldn't be, it should only be extracting, that is why all your files already exists and why the configure --configure was failing. I'll look into this, it must be a version thing, maybe multistep has a switch to turn that off in older versions.

TheSin- commented 7 years ago

I did find that I made a wrong fix to the dpkg --configure failure, please try it again, this should fix it but I still want to look into multistrap on raspbian

TheSin- commented 7 years ago

looks like multistrap will auto configure if the arch is the same as the native. So I might have to leave that as is, we kinda fixed it anyhow, now that I know why I won't worry about it.

Turakar commented 7 years ago

The image produced now boots fine, thank you! This support is way better than on most proprietary projects 😄

Turakar commented 7 years ago

You've made a first step to self-replicating Pis...

TheSin- commented 7 years ago

hehe, thank you for the support comment, and how did you know my end goal? :D

Turakar commented 7 years ago

:D