LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   What are the dependencies to install bash from source in empty partition? (https://www.linuxquestions.org/questions/linux-general-1/what-are-the-dependencies-to-install-bash-from-source-in-empty-partition-4175591507/)

cola 10-15-2016 11:02 PM

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)


pan64 10-16-2016 03:38 AM

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.

ondoho 10-16-2016 05:52 AM

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).

smallpond 10-16-2016 08:27 AM

If you want just a working minimal kernel + shell look to BusyBox.

cola 10-16-2016 09:20 AM

Quote:

Originally Posted by ondoho (Post 5618681)
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.

cola 10-16-2016 09:21 AM

Quote:

Originally Posted by smallpond (Post 5618733)
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

cola 10-16-2016 09:26 AM

Quote:

Originally Posted by pan64 (Post 5618648)
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.

pan64 10-16-2016 11:19 AM

Quote:

Installed kernel-4.8.0 in /media/sda7/boot. Then I tried to install bash in /media/sda7/bin.
How?

smallpond 10-16-2016 05:12 PM

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.

c0wb0y 10-16-2016 10:36 PM

What's your goal?

cola 10-17-2016 12:42 AM

Quote:

Originally Posted by pan64 (Post 5618766)
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


c0wb0y 10-17-2016 01:31 AM

It appears to me that you're brewing a custom distro. :)

pan64 10-17-2016 02:17 AM

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.

Jjanel 10-17-2016 10:51 PM

less than LFS?
 
1 Attachment(s)
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 ...)

rtmistler 10-18-2016 07:56 AM

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


All times are GMT -5. The time now is 01:40 PM.