LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-15-2016, 11:02 PM   #1
cola
Senior Member
 
Registered: Sep 2007
Posts: 1,045

Rep: Reputation: 65
What are the dependencies to install bash from source in empty partition?


What are the dependencies to install bash from source in empty partition? Linux kernel is in that partition's(/dev/sda7) /boot directory, nothing else. If I want to compile and install bash to that partition, what are the packages do I need to install there before installing bash?

The existing linux is Debian jessie here. It's in /dev/sda9.
Code:
ldd /bin/bash
returns this from debian machine:
Code:
	linux-gate.so.1 (0xb778b000)
	libncurses.so.5 => /lib/i386-linux-gnu/libncurses.so.5 (0xb7744000)
	libtinfo.so.5 => /lib/i386-linux-gnu/libtinfo.so.5 (0xb7721000)
	libdl.so.2 => /lib/i386-linux-gnu/i686/cmov/libdl.so.2 (0xb771b000)
	libc.so.6 => /lib/i386-linux-gnu/i686/cmov/libc.so.6 (0xb756e000)
	/lib/ld-linux.so.2 (0xb778e000)
 
Old 10-16-2016, 03:38 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,849

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
sory, but do not really understand it. You never install anything into a partition, but into a directory (probably). The directory should belong to a filesystem, the filesystem should belong to a partition and all these things should belong to a working os. And you will install anything into this os, and into a specific directory. The dependencies of bash are to have a working os and enough space.
 
Old 10-16-2016, 05:52 AM   #3
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
so you want to install just a kernel + bash as the ultimately minimal system? something like that?

if you use everything from debian repositories, there's no need to compile?
you could manually install bash (it's really just the binary 'bash', plus documentation, which you don't strictly need).
and its dependencies. on my (archlinux) system they are: readline>=6.3 glibc ncurses libncursesw.so=6-64 (this is for bash 4.3.46, on debian the dependency versions are likely different, but similarly strict i guess).
 
Old 10-16-2016, 08:27 AM   #4
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,140

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
If you want just a working minimal kernel + shell look to BusyBox.
 
Old 10-16-2016, 09:20 AM   #5
cola
Senior Member
 
Registered: Sep 2007
Posts: 1,045

Original Poster
Rep: Reputation: 65
Quote:
Originally Posted by ondoho View Post
so you want to install just a kernel + bash as the ultimately minimal system? something like that?

if you use everything from debian repositories, there's no need to compile?
you could manually install bash (it's really just the binary 'bash', plus documentation, which you don't strictly need).
and its dependencies. on my (archlinux) system they are: readline>=6.3 glibc ncurses libncursesw.so=6-64 (this is for bash 4.3.46, on debian the dependency versions are likely different, but similarly strict i guess).
Yes, I want to install just a kernel+bash as ultimately minimal system.
I've added this entry in grub.cfg:
Code:
linux	/boot/vmlinuz-4.8.0 root=/dev/sda7 ro init=/bin/bash
But got error like this:
Code:
Kernel panic, attempted to kill init!
bash not tainted
And the system is in freeze/hang mode. Can't do anything from there.

Last edited by cola; 10-16-2016 at 09:27 AM.
 
Old 10-16-2016, 09:21 AM   #6
cola
Senior Member
 
Registered: Sep 2007
Posts: 1,045

Original Poster
Rep: Reputation: 65
Quote:
Originally Posted by smallpond View Post
If you want just a working minimal kernel + shell look to BusyBox.
I've worked with busybox. It worked well. Now I'm trying to boot kernel with bash like this:
Code:
linux	/boot/vmlinuz-4.8.0 root=/dev/sda7 ro init=/bin/bash
 
Old 10-16-2016, 09:26 AM   #7
cola
Senior Member
 
Registered: Sep 2007
Posts: 1,045

Original Poster
Rep: Reputation: 65
Quote:
Originally Posted by pan64 View Post
sory, but do not really understand it. You never install anything into a partition, but into a directory (probably). The directory should belong to a filesystem, the filesystem should belong to a partition and all these things should belong to a working os. And you will install anything into this os, and into a specific directory. The dependencies of bash are to have a working os and enough space.
What I tried:
Code:
mount /dev/sda7 /media/sda7
Installed kernel-4.8.0 in /media/sda7/boot. Then I tried to install bash in /media/sda7/bin.
I've added this entry in grub.cfg:
Code:
linux	/boot/vmlinuz-4.8.0 root=/dev/sda7 ro init=/bin/bash
But got error like this:
Code:
Kernel panic, attempted to kill init!
bash not tainted
And the system is in freeze/hang mode. Can't do anything from there.
 
