LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices


Reply
  Search this Thread
Old 04-17-2014, 12:14 PM   #16
Luridis
Member
 
Registered: Mar 2014
Location: Texas
Distribution: LFS 9.0 Custom, Merged Usr, Linux 4.19.x
Posts: 616

Rep: Reputation: 167Reputation: 167

If I was going this route, I'd handle it something like this:

Build LFS base.
Build the packager dependencies.
Build the package manager.
Boot from a LiveCD and tarball /

You then have your base dependencies, build tools are in place and a functional kernel. This is basically how Gentoo does it with their Stage 3 tarball.

After this you can try to decouple and isolate some of the earlier packages, which might work with anything that you can rebuild in place like Grub or Sysklogd. But, I don't think you can get much lower than this. For instance, I don't think it's possible to swap out libc at run-time, at least without swapping anything else that's linked to it. Maybe that's possible running on a ram-disk with a statically linked kernel and e2fsprogs/util-linux, but that's almost a chroot anyway, and it sounds far more precarious. The same can be said for the sanitized headers, you could change them but the first package built against the new one could very well flip out at libc.

If you look at the packages in the base LFS build, and then subtract the components of the toolchain and the kernel itself... What is left is essentially all version-interdependent software, if any one of them changes just a little two much, all kinds of things can start breaking. I mean, what's the chances of getting anything built or installed if Sed isn't working?

Go download a base Gentoo and get it built and running. Then just try changing LANG and watch what happens. That might give you some insight as to how far down you can make a change before it starts rebuilding world.
 
Old 04-17-2014, 05:29 PM   #17
stefan1959
Member
 
Registered: Feb 2006
Posts: 34

Rep: Reputation: 1
Quote:
Originally Posted by Luridis View Post
If I was going this route, I'd handle it something like this:

Build LFS base.
Build the packager dependencies.
Build the package manager.
Boot from a LiveCD and tarball /

You then have your base dependencies, build tools are in place and a functional kernel. This is basically how Gentoo does it with their Stage 3 tarball.

After this you can try to decouple and isolate some of the earlier packages, which might work with anything that you can rebuild in place like Grub or Sysklogd. But, I don't think you can get much lower than this. For instance, I don't think it's possible to swap out libc at run-time, at least without swapping anything else that's linked to it. Maybe that's possible running on a ram-disk with a statically linked kernel and e2fsprogs/util-linux, but that's almost a chroot anyway, and it sounds far more precarious. The same can be said for the sanitized headers, you could change them but the first package built against the new one could very well flip out at libc.

If you look at the packages in the base LFS build, and then subtract the components of the toolchain and the kernel itself... What is left is essentially all version-interdependent software, if any one of them changes just a little two much, all kinds of things can start breaking. I mean, what's the chances of getting anything built or installed if Sed isn't working?

Go download a base Gentoo and get it built and running. Then just try changing LANG and watch what happens. That might give you some insight as to how far down you can make a change before it starts rebuilding world.
Maybe a new book for LFS with a package manager

Steve
 
Old 04-17-2014, 05:34 PM   #18
ReaperX7
LQ Guru
 
Registered: Jul 2011
Location: California
Distribution: Slackware64-15.0 Multilib
Posts: 6,554
Blog Entries: 15

Rep: Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097
I highly doubt B/LFS will ever get a built-in package manager other than the combination of pkg-config and Make. There's more than enough documentation in the book that having a package manager is next to useless for someone knowledgeable enough.

Package Managers are like auto-dependency resolution. Useful tools only for the unskilled... IMO.

Extra work would have to go into the book to perform such a feet and I doubt the maintainers will ever do such a thing.

One package management technique called FakeRoot is hinted at by the book, but is not officially supported. FakeRoot is virtually a tarball drop-in package technique that leaves post-install and setup up to the maintainer.

Last edited by ReaperX7; 04-17-2014 at 05:37 PM.
 
Old 04-17-2014, 07:55 PM   #19
stefan1959
Member
 
Registered: Feb 2006
Posts: 34

Rep: Reputation: 1
Quote:
Originally Posted by ReaperX7 View Post
I highly doubt B/LFS will ever get a built-in package manager other than the combination of pkg-config and Make. There's more than enough documentation in the book that having a package manager is next to useless for someone knowledgeable enough.

Package Managers are like auto-dependency resolution. Useful tools only for the unskilled... IMO.

Extra work would have to go into the book to perform such a feet and I doubt the maintainers will ever do such a thing.

One package management technique called FakeRoot is hinted at by the book, but is not officially supported. FakeRoot is virtually a tarball drop-in package technique that leaves post-install and setup up to the maintainer.
I'm not real interested in it but I did see in the hints http://www.linuxfromscratch.org/hint...using_trip.txt
But it very old, not sure if its any use.
Trip look like it was written for LFS, I haven't seen any other reference to it.

Steve
 
Old 04-19-2014, 11:37 AM   #20
Lennie
Member
 
Registered: Aug 2012
Location: Sweden
Distribution: LFS, built with pacman
Posts: 374

Rep: Reputation: 85
I use Pacman and I install it and its dependencies in the toolchain, in chapter 5 directly after the last package from the book. Until libarchive I just add: zlib, openssl and libarchive.

I think it's great to have a package manager. I run the same system on 2 machines, and I build new packages on any of them and then just put in my dropbox and install on the other. Actually, I don't see my system as an LFS-system, I see it as my own distro. I keep it updated, and a package manager also makes it easy to downgrade if something goes wrong.

Last edited by Lennie; 04-19-2014 at 11:39 AM.
 
Old 04-21-2014, 11:36 AM   #21
moisespedro
Senior Member
 
Registered: Nov 2013
Location: Brazil
Distribution: Slackware
Posts: 1,223

Original Poster
Rep: Reputation: 195Reputation: 195
Quote:
Originally Posted by ReaperX7 View Post
I highly doubt B/LFS will ever get a built-in package manager other than the combination of pkg-config and Make. There's more than enough documentation in the book that having a package manager is next to useless for someone knowledgeable enough.

Package Managers are like auto-dependency resolution. Useful tools only for the unskilled... IMO.

Extra work would have to go into the book to perform such a feet and I doubt the maintainers will ever do such a thing.

One package management technique called FakeRoot is hinted at by the book, but is not officially supported. FakeRoot is virtually a tarball drop-in package technique that leaves post-install and setup up to the maintainer.
I think being organized never hurts and simple package managers like crux's one really helps.
 
Old 04-21-2014, 03:13 PM   #22
ReaperX7
LQ Guru
 
Registered: Jul 2011
Location: California
Distribution: Slackware64-15.0 Multilib
Posts: 6,554
Blog Entries: 15

Rep: Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097
It can, but often it's how you implement it.

When I build a base LFS system, I incorporate everything from the LFS book, plus the recommended additions at the end in the Rebooting chapter as well as some of my own:

Lynx
GPM
dhcp-client
sudo
openssh
openssl
gnutls
jfsutils
gptfdisk
parted
LVM2
xfsprogs
mdadm
nettle
libtasn1
Certificate Authority Certificates
reiserfsprogs
pciutils
nano

After that, I create a tarball of the entire system, similar to a Gentoo Stage 3 tarball. This becomes my base OS to work from and reissue if and when needed.

Afterwards, make install and make uninstall manage everything else from the /usr/src directory. When errata releases are made, I then do a dependency track of the software and see what uses it, and then rebuild packages as needed.

It sounds like a lot of work, but its actually the opposite.
 
Old 04-21-2014, 03:37 PM   #23
moisespedro
Senior Member
 
Registered: Nov 2013
Location: Brazil
Distribution: Slackware
Posts: 1,223

Original Poster
Rep: Reputation: 195Reputation: 195
You just tar the whole / partition?
And by the way I am still writing the pkgfiles and building LFS. I just got home from holiday and I will keep writing them. For anyone interested on it: https://www.dropbox.com/sh/xbn54wwnehlnkzo/KjAGkjs2oc
 
Old 04-21-2014, 09:14 PM   #24
ReaperX7
LQ Guru
 
Registered: Jul 2011
Location: California
Distribution: Slackware64-15.0 Multilib
Posts: 6,554
Blog Entries: 15

Rep: Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097
Yep, I tarball the whole thing, but from a Live Disk to make sure everything is unmounted and unused.

That's basically a Stage 3 tarball. A finished base system tarballed to be backed-up/archived.

I actually don't run chapter 7 (post-installation and bootloader + kernel stuff) or later (including any specific other system only setup of packages) before backing up the archive. I just unpackage and install everything, finish Chapter 3 of BLFS, install my list of extras, then clean up the source archives and move them to /usr/src along with my build scripts. After that I backup the system with tar and save it to an offsite FTP.

My pre-setup involves:

Code:
mkdir -pv /mnt/lfs
export LFS=/mnt/lfs
mkfs.jfs /dev/<xxx>
mkswap /dev/<yyy>
mount -v -t jfs /dev/<xxx> $LFS
swapon /dev/<yyy>
Download the tarball to $LFS (/mnt/lfs)

Unpack it with:
Code:
tar -xvf stage3-lfs.tar.bz2
rm -rf stage3-lfs.tar.bz2
Now I enter with chroot

Code:
mount -v --bind /dev $LFS/dev
mount -vt devpts devpts $LFS/dev/pts -o gid=5,mode=620
mount -vt proc proc $LFS/proc
mount -vt sysfs sysfs $LFS/sys
mount -vt tmpfs tmpfs $LFS/run
if [ -h $LFS/dev/shm ]; then
  mkdir -pv $LFS/$(readlink $LFS/dev/shm)
fi
chroot "$LFS" /usr/bin/env -i              \
    HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
    PATH=/bin:/usr/bin:/sbin:/usr/sbin     \
    /bin/bash --login
Usually this is my next my post-setup I keep in a text file of what to do:

Code:
Run the following as root in chroot post-install:

tzselect
cp -v /usr/share/zoneinfo/<xxx> /etc/localtime
passwd root
/usr/bin/udevadm hwdb --update
bash /lib/udev/init-net-rules.sh
echo "<lfs>" > /etc/hostname

Generate these files:

cat > /etc/resolv.conf << "EOF"
# Begin /etc/resolv.conf

domain <Your Domain Name>
nameserver <IP address of your primary nameserver>
nameserver <IP address of your secondary nameserver>

# End /etc/resolv.conf
EOF

cat > /etc/hosts << "EOF"
# Begin /etc/hosts

127.0.0.1 <HOSTNAME.example.org> <HOSTNAME> localhost

# End /etc/hosts
EOF

cat > /etc/fstab << "EOF"
# Begin /etc/fstab

# file system  mount-point  type     options             dump  fsck
#                                                              order

/dev/<xxx>     /            <fff>    defaults            1     1
/dev/<yyy>     swap         swap     pri=1               0     0
proc           /proc        proc     nosuid,noexec,nodev 0     0
sysfs          /sys         sysfs    nosuid,noexec,nodev 0     0
devpts         /dev/pts     devpts   gid=5,mode=620      0     0
tmpfs          /run         tmpfs    defaults            0     0
devtmpfs       /dev         devtmpfs mode=0755,nosuid    0     0

# End /etc/fstab
EOF

cat > /etc/sysconfig/ifconfig.eth0 << "EOF"
ONBOOT="yes"
IFACE="eth0"
SERVICE="dhclient"
DHCP_START=""
DHCP_STOP=""

# Set PRINTIP="yes" to have the script print
# the DHCP assigned IP address
PRINTIP="no"

# Set PRINTALL="yes" to print the DHCP assigned values for
# IP, SM, DG, and 1st NS. This requires PRINTIP="yes".
PRINTALL="no"
EOF

Build the kernel using Slackware64 Current config from latest /testing or /sources with make oldconfig to update entries.

Generate a grub configuration using:

mkdir -pv /boot/grub
grubmkconfig -o /boot/grub/grub.cfg
grub-install /dev/<xxx>

Configure SSH

ssh-keygen
public_key="$(cat ~/.ssh/id_rsa.pub)"
ssh REMOTE_HOSTNAME "echo ${public_key} >> ~/.ssh/authorized_keys"
unset public_key
echo "PasswordAuthentication no" >> /etc/ssh/sshd_config
echo "ChallengeResponseAuthentication no" >> /etc/ssh/sshd_config

Now generate security certificates

certhost='http://mxr.mozilla.org'
certdir='/mozilla/source/security/nss/lib/ckfw/builtins'
url="$certhost$certdir/certdata.txt?raw=1"

wget --output-document certdata.txt $url
unset certhost certdir url
make-ca.sh
remove-expired-certs.sh certs
SSLDIR=/etc/ssl
install -d ${SSLDIR}/certs
cp -v certs/*.pem ${SSLDIR}/certs
c_rehash
install BLFS-ca-bundle*.crt ${SSLDIR}/ca-bundle.crt
ln -sv ../ca-bundle.crt ${SSLDIR}/certs/ca-certificates.crt
unset SSLDIR
rm -r certs ca-bundle*
Easier than the Gentoo handbook to use.

Last edited by ReaperX7; 04-21-2014 at 09:28 PM.
 
Old 04-22-2014, 04:34 AM   #25
moisespedro
Senior Member
 
Registered: Nov 2013
Location: Brazil
Distribution: Slackware
Posts: 1,223

Original Poster
Rep: Reputation: 195Reputation: 195
That seems interesting, thanks for the post Reaper
 
Old 04-22-2014, 12:46 PM   #26
Luridis
Member
 
Registered: Mar 2014
Location: Texas
Distribution: LFS 9.0 Custom, Merged Usr, Linux 4.19.x
Posts: 616

Rep: Reputation: 167Reputation: 167
I was thinking about this last night. It might be easier to use CLFS if you want to package everything. That was you can stay chrooted for everything, they even have multilib setups. If you make scripts to get in and out of your chroot quickly and are using VMWare you could do something along the lines of:

Dupe the chroot volume on the host.
Mount the chroot volume in the guest, chroot and build and install.
Exit the chroot back to the guest and mount the before-build chroot vol on another mount point.
Do a filesystem diff on the two of them to see everything touched.

If you could streamline most of that with scripting you could easily see everything done on even the largest and most complicated installs.
 
Old 04-22-2014, 02:18 PM   #27
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Linux From Scratch, Slackware64, Partedmagic
Posts: 3,129

Rep: Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852
Quote:
Originally Posted by Luridis View Post
...It might be easier to use CLFS if you want to package everything. That was you can stay chrooted for everything...
You don't have to use clfs to build a complete system in chroot, I built the entire system I am using now in a chroot, and in fact am building another one as I type.

You just have to be aware that some things are slightly different in chroot than not.
 
Old 04-22-2014, 02:30 PM   #28
moisespedro
Senior Member
 
Registered: Nov 2013
Location: Brazil
Distribution: Slackware
Posts: 1,223

Original Poster
Rep: Reputation: 195Reputation: 195
Quote:
Originally Posted by Keith Hedger View Post
You don't have to use clfs to build a complete system in chroot, I built the entire system I am using now in a chroot, and in fact am building another one as I type.

You just have to be aware that some things are slightly different in chroot than not.
I am doing that too
 
Old 04-22-2014, 03:16 PM   #29
ReaperX7
LQ Guru
 
Registered: Jul 2011
Location: California
Distribution: Slackware64-15.0 Multilib
Posts: 6,554
Blog Entries: 15

Rep: Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097
The same as well.

chroot is beneficial for a lot of things, but when you start getting into some of the post-installation setups, you have to be inside your machine because it's checking for drivers to be loaded in the memory and other kernel functions executing.

To be honest, I do often build X in chroot, but I've also switched to using a build script set to do it natively in LFS. It really helps with some of the setup as well that you're inside your actual loaded Linux environment.
 
Old 04-22-2014, 03:37 PM   #30
moisespedro
Senior Member
 
Registered: Nov 2013
Location: Brazil
Distribution: Slackware
Posts: 1,223

Original Poster
Rep: Reputation: 195Reputation: 195
I build as much as I can on a chroot environment, including X. Never got any issue so far.

EDIT: And for anyone that might be interested I am still writing the Pkgfiles (to use with pkgutils)
https://www.dropbox.com/sh/xbn54wwnehlnkzo/KjAGkjs2oc

Still have a lot to do but everything is going fine until now.
 
  


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
Update Manager , Synaptic package manager & dpkg: warning error massage sa3paleasm Linux - Software 1 08-07-2013 04:45 PM
How do I implement memory manager get and put (My malloc() ) mysterious88 Programming 3 11-16-2010 09:45 AM
install using package manager fails every time ServalSoft Mandriva 3 06-20-2009 05:38 AM
Poll: Yast Package Manager vs. Smart Package Manager in 10.1 agentchange SUSE / openSUSE 6 06-02-2006 08:29 AM
Time Released Package Manager? IKar Linux - Software 2 01-28-2005 05:48 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

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