LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (https://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   Missing directories and bad permissions for $LFS (https://www.linuxquestions.org/questions/linux-from-scratch-13/missing-directories-and-bad-permissions-for-%24lfs-4175484502/)

Grimace78 11-13-2013 08:28 PM

Missing directories and bad permissions for $LFS
 
Could someone explain what could be going on here? I'm still kind of new to linux, but have made a bit of headway. The first 3 or 4 times this happened I just assumed I did something to mess it up, but I've been over the directions in detail at least three times (as well as restarting the project). I've read about HDD issues that could cause this, but I don't believe that to be the case at this time. I am planning to run some tools in dos tonight to doublecheck integrity regardless.
Quote:

donald@slowpoke:~$ echo $LFS

donald@slowpoke:~$ sudo bash
[sudo] password for donald:
bash: /usr/share/bash-completion/bash_completion: line 624: syntax error in conditional expression: unexpected token `('
bash: /usr/share/bash-completion/bash_completion: line 624: syntax error near `^(\'
bash: /usr/share/bash-completion/bash_completion: line 624: ` if [[ $cur =~ ^(\$\{?)([A-Za-z0-9_]*)$ ]]; then'
root@slowpoke:~# chown -v lfs $LFS/tools
chown: cannot dereference ‘/tools’: No such file or directory
failed to change ownership of ‘/tools’ from 32555 to lfs
root@slowpoke:~# mkdir -v $LFS/tools
mkdir: cannot create directory ‘/tools’: File exists
root@slowpoke:~# cd /mnt/lfs
root@slowpoke:/mnt/lfs# ls
sources
root@slowpoke:/mnt/lfs# mkdir -v $LFS/tools
mkdir: cannot create directory ‘/tools’: File exists
root@slowpoke:/mnt/lfs# ln -sv $LFS/tools /
ln: failed to create symbolic link ‘/tools’: File exists
root@slowpoke:/mnt/lfs# chown -v lfs $LFS/tools
chown: cannot dereference ‘/tools’: No such file or directory
failed to change ownership of ‘/tools’ from 32551 to lfs
root@slowpoke:/mnt/lfs# echo $LFS

root@slowpoke:/mnt/lfs# export echo $LFS
root@slowpoke:/mnt/lfs# export LFS=/mnt/lfs
root@slowpoke:/mnt/lfs# echo $LFS
/mnt/lfs
root@slowpoke:/mnt/lfs# ls
sources
root@slowpoke:/mnt/lfs#
Any insight would be apprecitated.

ReaperX7 11-13-2013 09:06 PM

Okay let's start at the beginning:

Question 1: What distribution are using using as a base to build LFS off from?

This question might solve everything now and yet to come for you if answered correctly. Most distributions aren't out of the box LFS friendly, even if you have the appropriate packages.

Question 2: Judging from how you've progressed up till this point, and you should be posting the chapter you get stuck on BTW, it seems you may have exited as the LFS user and attempted to regain access as root.

Good tip: Often at times sudo is not friendly with building LFS, and you should be logged in as root. If you can't login as root, or entering command "su" does not grant you access to the superuser/root account through the shell, we can help you fix this.

Grimace78 11-13-2013 10:08 PM

Quote:

Originally Posted by ReaperX7 (Post 5064010)
Okay let's start at the beginning:

Question 1: What distribution are using using as a base to build LFS off from?

This question might solve everything now and yet to come for you if answered correctly. Most distributions aren't out of the box LFS friendly, even if you have the appropriate packages.

Question 2: Judging from how you've progressed up till this point, and you should be posting the chapter you get stuck on BTW, it seems you may have exited as the LFS user and attempted to regain access as root.

Good tip: Often at times sudo is not friendly with building LFS, and you should be logged in as root. If you can't login as root, or entering command "su" does not grant you access to the superuser/root account through the shell, we can help you fix this.

I am using Ubuntu 13.10 64bit. As far as progress in the book, I'm @ 5.4. Binutils-2.23.2 - Pass 1.

You're right about exiting the LFS user back into root too. I was getting permission denied when trying to create directories on the lfs partition as $LFS and didn't know what else to try.

It was early enough in the project that I just dismounted the lfs partition, re-formatted the partition, then started over after installing bash 3.2 which I thought might have something to do with the permissions problem. Things were starting to get a lot smoother project wise until the directories disappeared.

Edit: I'll be sure not to use sudo anymore. I have just been avoiding it because it has caused me problems with permissions in the past.

ReaperX7 11-13-2013 10:43 PM

Best of luck on the build. Just a suggestion/recommendation, but I would recommend building and installing the software listed in LFS Chapter 9.3 as well as completing Section 2 - Chapter 3 of the BLFS book.

If you want a good tip, install them in this order (list may include dependencies):

dhcp-client or dhcpcd
GPM
sudo (you'll need it for installing some packages in X and KDE)
openssl
openssh
wget
lynx (build with --with-ssl)
Certificate Authority Certificates
LVM2
parted

This will give you a well rounded base system that expands the usefulness of LFS into a proper useful OS that's still minimal, yet well rounded and functional.

From there, you have BLFS and you can virtually start anywhere, though I do recommend installing X-Windows as some dependencies in some files will ask for libraries found in X-Windows.

Just a suggestion, but try to avoid PAM unless you absolutely need it.

Lastly, since this is your first LFS possibly, always build recommended dependencies even if not required. They will help with problem solving if you run into any.

Grimace78 11-13-2013 11:05 PM

Quote:

Originally Posted by ReaperX7 (Post 5064040)
Best of luck on the build. Just a suggestion/recommendation, but I would recommend building and installing the software listed in LFS Chapter 9.3 as well as completing Section 2 - Chapter 3 of the BLFS book.

If you want a good tip, install them in this order (list may include dependencies):

dhcp-client or dhcpcd
GPM
sudo (you'll need it for installing some packages in X and KDE)
openssl
openssh
wget
lynx (build with --with-ssl)
Certificate Authority Certificates
LVM2
parted

This will give you a well rounded base system that expands the usefulness of LFS into a proper useful OS that's still minimal, yet well rounded and functional.

From there, you have BLFS and you can virtually start anywhere, though I do recommend installing X-Windows as some dependencies in some files will ask for libraries found in X-Windows.

Just a suggestion, but try to avoid PAM unless you absolutely need it.

Lastly, since this is your first LFS possibly, always build recommended dependencies even if not required. They will help with problem solving if you run into any.

Thank you for all the information, and yes it is my first LFS build. My long term goal other than really learning about linux is to have a custom operating system (and I'm still going to go back and install slackware at some point just because...), so I will definitely being looking into what you suggested.

I am curious though if you had some suggestions on how to fix the problems that I posted up (other than not repeating the same mistakes).

Firerat 11-13-2013 11:17 PM

go back to the start of the book, read it

pay special attention to chapter 4

ReaperX7 11-13-2013 11:24 PM

Quote:

Originally Posted by Grimace78 (Post 5064046)
Thank you for all the information, and yes it is my first LFS build. My long term goal other than really learning about linux is to have a custom operating system (and I'm still going to go back and install slackware at some point just because...), so I will definitely being looking into what you suggested.

I am curious though if you had some suggestions on how to fix the problems that I posted up (other than not repeating the same mistakes).

Sometimes it all depends on how you shift through which user account you're on as to how permissions behave. Usually root will have full permissions, but creating directories and files as root can have problems, which is why they suggest you create /sources and /tools as the LFS user in the host system rather than root. This way they get built as a user account, but a user account with admin level permissions, basically a power user.

I've ran into issues also when I built using SalixOS with permissions. It just happens sometimes even though they're unintended. If you get through the initial prelim system without stopping, usually you'll never have to worry about permissions as afterwards most work will be done as root rather than the lfs user.

The best point, take your time and read each chapter carefully before proceeding as you'll often see extra hints such as optional build flags you may want (such being with openssl support in lynx is mentioned in an afterword rather than the main because it's optional), and then download, unpack, build, and install.

Trust me, you'll have a good experience with LFS. And when you need help, just ask. There are more than enough friendly people here at LQ with a vast wealth of knowledge who are willing to help you out, step by step...

...and the majority of us won't be like that guy above rudely thumping a book.

Grimace78 11-13-2013 11:44 PM

Quote:

Originally Posted by ReaperX7 (Post 5064051)
Sometimes it all depends on how you shift through which user account you're on as to how permissions behave. Usually root will have full permissions, but creating directories and files as root can have problems, which is why they suggest you create /sources and /tools as the LFS user in the host system rather than root. This way they get built as a user account, but a user account with admin level permissions, basically a power user.

I've ran into issues also when I built using SalixOS with permissions. It just happens sometimes even though they're unintended. If you get through the initial prelim system without stopping, usually you'll never have to worry about permissions as afterwards most work will be done as root rather than the lfs user.

The best point, take your time and read each chapter carefully before proceeding as you'll often see extra hints such as optional build flags you may want (such being with openssl support in lynx is mentioned in an afterword rather than the main because it's optional), and then download, unpack, build, and install.

Trust me, you'll have a good experience with LFS. And when you need help, just ask. There are more than enough friendly people here at LQ with a vast wealth of knowledge who are willing to help you out, step by step...

...and the majority of us won't be like that guy above rudely thumping a book.

Allright. I'll reread it and comment back on my status as soon as I am back on track. Thanks again for the information.

Grimace78 11-30-2013 09:41 AM

Does anyone think it would be a bad thing to try a switch to Arch Linux first and then come back to LFS? I've been extra "special" lately, and was thinking that it might be a more gradual learning curve...

stoat 11-30-2013 01:11 PM

Quote:

Originally Posted by Grimace78

Does anyone think it would be a bad thing to try a switch to Arch Linux first and then come back to LFS?

I was using Arch when I first started using LFS.

Quote:

Originally Posted by Grimace78

I am curious though if you had some suggestions on how to fix the problems that I posted up (other than not repeating the same mistakes).

All those commands in post #1 that attempted to create, link, or list $LFS/tools failed because $LFS was not set. The /mnt/lfs/tools directory does not exist. There may be a directory or link named /tools in your Ubuntu root directory, but there is no directory named /tools in /mnt/lfs.

I recommend, as Ubuntu root, with the partition mounted...

1. Create /mnt/lfs/tools (section 4.2).
2. If an empty directory named /tools was accidentally created in the Ubuntu root directory, then delete it.
3. Create the link in the Ubuntu root directory to /mnt/lfs/tools (section 4.2).

Then, if you created the lfs user (section 4.3), granted it access to /tools and /sources (section 4.3), and created its .bash_profile and .bashrc files (section 4.4)...

1. Somehow log in as the lfs user and/or start a new shell as lfs (I forgot which for Ubuntu).
2. Check that $LFS echoes "/mnt/lfs".
3. Begin again Binutils-2.23.2 - Pass 1.

Stay in that shell as the lfs user to the end of chapter 5. If you stop and log out while still working in chapter 5, you only have to start a new shell as the lfs user to resume work.

Later, in chapters 6-9, stopping and resuming is slightly more complicated because you will be working in chroot then. But the steps for that are in the book for when that time comes.


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