Old 10-16-2016, 11:19 AM   #8
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,849

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
Quote:
Installed kernel-4.8.0 in /media/sda7/boot. Then I tried to install bash in /media/sda7/bin.
How?
 
Old 10-16-2016, 05:12 PM   #9
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,140

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
bash is not a stand-alone program. It expects to be started by init and to have libraries and C runtime available.

This is what bash says it needs when running under Windows10/Ubuntu which I just loaded and am playing with now:

Code:
ldd /bin/bash
        linux-vdso.so.1 =>  (0x00007fffd2fcb000)
        libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007fbc53490000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fbc53280000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fbc52ea0000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fbc53800000)
It also expects to have a set of environment variables and a working filesystem.

Last edited by smallpond; 10-16-2016 at 05:20 PM.
 
Old 10-16-2016, 10:36 PM   #10
c0wb0y
Member
 
Registered: Jan 2012
Location: Inside the oven
Distribution: Windows
Posts: 421

Rep: Reputation: 74
What's your goal?
 
Old 10-17-2016, 12:42 AM   #11
cola
Senior Member
 
Registered: Sep 2007
Posts: 1,045

Original Poster
Rep: Reputation: 65
Quote:
Originally Posted by pan64 View Post
How?
Code:
glibc:
cd /media/sda7/packages/glibc-2.24
./configure --prefix=/media/sda7 --enable-kernel=2.6.32
make
make install

binutils:
cd /media/sda7/packages/binutils-2.27
./configure --prefix=/media/sda7
make
make install

ncurses:
cd /media/sda7/packages/ncurses-5.9
./configure --prefix=/media/sda7 --with-shared --with-termlib
make
make install

readline:
cd /media/sda7/packages/readline-6.3
./configure --prefix=/media/sda7
make
make install

bash:
cd /media/sda7/packages/bash-4.4
./configure --prefix=/media/sda7
make
make install 

cd /media/sda7/usr/src/linux-4.8
make menuconfig
make INSTALL_MOD_PATH=/media/sda7 modules_install
cp -v arch/x86/boot/bzImage /media/sda7/boot/vmlinuz-4.8.0
cp -v System.map /media/sda7/boot/System.map-4.8.0
cp -v .config /media/sda7/boot/config-4.8.0

Last edited by cola; 10-17-2016 at 12:43 AM.
 
Old 10-17-2016, 01:31 AM   #12
c0wb0y
Member
 
Registered: Jan 2012
Location: Inside the oven
Distribution: Windows
Posts: 421

Rep: Reputation: 74
It appears to me that you're brewing a custom distro.
 
Old 10-17-2016, 02:17 AM   #13
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,849

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
So you installed those libraries into /media/sda7. You need to tell bash to look for those libraries there, not in /usr/lib. So you need to use ldconfig (or something similar).
But I'm still not sure if that works.
 
Old 10-17-2016, 10:51 PM   #14
Jjanel
Member
 
Registered: Jun 2016
Distribution: any&all, in VBox; Ol'UnixCLI; NO GUI resources
Posts: 999
Blog Entries: 12

Rep: Reputation: 364Reputation: 364Reputation: 364Reputation: 364
Exclamation less than LFS?

Quote:
Yes, I want to install just a kernel+bash as ultimately minimal system.
OP is LFS'er, fyi... Note *NO* initrd...

(I'm working toward like this, from NuTyX, for VBox Atom N270, but didn't dare ask ...
attached is my .config based on `make tinyconfig` +IDE +a mess of essential&not ...)
Attached Files
File Type: txt zc9.txt (45.4 KB, 18 views)

Last edited by Jjanel; 10-17-2016 at 11:51 PM.
 
Old 10-18-2016, 07:56 AM   #15
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Build your minimal Linux kernel, get it installed and running. From there you have two options:
  1. Grab bash from another location, such as that Debian Jesse, it will be in /bin, and also grab those so libraries and make links shown in your first post
  2. Compile bash from source on this minimal kernel and install it
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Partitioning/Formatting for First Install of Linux on empty NTFS partition annabanana Linux - Newbie 26 08-08-2013 08:41 PM
[SOLVED] [BASH] non-empty variable before loop end, is empty after exiting loop aitor Programming 2 08-26-2010 09:57 AM
How do I convert an empty ext3 partition to a jfs partition? lothario Linux - Software 3 02-28-2006 10:40 AM
strange partition table - boot partition empty etanter Linux - General 0 12-23-2003 09:46 AM
How can I install Dos on an empty partition? florinel Linux - General 1 08-23-2003 10:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration