View previous topic :: View next topic |
Author |
Message |
HoJi n00b
Joined: 21 May 2015 Posts: 12
|
Posted: Fri May 22, 2015 11:44 am Post subject: Hand-emerging an embedded x86 Gentoo system |
|
|
Hello everyone,
My first post I believe! I'm a long time linux user, but fairly new to Gentoo. I work on embedded systems, either built around Buildroot, Yocto or embedded Debian. Just for some backstory we're working on some software which uses Intel's HD graphics via libva to do some heavy h.264 decode / transcode / rendering stuff, and have recently started to test our software on Intel's new Broadwell systems, which has required us to muck about loads with different libva versions. I've recently started using Gentoo because, frankly, it's flippin' brilliant and gives us all the flexibility we need to test various versions of libva, etc. etc. and compile them any which way we need. I've set up a bunch of systems for our developers and we're all getting on with it really well.
To this end we've decided to use Gentoo as the embedded distro in our products. It's great because it makes it really easy to distribute source to comply with GPL, and customise our distro down to the last. Naturally though I've run up against some problems which I can't solve! So far I've emerged everything I need, built our software and tested it. Now I'm using ROOT=/somedir emerge -k everythingineed to the embedded rootfs and have managed to generate a bootable system. The packages I've emerged (with their deps) are:
baselayout, glibc, udev, util-linux, sysvinit, bash, openrc, grub2 and xorg-server.
I've managed to get the system booting to multi-user mode with a shell using a vanilla 4.0 kernel and all is well! However when I try and use the /etc/init.d openrc scripts I constantly get this error
* You are attempting to run an openrc service on a
* system which openrc did not boot.
etc etc...
Of course this is all over the internet, but I have no idea how to go about fixing it in my case... and so far I'm stuck! Does anyone have any suggestions? I'd love to post up some configuration informtion but short of posting up the whole of /etc I don't really know what is needed - please ask, and I will post! This seems to be having some pretty large knock on effects, for example causing x to hang at startup... at least so it appears!
Many thanks |
|
Back to top |
|
|
Jaglover Watchman
Joined: 29 May 2005 Posts: 8291 Location: Saint Amant, Acadiana
|
|
Back to top |
|
|
lefta n00b
Joined: 29 Apr 2011 Posts: 25
|
Posted: Mon May 25, 2015 7:11 pm Post subject: |
|
|
As I understand the error, you are not booting with openrc. You must boot with openrc to use its scripts, obviously.
1 - What is your "init" kernel parameter, if any?
2 - gentoo-sources' options only enable options required by gentoo stuff. Check for these options :
Code: | CONFIG_GENTOO_LINUX_PORTAGE:
Selects: CGROUPS [=y] && NAMESPACES [=y] && IPC_NS [=y] && NET_NS [=y] |
Code: | CONFIG_GENTOO_LINUX_INIT_SCRIPT:
Selects: BINFMT_SCRIPT [=y] |
3 - Check your /etc/inittab, if I understand it right it is his role to use openrc as init system
4 - As Jaglover stated, turn on logging in /etc/rc.conf :
Code: | rc_logger="YES"
rc_log_path="/var/log/rc.log" # Default value, use this option if you want to store it elsewhere |
And post the log after reboot :
Code: | cat /var/log/rc.log |
|
|
Back to top |
|
|
HoJi n00b
Joined: 21 May 2015 Posts: 12
|
Posted: Tue May 26, 2015 2:39 pm Post subject: |
|
|
Thanks for the responses!
1. There is no init parameter being passed to the kernel - my grub.cfg looks like this:
Code: | menuentry 'Gentoo GNU/Linux' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-a75c3e86-6e38-4b97-9354-727ec243d081' {
load_video
insmod gzio
insmod part_msdos
insmod ext2
set root='hd11,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd11,msdos1 --hint-efi=hd11,msdos1 --hint-baremetal=ahci11,msdos1 a75c3e86-6e38-4b97-9354-727ec243d081
else
search --no-floppy --fs-uuid --set=root a75c3e86-6e38-4b97-9354-727ec243d081
fi
echo 'Loading Linux 4.0.0-vmmo ...'
linux /boot/vmlinuz-4.0.0-vmmo root=/dev/sda1 ro
} | [/post]
2. I'm aware that there are a few configuration options which are required for openrc - I've checked my kernel config and the options you specify are all enabled. I've just tried using the gentoo-sources kernel which I am running on my build host and there are no differences there...
3. My inittab is also pretty standard
Code: | #
# /etc/inittab: This file describes how the INIT process should set up
# the system in a certain run-level.
#
# Author: Miquel van Smoorenburg, <miquels@cistron.nl>
# Modified by: Patrick J. Volkerding, <volkerdi@ftp.cdrom.com>
# Modified by: Daniel Robbins, <drobbins@gentoo.org>
# Modified by: Martin Schlemmer, <azarah@gentoo.org>
# Modified by: Mike Frysinger, <vapier@gentoo.org>
# Modified by: Robin H. Johnson, <robbat2@gentoo.org>
#
# $Header: /var/cvsroot/gentoo-x86/sys-apps/sysvinit/files/inittab-2.87,v 1.2 2013/04/20 03:51:26 vapier Exp $
# Default runlevel.
id:3:initdefault:
# System initialization, mount local filesystems, etc.
si::sysinit:/sbin/rc sysinit
# Further system initialization, brings up the boot runlevel.
rc::bootwait:/sbin/rc boot
l0:0:wait:/sbin/rc shutdown
l0s:0:wait:/sbin/halt -dhp
l1:1:wait:/sbin/rc single
l2:2:wait:/sbin/rc nonetwork
l3:3:wait:/sbin/rc default
l4:4:wait:/sbin/rc default
l5:5:wait:/sbin/rc default
l6:6:wait:/sbin/rc reboot
l6r:6:wait:/sbin/reboot -dk
#z6:6:respawn:/sbin/sulogin
# new-style single-user
su0:S:wait:/sbin/rc single
su1:S:wait:/sbin/sulogin
# TERMINALS
c1:12345:respawn:/sbin/agetty 38400 tty1 linux
c2:2345:respawn:/sbin/agetty 38400 tty2 linux
c3:2345:respawn:/sbin/agetty 38400 tty3 linux
c4:2345:respawn:/sbin/agetty 38400 tty4 linux
c5:2345:respawn:/sbin/agetty 38400 tty5 linux
c6:2345:respawn:/sbin/agetty 38400 tty6 linux
# SERIAL CONSOLES
s0:12345:respawn:/sbin/agetty -L 115200 ttyUSB0 vt100
#s1:12345:respawn:/sbin/agetty -L 115200 ttyS1 vt100
# What to do at the "Three Finger Salute".
ca:12345:ctrlaltdel:/sbin/shutdown -r now
# Used by /etc/init.d/xdm to control DM startup.
# Read the comments in /etc/init.d/xdm for more
# info. Do NOT remove, as this will start nothing
# extra at boot if /etc/init.d/xdm is not added
# to the "default" runlevel.
x:a:once:/etc/X11/startDM.sh
|
I have tried enabling logging in /etc/rc.conf and it never produces the output file specified in rc_log_path. I'm guessing that devfs filesystem has not been mounted yet, as init has not yet mounted the contents of fstab?
It does seem that openrc is being run to a greater or lesser extent - its messages (not the kernel boot messages) are shown on the screen before the login prompt and certain things work, for example all my filesystems are mounted. Clearly I've broken something somewhere, perhaps openrc is not starting udev, and without udev running...err... |
|
Back to top |
|
|
lefta n00b
Joined: 29 Apr 2011 Posts: 25
|
Posted: Tue May 26, 2015 11:16 pm Post subject: |
|
|
Everything seems OK, except OpenRC not logging, of course.
Quote: | It does seem that openrc is being run to a greater or lesser extent - its messages (not the kernel boot messages) are shown on the screen before the login prompt and certain things work, for example all my filesystems are mounted. Clearly I've broken something somewhere, perhaps openrc is not starting udev, and without udev running...err... |
You can check for services started at boot with:
Do you have colored output? If so, do you see some red stuff? And do you see something like "OpenRC X.X starting" (X.X being openrc version) right after kernel output?
If you think you broke something, it could be nice to know what you did, like services changes, configuration (if you remember) .
I think udev is starting, because without udev things are worse (like portage emerging packages but not installing files. Never upgrade Gentoo without udev working...).
EDIT : I just noticed
Quote: | This seems to be having some pretty large knock on effects, for example causing x to hang at startup |
This is only a symptom that anything is wrong at a lower level, but it can help us. Do you have errors/warnings at Xorg start?
Code: | cat /var/log/Xorg.0.log | grep -E "EE|WW" |
|
|
Back to top |
|
|
HoJi n00b
Joined: 21 May 2015 Posts: 12
|
Posted: Wed May 27, 2015 11:27 am Post subject: |
|
|
Lefta, thanks for your time. I realise the general nature of this thread makes it rather difficult to drill down into the details.
Here's my output of rc-update, comparing everything to my build machine, all seems pretty normal. When I boot I see the OpenRC mesages - though they flash by too fast to read properly. I've tried to set console=ttyUSB0,115200n8 but the USB subsystem is started too late in the kernel initialisation and I get a "Warning: unable to open an initial console" error. Might try and find a board lying about that has a proper UART on it...
Code: | bootmisc | boot
devfs | default sysinit
dmesg | sysinit
fsck | boot
hostname | boot
hwclock | boot
keymaps | boot
killprocs | shutdown
kmod-static-nodes | sysinit
local | default
localmount | boot
loopback | boot
modules | boot
mount-ro | shutdown
mtab | boot
netmount | default
procfs | boot
root | boot
savecache | shutdown
swap | boot
swapfiles | boot
sysctl | boot
sysfs | sysinit
termencoding | boot
tmpfiles.dev | sysinit
tmpfiles.setup | boot
udev | default sysinit
urandom | boot
|
In terms of breaking stuff, I've not changed any configuration files bar the few I need to use to get the machine starting - I've emerged into a folder everything I thought I needed to generate a bootable system and that's pretty much that. As far as I remember all I've changed is inittab to provide me with a serial console and fstab to provide my mounts. I agree, udev must be functioning - I just ran udevadm monitor, unplugged my USB keyboard and got the relevant kernel events.
With regards to X hanging up, I've had a rummage and found that in my haste I have failed to emerge the relevant intel video drivers so Xorg.log.0 is full of errors pertaining to that - so I'm going to forget about that for the time being and make sure I understand what's happening in the init stage.
Interestingly I have no /dev/pts - I must mkdir /dev/pts, then mount /dev/pts to get my pseudo terminals up and running. As far as I was aware udev creates this folder and a few others when it starts, maybe this points to udev not being correctly set up. Apart from messing with some custom /etc/udev/rules.d stuff in the past I'm not very familiar with the voodoo that is udev.
I guess, essentially, the two things I need to solve before moving on are:
1. Cannot seem to use OpenRC to manage services, or enable logging, despite the fact that it is running
2. /dev/pts is not being created, possibly pointing to a udev configuration issue. |
|
Back to top |
|
|
lefta n00b
Joined: 29 Apr 2011 Posts: 25
|
Posted: Wed May 27, 2015 5:51 pm Post subject: |
|
|
You have some services in default and sysinit. Remove them from default:
Code: | rc-update del devfs default
rc-update del udev default |
If rc-update doesn't work for this, you will have to delete them by hand:
Code: | rm /etc/runlevels/default/{devfs,udev} |
Otherwise it seems good.
Quote: | I've emerged into a folder everything I thought I needed to generate a bootable system and that's pretty much that |
I'm not sure to understand, do you mean you installed your system by hand, not a stage 3 archive? How did you do that exactly? Because in this case, and depending how you did it, you may miss some dependencies.
Quote: | Lefta, thanks for your time. I realise the general nature of this thread makes it rather difficult to drill down into the details. |
Sure, it would be easier if I had your system in front of me
But when I need help on problems,they are usually strange ones and I almost never get an answer, so I will try to help you as most as I can |
|
Back to top |
|
|
Jaglover Watchman
Joined: 29 May 2005 Posts: 8291 Location: Saint Amant, Acadiana
|
|
Back to top |
|
|
HoJi n00b
Joined: 21 May 2015 Posts: 12
|
Posted: Thu May 28, 2015 10:14 am Post subject: |
|
|
OK it appears I've solved my problems in an embarrasingly simple manner - I had not emerged grep into my rootfs. Wow. I'm amazed anything worked at all...
lefta, I've sorted out my runlevels as you suggested, of course devfs and udev should only be in the sysinit runlevel!
Jaglover - I've checked over my kernel config and those options do exist. It's tempting to get rid of eudev and go for a static configuration as you say, but in this system there is the possibilty of needing to run triggers on USB events, and size isn't an issue so I may well stick with it as it is. Pretty much the first thing I did was test the new kernel on my build machine and everything seemed to work just fine, so I forged ahead.
Quote: | I'm not sure to understand, do you mean you installed your system by hand, not a stage 3 archive? How did you do that exactly? Because in this case, and depending how you did it, you may miss some dependencies.
|
This was exactly my problem. I did not start with a stage3 archive - instead I set up my build host's make.conf with FEATURES="buildpkg" and emerged everything I need with the relevant use flags, march etc. I then used portage to emerge these packages into a folder, which was to become my new root filesystem, using ROOT=/embeddedrootfs emerge -k baselayout
Starting with baselayout I then emerged glibc, sysvinit, openrc and grub which provided me with my bootable system - I basically used the Linux From Scratch book (which I've worked through before) to guide my hand in using portage. Of course, as you say, missing dependencies is very easy to do, and in this case I didn't install grep (as I thought it was part of util-linux). There's probably a whole load of other stuff I've missed too!
It's always a bit embarrasing when you end up finding such a trivial solution to your apparently insoluble problem - thankyou very much for all your help! Once I've sorted all this out I'll write it all up, hopefully It'll help someone out somewhere. There are a few guides I have found which describe a similar process of building an embedded system, but most of them focus on uclibc / busybox systems whereas my requirements are for a full glibc system running an X server, so I've had to hack, chop and add stuff as required - it never ceases to amaze me how much busybox can do, and how much stuff you need to provide to replace it!! I'll append this thread with a link to my write-up once it's all sorted.
Again, thanks lefta & Jaglover! |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|