linux from scratch backup doesnt boot properly after restoration
Linux From ScratchThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
linux from scratch backup doesnt boot properly after restoration
I made a tar backup of the LFS partition after completing the LFS 8.4 book, while doing BLFS I messed up somewhere. So I decided to format the LFS partition and extract the backup on the partition, then I updated the grub which found LFS on partition.
While booting it says:
mount: only superuser can use mount.
mount: /run only root can use "--option"....
and
/run : read only file system...
I tried adding rw in the grub file, but then the only root can use error is still there
I don't know where it went wrong
I'd appreciate any hints or comments.
Thanks.
All the boot stuff, /proc, /sys, /run & /dev must all be root owned and group. To look at the errors, it appears it's trying to mount them as a luser
The safe way to backups is with rsync. Back up while the system is off, otherwise the directories above will be filled with crap.
Thanks business_kid, but is there a way to fix this? I tried so many things like changing fstab n changing permission of the files.
The LFS book I was using was for systemv, now I started building systemd so that I can use Gnome in LFS.
If there's a way to get the mount command while booting working properly?
I remember doing this a long time ago. I found that permissions don't always duplicate when tarring and untarring.
Re-read sec. 6.5 of the LFS book and make sure that your permission are correct. That's one thing.
Now, about your tarball, /run is suppose to be an empty directory. See that it is. It gets mounted virtually
via /etc/fstab at boot or by the following command with chroot. It's possible that you tarred virtual files that
get in the way by untarring. The same with /dev, /sys, and /proc.
As sr_ls_boy mentioned, permissions are not always preserved when making tar archives - unless you make the archive as root AND use the 'p' option. cd to the parent directory for which you wish to archive, and then
tar cfp /path/to/tarball.tar .
You need to be cd'ed to the appropriate directory that you are backing up. This will not work if you cd to the directory where you want the resulting tarball to be.
At this point your best bet is to boot from a live cd and start changing permissions manually.
Distribution: LFS 9.0 Custom, Merged Usr, Linux 4.19.x
Posts: 616
Rep:
First, if you're on a dual-boot system make certain $LFS/boot/efi is not mounted before restoring the system.
To backup, assuming $LFS is mounted and you are running as root from your build host and/or bootable thumb drive or CDROM. I recommend backing up /sources separately as a normal archive. [ tar -cJvf ~/lfs-8.3-sources.tar.xz sources ]
Code:
cd $LFS
tar -cJvp --xattrs --numeric-owner --exclude=./sources \
--exclude=./tmp/* -f ~/lfs-8.3-base-system.tar.xz .
The numeric-owner is necessary because accounts may exist on the LFS system that don't exist on the build host or backup system. Additionally, if there are accounts with the same name on both, they may not have the same UIDs/GIDs.
To restore, make sure you create directories for and mount any sub-partitions of the LFS system root.
Code:
cd $LFS
tar -xvpf ~/lfs-8.3-base-system.tar.xz --xattrs-include='*.*' --numeric-owner
I've never had a system fail to boot or function normally using this method.
I'm gonna start looking through the permissions and the virtual filesystems, next time I'll remember to make a tar with -p option.
Thanks for your help guys!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.