LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware > Slackware - ARM
User Name
Password
Slackware - ARM This forum is for the discussion of Slackware ARM.

Notices

Reply
 
Search this Thread
Old 12-30-2013, 06:13 AM   #1
louigi600
Member
 
Registered: Dec 2013
Location: Italy
Distribution: Slackware
Posts: 216

Rep: Reputation: 9
odd thing happening when I install packages in a chroot


On one of my GoFlexNet I've a folder, on the sata software raid mirror, where I keep a slackware arm 14.1 developement environment for compiling things.

In order to use it I just usually descent into the tree and type "chroot ."
I've noticed that when I use slackpkg from there to install packages the links are not created but the rest is in place. I work around that by extracting the doinst script and run it manually.
As to my understanding slackpkg uses installpkg internally to do the package installation, I've not yet checked out if installpkg does the same but none the less this thing seems odd.
Anyone else had the same thing ?
 
Old 12-30-2013, 11:18 AM   #2
drmozes
Slackware Contributor
 
Registered: Apr 2008
Location: Surrey, England
Distribution: Slackware
Posts: 170

Rep: Reputation: 129Reputation: 129
Quote:
Originally Posted by louigi600 View Post
On one of my GoFlexNet I've a folder, on the sata software raid mirror, where I keep a slackware arm 14.1 developement environment for compiling things.

In order to use it I just usually descent into the tree and type "chroot ."
I've noticed that when I use slackpkg from there to install packages the links are not created but the rest is in place. I work around that by extracting the doinst script and run it manually.
As to my understanding slackpkg uses installpkg internally to do the package installation, I've not yet checked out if installpkg does the same but none the less this thing seems odd.
Anyone else had the same thing ?
There have been a couple of issues with slackpkg. I don't use slackpkg myself and don't have time to try and reproduce it.
The only thing that's different about pkgtools on ARM is that they have been patched to improve the performance on ARM:
http://ftp.arm.slackware.com/slackwa...g.speedup.diff
The other scripts are similarly patched - check the piece of sed at the bottom as this might be the culprit. I don't know if some how slackpkg is interfering with this (I can't think of a reason why it should, but I don't know how slackpkg works). The patches themselves have been around since 2006 and haven't caused any issues, but I can't think of anything else that'd be causing slackpkg to fail on occasions.
 
Old 12-30-2013, 12:46 PM   #3
ponce
Senior Member
 
Registered: Aug 2004
Location: Pisa, Italy
Distribution: Slackware
Posts: 2,479

