Problems with a buildroot root filesystem (no initial console, libgcc_s, etc)
Making an embedded system boot up properly can be quite a hurdle sometimes. Among the various problems you might encounter, those related to your root filesystem are some of the most common ones I have seen and among those a very frequent problem is not being akle to acquire an initial console/terminal.
These boot problems usually manifest themselves with the following two messages:
[1] Warning: unable to open an initial console.
[2] can’t open /dev/
If you see any of these errors this means that a device node which the init process needs in order to open a an initial termnial (console) is missing.
Let’s first deal with
[1] Warning: unable to open an initial console.
To solve this problem (unable to open an initial console) check the /dev directory on your rootfs. It has to have the following files and dirs:
/dev/console - a character device
/dev/pts - a directory
/dev/pts/0 - - a character device
The permissions and the major/minor device numbers of the devices are as follows:
drwxr-xr-x 2 root root 4096 Aug 14 10:34 pts
crwxrwxrwx 1 root root 5, 1 Aug 14 10:30 console
...
crw-r--r-- 1 root root 136, 0 Aug 14 10:34 0
The easiest way to find out the major and minor number of a device is to look in the If either of these is missing you’ll have to create it manually. Create the pts directory with mkdir and then to create the ‘console’ special file do
# sudo mknod console c 5 1
# sudo chmod 777 console
# cd pts
# sudo mknod 0 c 136 0
Rebooting the system now should not show the ‘unable to open an initial console’ error anymore. Let’s move on to the next one:
[2] can’t open /dev/ttyS0: No such file or directory
This problem is very similar to the first one and also happens quite often. Again, a dev node is missing. Let’s create it.
# sudo mknod ttyS0 c 204 40
# sudo chmod 664 ttyS0
Other devices such as null, zero, random, urandom could also be missing, the problems manifesting themselves with messages like:
can't open '/dev/null'
Create the nodes for the missing devices to fix this.
The next thing that I encountered was missing libs:
-sh: can't load library 'libgcc_s.
-sh: can't load library 'libc.so'
The files were indeed missing, not only in /lib directory of the root fs but they were not to be found anywhere in the root filesystem tree.
The libgcc so I simply copied from my buildroot output to lib and then created a symlink for it as well:
# ln -s libgcc_s.so.1 libgcc_s.so
The libc so was not really missing – I built my system with uClibc and the uclibc so was there, in /lib but it also wanted a libc.so symlink to it so all I had to do was:
# ln -s libuClibc-0.9.33.2.so libc.so
# ln -s libuClibc-0.9.33.2.so libc.so.0
-
Categories
- Android Development
- Bash
- C programming
- dpkg/apt-get
- drupal
- Emacs
- Git
- Java
- Linux administration
- Linux device drivers
- Linux Gaming
- Linux kernel
- Linux Networking
- Linux on Windows
- Linux printing
- Linux sound and ALSA
- Package Managers
- Programming
- RPM
- Shell and environment
- Tips and tricks
- Uncategorized
- VirtualBox
- Virtualization
- web development
- wine
- WMaker
- Wordpress Tips
- X Window System
- XFCE
-
Articles
- August 2020
- August 2019
- May 2019
- July 2017
- February 2017
- January 2017
- November 2016
- October 2016
- September 2016
- August 2016
- July 2016
- June 2016
- April 2016
- March 2016
- December 2015
- November 2015
- September 2015
- June 2015
- May 2015
- April 2015
- March 2015
- February 2015
- January 2015
- December 2014
- October 2014
- February 2014
- January 2014
- November 2013
- October 2013
- June 2013
- April 2013
- March 2013
- February 2013
- January 2013
- December 2012
- October 2012
- August 2012
- July 2012
- June 2012
- May 2012
- April 2012
- March 2012
- February 2012
- September 2011
- August 2011
- June 2011
- May 2011
- April 2011
- March 2011
- February 2011
-
Meta
Cloud
audio bash boot compile C programming cups drupal emacs etc Fedora git grep how to httpd init kernel libc linux linux partition localtime login make mount mp3 mysql networking oracle package managers password phpMyAdmin programming rpm shell sql vbox version control system virtual box vm web server wordpress www xargs xfce xwin yum