Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mklive.sh: running on foreign distros is broken (with static XBPS) #288

Open
JamiKettunen opened this issue Oct 15, 2022 · 2 comments
Open

Comments

@JamiKettunen
Copy link

JamiKettunen commented Oct 15, 2022

Using static XBPS from a foreign distro such as Ubuntu or Arch causes the process to get stuck (no new output without finishing script after 20 minutes) towards the end, specifically at cp -a "$ROOTFS"/* "$BUILDDIR"/tmp-rootfs/ of generate_squashfs(); here's the full set -x script log output: https://devspace.voidlinux.org/abby/paste/mklive-foreign-log.txt

The worst part is it runs an rm -rf command if you ^C to cancel the process (which was stuck) which also starts removing all stuff possible from under the host bind-mounted /sys, /proc and /dev, after which the system practically has to be rebooted due to missing /dev/null and others, not sure if this could even wipe some efivars possibly rendering host machines unbootable... Here's a short example:

+ error_out 130
+ umount_pseudofs
+ umount -R -f .../void-mklive/tmp.peM67GOz38/image/rootfs/sys
+ umount -R -f .../void-mklive/tmp.peM67GOz38/image/rootfs/dev
+ umount -R -f .../void-mklive/tmp.peM67GOz38/image/rootfs/proc
+ [ -d .../void-mklive/tmp.peM67GOz38 -a -z  ]
+ rm -rf .../void-mklive/tmp.peM67GOz38
rm: cannot remove '.../void-mklive/tmp.peM67GOz38/image/rootfs/sys/kernel/notes': Operation not permitted
...
rm: cannot remove '.../void-mklive/tmp.peM67GOz38/image/rootfs/dev/pts/ptmx': Operation not permitted
rm: cannot remove '.../void-mklive/tmp.peM67GOz38/tmp-rootfs': Device or resource busy
+ exit 130

TODO: Check how the output differs on a Void system...

@JamiKettunen
Copy link
Author

A bit of progress, adding --lazy (-l for short) to the umount commands in umount_pseudofs helps, but now there's a few new problems:

  1. "$VOIDHOSTDIR"/usr/bin/mksquashfs isn't found https://github.com/void-linux/void-mklive/blame/c9dbeed/mklive.sh.in#L271-L272, installing squashfstools on the foreign host system to provide mksquashfs doesn't help
[9/9] Generating squashfs image (xz) from rootfs...
./mklive.sh: 272: .../void-mklive/tmp.pgtMJbawV6/void-host/usr/bin/mksquashfs: not found
ERROR: Failed to generate squashfs image
  1. It appears pseudofs dirs are umount'ed on the host after the (failed) execution of mklive.sh! here's a diff of mount command output before vs. after execution:
--- mounts.a
+++ mounts.b
@@ -1,23 +1,9 @@
 sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
 proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
 udev on /dev type devtmpfs (rw,nosuid,relatime,size=1939704k,nr_inodes=484926,mode=755,inode64)
-devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
 tmpfs on /run type tmpfs (rw,nosuid,nodev,noexec,relatime,size=399708k,mode=755,inode64)
 /dev/mapper/data-root on / type ext4 (rw,noatime,errors=remount-ro)
-securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
-tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,inode64)
 tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k,inode64)
-cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot)
-pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
-efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)
-bpf on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)
-systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=29,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=18870)
-mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
-hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,pagesize=2M)
-debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)
-tracefs on /sys/kernel/tracing type tracefs (rw,nosuid,nodev,noexec,relatime)
-fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)
-configfs on /sys/kernel/config type configfs (rw,nosuid,nodev,noexec,relatime)
 none on /run/credentials/systemd-sysusers.service type ramfs (ro,nosuid,nodev,noexec,relatime,mode=700)
 /dev/vda1 on /boot/efi type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
 tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=399704k,nr_inodes=99926,mode=700,uid=1000,gid=1000,inode64)

@Eloitor
Copy link

Eloitor commented Oct 28, 2022

I have the same problem in bedrocklinux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants