LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 04-20-2022, 04:45 PM   #1
wazoox
LQ Newbie
 
Registered: Jun 2021
Location: France
Posts: 27

Rep: Reputation: Disabled
Setting up a chroot to make packages (Slackware 15)


To build clean packages using sbopkg, I've made a chroot. Install into a folder, then mount -B /dev, /dev/pts, /sys, /proc and finally chroot in the folder.

It seems to work fine at first glance, but all sort of programs fail in weird ways:

Code:
# vi /etc/hosts
DB_CREATE must be specified to create databases.
DB_CREATE must be specified to create databases.
DB_CREATE must be specified to create databases.
DB_CREATE must be specified to create databases.
ex/vi: Error: /var/tmp/vi.recover: Value too large for defined data type
ex/vi: Modifications not recoverable if the session fails
ex/vi: Error: /etc/hosts: No such file or directory
ex/vi: Error: /var/tmp/vi.recover: Value too large for defined data type
ex/vi: Modifications not recoverable if the session fails
ex/vi: Error: /tmp/vi.B270ls: No such file or directory
"vim" or "elvis" work fine, though. Weird...

Then it gets weirder:

Code:
# slackpkg update

No 'which' command found, please install it if you want to
use slackpkg.
"which" is there, though, but then it gets crazy:

Code:
# which ls
/usr/bin/ls
# which which
which: no which in (/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/lib/libexec/kf5:/usr/lib/qt5/bin)
What's really incredibly bizarre is that "strace which which" shows which finding itself in /bin and /usr/bin, but falling through... What the heck is happening?
 
Old 04-21-2022, 01:20 AM   #2
ozanbaba
Member
 
Registered: May 2003
Location: İzmir
Distribution: Slackware64 15.0 Multilib
Posts: 778

Rep: Reputation: 135Reputation: 135
I recommend you check the file permissions. It could be mixed up file permissions. For example, what is the permissions of which? Also how strace shows which fails to find which?
 
Old 04-21-2022, 02:35 AM   #3
wazoox
LQ Newbie
 
Registered: Jun 2021
Location: France
Posts: 27

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ozanbaba View Post
I recommend you check the file permissions. It could be mixed up file permissions. For example, what is the permissions of which? Also how strace shows which fails to find which?
I've thought about that, the permissions are fine:

Code:
$ ls -l /bin/which 
-rwxr-xr-x 1 root root 26132 févr. 14  2021 /bin/which*
$ ls -l chroot/bin/which 
-rwxr-xr-x 1 root root 26132 févr. 14  2021 chroot/bin/which*
I've also checked the permissions or chroot/, chroot/tmp, chroot/var/tmp...

Code:
$ ls -ld /
drwxr-xr-x 23 root root 4096 avril 15 16:01 //
$ ls -ld chroot/
drwxr-xr-x 20 root root 4096 janv. 25 00:20 chroot//
$ ls -ld chroot/tmp/
drwxrwxrwt 4 root root 61 avril 20 23:52 chroot/tmp//
$ ls -ld /tmp
drwxrwxrwt 412 root root 110592 avril 21 04:40 /tmp/
I've basically done everything as explained in https://docs.slackware.com/howtos:ge...ackware_chroot

That's really annoying!
 
Old 04-21-2022, 03:04 AM   #4
Windu
Member
 
Registered: Aug 2021
Distribution: Arch Linux, Debian, Slackware
Posts: 590

Rep: Reputation: Disabled
The size and timestamp of those 'which' binaries are matching with a Slackware 15.0 32bit installation, right? I.e. your Slackware OS as well as the chroot installation are both 32bit?
What is the exact command you are using to enter your chroot?
 
Old 04-21-2022, 03:11 AM   #5
wazoox
LQ Newbie
 
Registered: Jun 2021
Location: France
Posts: 27

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Windu View Post
The size and timestamp of those 'which' binaries are matching with a Slackware 15.0 32bit installation, right? I.e. your Slackware OS as well as the chroot installation are both 32bit?
Yep, both 32 bits.

Quote:
What is the exact command you are using to enter your chroot?
Simple:

Code:
su
cd chroot/
for F in proc sys dev dev/pts; do mount -B /$F $F ; done
chroot .
su -
I use exactly the same method with a Debian chroot on a Debian machine and it works perfectly fine. The "su -" in the end is the best way to set up a proper env.
 
Old 04-21-2022, 03:19 AM   #6
Gerard Lally
Senior Member
 
Registered: Sep 2009
Location: Leinster, IE
Distribution: Slackware, NetBSD
Posts: 2,181

Rep: Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763
Why cd to chroot and then bind mount proc sys and dev? Doesn't that mean you are not mounting the system's proc, sys and dev in the chroot?

Leave out the cd /chroot , then bind mount the system's proc, sys and dev to /chroot/$F , and finally do chroot /chroot .

Last edited by Gerard Lally; 04-21-2022 at 03:22 AM.
 
Old 04-21-2022, 03:55 AM   #7
wazoox
LQ Newbie
 
Registered: Jun 2021
Location: France
Posts: 27

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Gerard Lally View Post
Why cd to chroot and then bind mount proc sys and dev? Doesn't that mean you are not mounting the system's proc, sys and dev in the chroot?
Absolutely not, it works fine. That makes no difference at all to use absolute or relative mount points. I've made the test, and it's exactly the same.
 
Old 04-21-2022, 10:46 AM   #8
Windu
Member
 
Registered: Aug 2021
Distribution: Arch Linux, Debian, Slackware
Posts: 590

Rep: Reputation: Disabled
Your chroot directory, it is perhaps not an actual directory in your Slackware filesystem but a loop-mounted container, or perhaps a network-mounted filesystem?
 
Old 04-21-2022, 02:25 PM   #9
wazoox
LQ Newbie
 
Registered: Jun 2021
Location: France
Posts: 27

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Windu View Post
Your chroot directory, it is perhaps not an actual directory in your Slackware filesystem but a loop-mounted container, or perhaps a network-mounted filesystem?
No, that's the most ordinary folder in an XFS filesystem.
 
  


Reply

Tags
slackpkg, slackware 15.0



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] in chroot compiled programs do not work in chroot graphit Linux From Scratch 2 04-11-2010 03:04 AM
chroot to run hd-installed distro's programs from chroot in live distro? silencestone Linux - Software 0 10-12-2007 06:29 AM
sudo /usr/bin/chroot /home/chroot /bin/su - xxx| /bin/su: user xxx does not exist saavik Linux - General 3 07-04-2007 10:30 AM
mount command not working in chroot. and now chroot not working mohit.jain Linux From Scratch 5 07-14-2006 03:57 AM
to chroot or not to chroot complus Linux - Security 4 02-29-2004 04:07 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 02:57 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