Rep: Reputation: 905Reputation: 905Reputation: 905Reputation: 905Reputation: 905Reputation: 905Reputation: 905Reputation: 905
I don't think it's related (as you're talking about a chroot, so the new / of the filesystem should be the one you chrooted to and the pkgtools utilities/slackpkg should work fine), but in some spots slackpkg doesn't honor the $ROOT environment variable (unlike the pkgtools utilities), so I prepared a patch some time ago that I sent to Pat but it never got included (maybe because he was waiting for Piter to review it).

I'll attach it here, if you want to try it (I'm using it to create LXC containers with slackpkg's templates)
Code:
diff -Naur slackpkg-2.82.0.orig/usr/libexec/slackpkg/core-functions.sh slackpkg-2.82.0/usr/libexec/slackpkg/core-functions.sh
--- slackpkg-2.82.0.orig/usr/libexec/slackpkg/core-functions.sh	2013-09-17 22:36:36.000000000 +0200
+++ slackpkg-2.82.0/usr/libexec/slackpkg/core-functions.sh	2013-12-30 18:40:34.046098251 +0100
@@ -549,9 +549,9 @@
 
 	grep -vE "(^#|^[[:blank:]]*$)" ${CONF}/blacklist > ${TMPDIR}/blacklist
 	if echo $CMD | grep -q install ; then
-		ls -1 /var/log/packages/* | awk -f /usr/libexec/slackpkg/pkglist.awk > ${TMPDIR}/tmplist
+		ls -1 $ROOT/var/log/packages/* | awk -f /usr/libexec/slackpkg/pkglist.awk > ${TMPDIR}/tmplist
 	else
-		ls -1 /var/log/packages/* | awk -f /usr/libexec/slackpkg/pkglist.awk | applyblacklist > ${TMPDIR}/tmplist
+		ls -1 $ROOT/var/log/packages/* | awk -f /usr/libexec/slackpkg/pkglist.awk | applyblacklist > ${TMPDIR}/tmplist
 	fi
 	cat ${WORKDIR}/pkglist | applyblacklist > ${TMPDIR}/pkglist
 
@@ -768,7 +768,7 @@
 	    # First is the package already installed?
 	    # Amazing what a little sleep will do
 	    # exclusion is so much nicer :)
-	    INSTPKG=$(ls -1 /var/log/packages | \
+	    INSTPKG=$(ls -1 $ROOT/var/log/packages | \
 		grep -e "^${BASENAME}-[^-]\+-\(${ARCH}\|fw\|noarch\)-[^-]\+")
 
 		# INSTPKG is local version
@@ -1135,14 +1135,14 @@
 
 	[ "$SPINNING" = "off" ] || spinning ${TMPDIR}/waiting &
 
-	for i in $(ls -1 /var/log/packages | \
+	for i in $(ls -1 $ROOT/var/log/packages | \
 		egrep -- "^.*-(${ARCH}|fw|noarch)-[^-]+-upgraded"); do
 		REVNAME=$(echo ${i} | awk -F'-upgraded' '{ print $1 }')
-		mv /var/log/packages/${i} /var/log/packages/${REVNAME}
-		mv /var/log/scripts/${i} /var/log/scripts/${REVNAME}
+		mv $ROOT/var/log/packages/${i} $ROOT/var/log/packages/${REVNAME}
+		mv $ROOT/var/log/scripts/${i} $ROOT/var/log/scripts/${REVNAME}
 	done
 	
-	ls -1 /var/log/packages | egrep "^.*-(${ARCH}|fw|noarch)-[^-]+$" | \
+	ls -1 $ROOT/var/log/packages | egrep "^.*-(${ARCH}|fw|noarch)-[^-]+$" | \
 				  batchcutpkg | sort > $TMPDIR/list1 
 	cat $TMPDIR/list1 | uniq > $TMPDIR/list2
 	FILES="$(diff $TMPDIR/list1 $TMPDIR/list2 | grep '<' | cut -f2 -d\ )"
@@ -1159,12 +1159,12 @@
 
 	if [ "$DOUBLEFILES" != "" ]; then
 		echo -e "\
-You have a broken /var/log/packages - with two versions of the same package.\n\
+You have a broken $ROOT/var/log/packages - with two versions of the same package.\n\
 The list of packages duplicated in your machine are shown below, but don't\n\
 worry about this list - when you select your action, slackpkg will show a\n\
 better list:\n"
 		for i in $DOUBLEFILES ; do
-			ls -1 /var/log/packages |\
+			ls -1 $ROOT/var/log/packages |\
 				egrep -i -- "^${i}-[^-]+-(${ARCH}|fw|noarch)-"
 		done
 		echo -ne "\n\
@@ -1179,7 +1179,7 @@
 			;;
 			R|r)
 				for i in $DOUBLEFILES ; do
-					FILE=$(ls -1 /var/log/packages |\
+					FILE=$(ls -1 $ROOT/var/log/packages |\
 						egrep -i -- "^${i}-[^-]+-(${ARCH}|fw|noarch)-")
 					FILES="$FILES $FILE"
 				done
@@ -1299,7 +1299,7 @@
 	touch $TMPDIR/waiting
 	echo -e "\tGenerating slackware installed package list (this may take a while) \c"
 	[ "$SPINNING" = "off" ] || spinning ${TMPDIR}/waiting &
-	for i in /var/log/packages/* ; do 
+	for i in $ROOT/var/log/packages/* ; do 
 		PKGNAME=$( cutpkg $(basename $i))
 		grep -q " $PKGNAME " ${WORKDIR}/pkglist && \
 			echo $PKGNAME >> $TMPDIR/$TEMPLATE.work
diff -Naur slackpkg-2.82.0.orig/usr/libexec/slackpkg/functions.d/dialog-functions.sh slackpkg-2.82.0/usr/libexec/slackpkg/functions.d/dialog-functions.sh
--- slackpkg-2.82.0.orig/usr/libexec/slackpkg/functions.d/dialog-functions.sh	2010-05-02 01:10:33.000000000 +0200
+++ slackpkg-2.82.0/usr/libexec/slackpkg/functions.d/dialog-functions.sh	2013-12-30 18:40:34.047098251 +0100
@@ -20,7 +20,7 @@
 		rm -f $TMPDIR/dialog.tmp
 		
 		if [ "$2" = "upgrade" ]; then
-			ls -1 /var/log/packages > $TMPDIR/tmplist
+			ls -1 $ROOT/var/log/packages > $TMPDIR/tmplist
 			for i in $1; do
 				BASENAME=$(cutpkg $i)
 				PKGFOUND=$(grep -m1 -e "^${BASENAME}-[^-]\+-\(noarch\|fw\|${ARCH}\)" $TMPDIR/tmplist)

Last edited by ponce; 12-30-2013 at 02:46 PM. Reason: clarified that with a chroot pkgtools/slackpkg should work fine
 
Old 12-30-2013, 03:46 PM   #4
drmozes
Slackware Contributor
 
Registered: Apr 2008
Location: Surrey, England
Distribution: Slackware
Posts: 170

Rep: Reputation: 129Reputation: 129
Quote:
Originally Posted by ponce View Post
I don't think it's related (as you're talking about a chroot, so the new / of the filesystem should be the one you chrooted to and the pkgtools utilities/slackpkg should work fine)
But since he's already chrooted, the $ROOT setting is not relevant and would not be used or required.
 
Old 12-31-2013, 03:13 AM   #5
louigi600
Member
 
Registered: Dec 2013
Location: Italy
Distribution: Slackware
Posts: 216

Original Poster
Rep: Reputation: 9
I've an idea: I'll run slackpkg after having put a -x flag in the interpreter line ... this might give me a suggestion as to why something odd is going on at the time doinst scrip is executed.
 
Old 01-01-2014, 03:58 AM   #6
louigi600
Member
 
Registered: Dec 2013
Location: Italy
Distribution: Slackware
Posts: 216

Original Poster
Rep: Reputation: 9
I did that but could not spot anything that would explain the broken links.
I did notice though that installpkg looks at /proc/self :
Code:
root@nas:/tmp# installpkg  slackkit-1.02-arm-1.txz 
Verifying package slackkit-1.02-arm-1.txz.
Installing package slackkit-1.02-arm-1.txz:
PACKAGE DESCRIPTION:
# slackkit (Slackware ARM development kit) 
#
# slackkit contains the required toolkit to build packages for 
# Slackware ARM.
#
# The tookit was developed by Stuart Winter.
# 
Executing install script for slackkit-1.02-arm-1.txz.
sh: /proc/self/fd/0: No such file or directory
Package slackkit-1.02-arm-1.txz installed.

root@nas:/tmp#
and in my case in the chroot it's not mounted as I just do "chroor ." and nothing else.
I think this has a bad influence in this part of the installpkg script (which in turn is used by slackpkg):
Code:
  if [ -f $ROOT/install/doinst.sh ]; then
    if [ "$MODE" = "install" ]; then
      echo "Executing install script for $(basename $package)."
    fi
    #    ( cd $ROOT/ ; sh install/doinst.sh -install; )
    # This tonne of sed is to avoid spawning subshells which is slow on ARM:
    # the /proc/self stuff is because I couldn't work out how to specify '-insta
ll' as an argument
    # when piping code into the shell.
    ( cd $ROOT/ ; sed -e's?^( cd \([^;]*\);\(.*\) )$?pushd \1 \&\> /dev/null ; \
2 ; popd \&\> /dev/null?g ' install/doinst.sh | sh /proc/self/fd/0 -install ; )
  fi
 
Old 01-01-2014, 04:05 AM   #7
ponce
Senior Member
 
Registered: Aug 2004
Location: Pisa, Italy
Distribution: Slackware
Posts: 2,479

Rep: Reputation: 905Reputation: 905Reputation: 905Reputation: 905Reputation: 905Reputation: 905Reputation: 905Reputation: 905
to see if it's that, you can mount proc in the chroot too
Code:
mount -t proc proc /your/chroot/proc
in the chroots I use, I bind mount also /dev and /sys
Code:
mount -o bind /dev /your/chroot/dev
mount -o bind /sys /your/chroot/sys
 
Old 01-01-2014, 12:26 PM   #8
louigi600
Member
 
Registered: Dec 2013
Location: Italy
Distribution: Slackware
Posts: 216

Original Poster
Rep: Reputation: 9
I'm pretty much certain it's that without trying ... but just to make sure I'll try binding all 3
Code:
root@nas:/mnt/exports/developement/slackware_arm_14.1_dev# mount -o bind /dev ./dev
root@nas:/mnt/exports/developement/slackware_arm_14.1_dev# mount -o bind /sys ./sys
root@nas:/mnt/exports/developement/slackware_arm_14.1_dev# mount -o bind /proc ./proc
root@nas:/mnt/exports/developement/slackware_arm_14.1_dev# chroot .
root@nas:/# cd /tmp
root@nas:/tmp# installpkg  slackkit-1.02-arm-1.txz 
Verifying package slackkit-1.02-arm-1.txz.
Installing package slackkit-1.02-arm-1.txz:
PACKAGE DESCRIPTION:
# slackkit (Slackware ARM development kit) 
#
# slackkit contains the required toolkit to build packages for 
# Slackware ARM.
#
# The tookit was developed by Stuart Winter.
# 
Executing install script for slackkit-1.02-arm-1.txz.
Package slackkit-1.02-arm-1.txz installed.

root@nas:/tmp#
That looks like it's no longer complaining about /proc/self
I reinstald libmpc via slackpkg and the links seem to be right this time.


Not sure if I should have them in fstab or make a script to do it each time I want to use the chroot environment.

Last edited by louigi600; 01-01-2014 at 12:30 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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] weird thing is happening for -f switch sysmicuser Linux - Newbie 24 03-03-2012 07:42 AM
[SOLVED] Weird thing happening to my computer after installation dsplayer14 Slackware - Installation 4 11-12-2011 12:26 PM
Weird thing happening with graphics after update MTK358 Linux - General 2 04-11-2010 09:35 AM
Weird thing happening with GTK apps lancelott *BSD 0 06-22-2004 04:27 PM
Something very odd is happening... juagut Linux - Software 6 08-29-2001 09:31 PM


All times are GMT -5. The time now is 09:06 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration