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

Fail at check_loop_device: device node doesn't exist and LOOP= in cycle 1 #6568

Open
1 of 2 tasks
JohnTheCoolingFan opened this issue May 9, 2024 · 10 comments
Open
1 of 2 tasks

Comments

@JohnTheCoolingFan
Copy link
Contributor

JohnTheCoolingFan commented May 9, 2024

What happened?

I did confirm this problem on the main branch

Trying to build armbian on gentoo with docker. Targeting bigtreetech CB2 from https://github.com/bigtreetech/build/tree/CB2

The fork isn't far behind the main branch, at least in terms of the compile script.

The problem seems to be that the script is looking for a loop device, but there aren't any that match a pattern, yet the loop exits on the first iteration with a false positive and empty LOOP variable.

How to reproduce?

(May get updated)

  1. Checkout the repo
  2. Run ./compile.sh
  3. Make all the selections and wait until the failing point

Branch

main (main development branch)

On which host OS are you running the build script and observing this problem?

Other (Gentoo with docker)

Are you building on Windows WSL2?

  • Yes, my Ubuntu/Debian/OtherOS is running on WSL2

Relevant log URL

{message:Error adding document.}

paste.armbian.com/log returns a 500 status code, putting the log here:
log-build-3ebc61fd-016c-4aa1-9a41-00194251ff89.log.ans.txt

Also, the log with docker prefix, because the script decided to use docker automatically:
log-docker-3ebc61fd-016c-4aa1-9a41-00194251ff89.log.ans.txt

Code of Conduct

  • I agree to follow this project's Code of Conduct
Copy link

github-actions bot commented May 9, 2024

Jira ticket: AR-2132

@JohnTheCoolingFan
Copy link
Contributor Author

It looks like the script needs to call sudo losetup -f at least once to make sure there is an available device existing. On my machine, there are no devices that match the pattern of /dev/loopX[Y], just /dev/loop-control. After calling the aforementioned command /dev/loop0 appeared. After doing that, I managed to build an image.

@JohnTheCoolingFan
Copy link
Contributor Author

JohnTheCoolingFan commented May 11, 2024

mknod does get called in check_loop_device, but only with a "found" device, not for creating a missing device. I am putting together a fix for this and will make a PR.

@JohnTheCoolingFan JohnTheCoolingFan changed the title Fail at check_loop_device: device node doesn't exist and $LOOP= Fail at check_loop_device: device node doesn't exist and LOOP= in cycle 1 May 11, 2024
JohnTheCoolingFan added a commit to JohnTheCoolingFan/armbian-build that referenced this issue May 11, 2024
JohnTheCoolingFan added a commit to JohnTheCoolingFan/armbian-build that referenced this issue May 11, 2024
JohnTheCoolingFan added a commit to JohnTheCoolingFan/armbian-build that referenced this issue May 11, 2024
igorpecovnik pushed a commit that referenced this issue May 20, 2024
@pessimism
Copy link

It looks like the commit to fix this issue got reverted:
7da42c8

FYI this issue also affects Fedora the same way, only /dev/loop-control present and an losetup -f run needed.

@JohnTheCoolingFan
Copy link
Contributor Author

Yes, the commit got reverted until a better solution is made. And thanks for reporting that this is also the case on Fedora, it's probably much easier to test with for others than gentoo

@tjhexf
Copy link

tjhexf commented Jun 4, 2024

Happening to me under Fedora, any updates?

@tdleiyao
Copy link
Contributor

tdleiyao commented Jun 9, 2024

manjaro seems to have the same problem

@JohnTheCoolingFan
Copy link
Contributor Author

My previous attempted solution was calling sudo losetup -f in the script always, but it's problematic because you can't always expect the user to authorize sudo use. It needs to be called on the host and not inside of docker. Sure, you can do this manually, but the script exists for automating it.
So I propose this mechanism: check for /dev/loop0 to exist, if it's not there, prompt the user whether to call the sudo command from the script, proceed anyway or possibly have the user running the command manually, or abort the process.

@rpardini
Copy link
Member

rpardini commented Jun 9, 2024

@JohnTheCoolingFan you can check if inside Docker (where it is always root) or not and adapt. What we can't have is it calling losetup in the outer host in the re-launching scenario (consider armbian/build can run the outer host on MacOS/Darwin and the relaunched in Linux on a VM, as is the case with developers using Intel and Apple Silicon Macs with Docker Desktop / Rancher Desktop / Podman Desktop etc).

@JohnTheCoolingFan
Copy link
Contributor Author

My current local fix for this is a script in userpatches/extensions/losetup.sh:

function add_host_dependencies__losetup(){
	if [[ ! -e /dev/loop0 ]]; then
		local sudo_prefix="" && is_root_or_sudo_prefix sudo_prefix
		${sudo_prefix} losetup -f
	fi
}

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

No branches or pull requests

5 participants