[SOLVED] Slackware(64) 15.0 Making esential chroot env
by inukaze from LinuxQuestions.org on (#6NWTG)
#Creating esential chroot env
#Note normally i do this on /boot partition for put some tools there.
#But some things i don't know to do.
#I will go procede on USB Pendrive with the follow partitions :
Code:fdisk -l /dev/sdgQuote:
Attachment 43208
#i already had set "boot" flag on my "Inicio" (boot) partition.
#On my case ummount first
Code:su -c "umount /dev/sdg2" root#Make the directory when i wish do this :
Code:mkdir -p /tmp/sdg2#Mount in that directory
Code:su -c "mount /dev/sdg2 /tmp/sdg2" root#Enter in the dir and make minchr directory
Code:cd /tmp/sdg2 ; mkdir minchr#Make sub-directories for the arquitectures i want to use
Code:mkdir 32Bits ; mkdir 64Bits#I Enter in the directory called 64Bits
Code:cd 64Bits#i make directories "bin" and "lib64"
Code:mkdir bin ; mkdir lib64#I Copy /bin/bash, the basic program to work with commands
#To my minimal chroot env, binary executables directory
#"/tmp/sdg2/minchr/64Bits/bin"
Code:cp -a /bin/bash ./bin/#I use "ldd" command to list libraries used by "/bin/bash"
Code:ldd /bin/bashQuote:
#Copy the need libraries to the right sub-directory :
Code:cp /lib64/libtinfo.so.6 ./lib64/
cp /lib64/libdl.so.2 ./lib64/
cp /lib64/libc.so.6 .#First check what is the real file of
Code:readlink /lib64/ld-linux-x86-64.so.2 ; readlink /lib64/libc.so.6Quote:
#Locate where is the "ld-2.33.so" file
Code:whereis ld-2.33.soQuote:
#Enter in the sub-directory "lib64"
Code:cd "./lib64"#Copy the "ld-2.33.so" file
Code:cp /lib64/ld-2.33.so ./lib64/#Create simbolic links :
Code:ln -sf "ld-2.33.so" "ld-linux-x86-64.so.2"#By experience, I know to have a working textual env the "ncurses" libs are need
Code:locate ncurses | grep ".so" | grep "/lib64" | grep -v "/usr"Quote:
#Copy ncurses libs and make symbolic links
Code:cp /lib64/libncurses.so.5.9 .
cp /lib64/libncurses.so.6.3 .
ln -sf libncurses.so.5.9 libncurses.so.5
ln -sf libncurses.so.6.3 libncurses.so.6# Test it :
Code:su #Enter your root password and then press enter.
cd "/tmp/sdg2/minchr" #Enter in the "root" of "working directory"
chroot "64Bits" #Use chroot on "64Bits" directory to enter in "chroot"Quote:
#Ready, you have the most esential "chroot", the rest its you own customization.
#Normally in my "/bin" i put programs like :
* fsck (with all including fsck.exfat)
* mc
* joe, nano
* links2
* gpm
* ls
* lsblk
* blkid [i grab from /sbin/]
#i don't know what i should to not have any trouble with set locate like "es_VE.UTF-8" inside my chroot env.
#i already solve with the follow commands :
Code:cd "/tmp/sdg2/minchr"
mkdir -p "./usr/lib64/locale"
cp -rf "/usr/lib64/locale/en_US"* "./usr/lib64/locale/"
cp -rf "/usr/lib64/locale/es_VE"* "./usr/lib64/locale/"#basically i need learn how make a very custom "initramfs" :v . But i hope this can be useful to another user.
Attached Thumbnails
#Note normally i do this on /boot partition for put some tools there.
#But some things i don't know to do.
#I will go procede on USB Pendrive with the follow partitions :
Code:fdisk -l /dev/sdgQuote:
Disco /dev/sdg: 58,59 GiB, 62914560000 bytes, 122880000 sectores Modelo de disco: ProductCode Unidades: sectores de 1 * 512 = 512 bytes Tamaio de sector (ligico/fisico): 512 bytes / 512 bytes Tamaio de E/S (minimo/iptimo): 512 bytes / 512 bytes Tipo de etiqueta de disco: dos Identificador del disco: 0x4f8c48af Disposit. Inicio Comienzo Final Sectores Tamaio Id Tipo /dev/sdg1 2048 67119103 67117056 32G 7 HPFS/NTFS/exFAT /dev/sdg2 * 67119104 71321599 4202496 2G 83 Linux /dev/sdg3 71321600 122879999 51558400 24,6G 83 Linux |
#i already had set "boot" flag on my "Inicio" (boot) partition.
#On my case ummount first
Code:su -c "umount /dev/sdg2" root#Make the directory when i wish do this :
Code:mkdir -p /tmp/sdg2#Mount in that directory
Code:su -c "mount /dev/sdg2 /tmp/sdg2" root#Enter in the dir and make minchr directory
Code:cd /tmp/sdg2 ; mkdir minchr#Make sub-directories for the arquitectures i want to use
Code:mkdir 32Bits ; mkdir 64Bits#I Enter in the directory called 64Bits
Code:cd 64Bits#i make directories "bin" and "lib64"
Code:mkdir bin ; mkdir lib64#I Copy /bin/bash, the basic program to work with commands
#To my minimal chroot env, binary executables directory
#"/tmp/sdg2/minchr/64Bits/bin"
Code:cp -a /bin/bash ./bin/#I use "ldd" command to list libraries used by "/bin/bash"
Code:ldd /bin/bashQuote:
linux-vdso.so.1 (0x00007fffdd367000) libtinfo.so.6 => /lib64/libtinfo.so.6 (0x00007f813dfca000) libdl.so.2 => /lib64/libdl.so.2 (0x00007f813dfc5000) libc.so.6 => /lib64/libc.so.6 (0x00007f813dde6000) /lib64/ld-linux-x86-64.so.2 (0x00007f813e04f000) |
Code:cp /lib64/libtinfo.so.6 ./lib64/
cp /lib64/libdl.so.2 ./lib64/
cp /lib64/libc.so.6 .#First check what is the real file of
Code:readlink /lib64/ld-linux-x86-64.so.2 ; readlink /lib64/libc.so.6Quote:
ld-2.33.so |
Code:whereis ld-2.33.soQuote:
ld-2.33.so: /lib/ld-2.33.so /lib64/ld-2.33.so |
Code:cd "./lib64"#Copy the "ld-2.33.so" file
Code:cp /lib64/ld-2.33.so ./lib64/#Create simbolic links :
Code:ln -sf "ld-2.33.so" "ld-linux-x86-64.so.2"#By experience, I know to have a working textual env the "ncurses" libs are need
Code:locate ncurses | grep ".so" | grep "/lib64" | grep -v "/usr"Quote:
/lib64/libncurses.so.5 /lib64/libncurses.so.5.9 /lib64/libncurses.so.6 /lib64/libncurses.so.6.3 /lib64/libncursesw.so.5 /lib64/libncursesw.so.5.9 /lib64/libncursesw.so.6 /lib64/libncursesw.so.6.3 |
Code:cp /lib64/libncurses.so.5.9 .
cp /lib64/libncurses.so.6.3 .
ln -sf libncurses.so.5.9 libncurses.so.5
ln -sf libncurses.so.6.3 libncurses.so.6# Test it :
Code:su #Enter your root password and then press enter.
cd "/tmp/sdg2/minchr" #Enter in the "root" of "working directory"
chroot "64Bits" #Use chroot on "64Bits" directory to enter in "chroot"Quote:
bash: warning: setlocale: LC_ALL: cannot change locale (es_VE.UTF-8) bash-5.1# |
#Normally in my "/bin" i put programs like :
* fsck (with all including fsck.exfat)
* mc
* joe, nano
* links2
* gpm
* ls
* lsblk
* blkid [i grab from /sbin/]
#i don't know what i should to not have any trouble with set locate like "es_VE.UTF-8" inside my chroot env.
#i already solve with the follow commands :
Code:cd "/tmp/sdg2/minchr"
mkdir -p "./usr/lib64/locale"
cp -rf "/usr/lib64/locale/en_US"* "./usr/lib64/locale/"
cp -rf "/usr/lib64/locale/es_VE"* "./usr/lib64/locale/"#basically i need learn how make a very custom "initramfs" :v . But i hope this can be useful to another user.
Attached Thumbnails