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

Build error: Unable to find free loop device #6417

Open
1 of 2 tasks
AaronNGray opened this issue Mar 21, 2024 · 21 comments
Open
1 of 2 tasks

Build error: Unable to find free loop device #6417

AaronNGray opened this issue Mar 21, 2024 · 21 comments

Comments

@AaronNGray
Copy link

What happened?

I built a CSC image which fails: BananaPi M3:-

https://paste.armbian.com/pejewuyoha

then all other builds fail after this even after a build system reset :-

https://paste.armbian.com/evururohol

How to reproduce?

./compile.sh build BOARD=bananapim3 BRANCH=edge BUILD_DESKTOP=no BUILD_MINIMAL=yes EXPERT=yes KERNEL_CONFIGURE=no RELEASE=bookworm
./compile.sh build BOARD=bananapim5 BRANCH=edge BUILD_DESKTOP=no BUILD_MINIMAL=yes KERNEL_CONFIGURE=no RELEASE=bookworm

Branch

main (main development branch)

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

Ubuntu 22.04 Jammy

Are you building on Windows WSL2?

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

Relevant log URL

https://paste.armbian.com/evururohol

Code of Conduct

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

Jira ticket: AR-2108

@AaronNGray
Copy link
Author

AaronNGray commented Mar 21, 2024

deleting the cache directory and rebooting seems to solve it.

@AaronNGray
Copy link
Author

AaronNGray commented Apr 2, 2024

Still getting this issue after failed builds :-

https://paste.armbian.com/yarohanuzi

@igorpecovnik - Its like loop devices are not being freed if a build fails !

@AaronNGray AaronNGray reopened this Apr 2, 2024
@AaronNGray
Copy link
Author

I will install another version of Ubuntu on a new drive and test whether the problem is specific to this install or not.

This seems to solve the issue temporarily.

How to clean up old Snap revisions and remove loop devices :-

https://ashrafur.medium.com/how-to-clean-up-old-snap-revisions-and-remove-loop-devices-93e38f1ad1f8

@hqnicolas
Copy link
Contributor

hqnicolas commented Apr 3, 2024

Same here, clear cache don't help

$ lsb_release -a
Distributor ID: Ubuntu
Description: Ubuntu 22.04.4 LTS
Release: 22.04
Codename: jammy

$ uname -a
Linux 6.5.0-26-generic #26~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Mar 12 10:22:43 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

Clean install linux solve....
for 1 build.....

@igorpecovnik
Copy link
Member

This loop devices problem is related to host and its kernel. 6.5.x kernel with Jammy should work (better). We have many build runners, some on stock Jammy, some on Armbian Jammy, thus with our kernel. Perhaps try this https://github.com/armbian/sdk ...

/dev/loop devices makes us troubles too, here and there, automation breaks in random manner due to that and which is why we need to repeate few builds here and there.

Also check if you have enough of those loop devices. I have added max_loop=96 to my build machine kernel as otherwise I ran out of them. But due to building several images in parallel.

@igorpecovnik
Copy link
Member

Clean install linux solve....
for 1 build.....

It only works once after fresh install and reboot doesn't help??

@hqnicolas
Copy link
Contributor

hqnicolas commented Apr 3, 2024

@igorpecovnik

It only works once after fresh install and reboot doesn't help??

reboot with clean armbian cache doesn't help

i Was trying to build: JP_TVBOX 3566 on V6.6 with jammy 22.04 desktop cinnamon

today I will use the armbian v24.0.2 and so far, so good (first run OK) 15:11 GMT

git clone --depth 1 --branch v24.0.2 https://github.com/armbian/build armbian

@igorpecovnik
Copy link
Member

i Was trying to build: JP_TVBOX 3566 on V6.6 with jammy 22.04 desktop cinnamon

First try some officially supported target like generic x86 / arm64 image. tvboxes are untested ...

@edumeneses
Copy link

Hello everyone, and thanks for this awesome project.

I tested with a Pop!_OS host (Ubuntu 22.04) and found that it cannot find a free loop when using the main branch. It works fine if you checkout to v24.0.2.

Also, I found that building using docker works on the main branch (on my machine) when I modified line 229 in the partitioning.sh file. I changed the old amount (10) to 30:

[[ $FIND_LOOP_CYCLES -gt 30 ]] && exit_with_error "Unable to find free loop device"

A lsblk call in my terminal showed more than 20 loop devices in use (blaming Snap for that). Could the assumption of a free loop under 10 be the reason for the error ?

@hqnicolas
Copy link
Contributor

hqnicolas commented Apr 3, 2024

First try some officially supported target like generic x86 / arm64 image. tvboxes are untested ...

you have a point! but the V24.02 solve everything

I will start to advice the unnoficial people and the chinese shitboxes to use this:

git clone --depth 1 --branch v24.0.2 https://github.com/armbian/build armbian

@MegaArman
Copy link

MegaArman commented Apr 4, 2024

Also having this issue on ubuntu 22.04 jammy, kernel 6.5.0-26-generic . I gave no commandline argument to ./compile.sh. My target was the Le Potato board and I had just loaded a .config that I previously saved.

I saw this loopback error after 2 hours, seemed the kernel compiled OK otherwise.

I will give branch v24.0.2 a try:
git clone --depth 1 --branch=v24.02 https://github.com/armbian/build armbian

Update:
this time (again near the end of process) got "Error 2 occurred in mainshell"

Update (solution):
losetup -a <- see which loopback devices you have
sudo umount /dev/loop# <- unmount loopback device of that # if not needed

I unmounted firefox and the snap store.

For good measure, I also added the line
"options loop max_loop=64"
to /etc/modules-load.d/modules.conf
and rebooted.

I didn't confirm if that had any effect, but it worked. Was able to complete the build. I am using Ubuntu Desktop, perhaps the Ubuntu server image wouldn't have had this issue.

@AaronNGray
Copy link
Author

AaronNGray commented Apr 4, 2024

I found a solution to my issue it appears snaps was causing an issue with eating loop devices on my machine :-

https://ashrafur.medium.com/how-to-clean-up-old-snap-revisions-and-remove-loop-devices-93e38f1ad1f8

@loganmancuso
Copy link

loganmancuso commented May 9, 2024

Hello everyone, and thanks for this awesome project.

I tested with a Pop!_OS host (Ubuntu 22.04) and found that it cannot find a free loop when using the main branch. It works fine if you checkout to v24.0.2.

Also, I found that building using docker works on the main branch (on my machine) when I modified line 229 in the partitioning.sh file. I changed the old amount (10) to 30:

[[ $FIND_LOOP_CYCLES -gt 30 ]] && exit_with_error "Unable to find free loop device"

A lsblk call in my terminal showed more than 20 loop devices in use (blaming Snap for that). Could the assumption of a free loop under 10 be the reason for the error ?

This worked for me. Snap did not have any dangling loop devices on my laptop but allowing it to continue to look for an available loopback to use allowed my build to work thanks so much. I think a hardcoded limit of 10 might be a bad assumption but im not qualified to say.

@hqnicolas
Copy link
Contributor

(blaming Snap for that).

Me to!

@AaronNGray
Copy link
Author

@igorpecovnik please can you look into @edumeneses solution #6417 (comment) and see if solves this issue so we can close it ?

@Ekmansoft
Copy link
Contributor

So, I get this problem too, so we shouldn't close this ticket until we fix it on master. Just counting the number of loop devices seem to be a bad way to check if armbian has created too many of those. Like previous users, I have 20+ from snap. I'll try and see if the partitioning.sh patch helps on my Ubuntu 23.10 system.

@EvilOlaf
Copy link
Member

master

master will no longer receive updates. If the problem is successfully tackled in main this can be closed.

@Ekmansoft
Copy link
Contributor

Ekmansoft commented May 19, 2024

Lol. I meant the main branch, whatever it's called :-)

I am running on main, and the patch did help me. :-)

@kadrabak
Copy link

I had similar issues where deleting the cache folder did not always help.
Once I started using fixed image size (see FIXED_IMAGE_SIZE= parameter) my problem "Unable to find free loop device" disappeared.
However, I like the btrfs filesystem and with this, an operating system needs a separate boot partition.
After some kernel upgrades failed, I learned to set BOOTSIZE parameter like in the example below to get a bigger boot partition.

./compile.sh build BOARD=pine64 BOOTSIZE=300 BRANCH=edge BTRFS_COMPRESSION=zlib BUILD_DESKTOP=no BUILD_MINIMAL=no FIXED_IMAGE_SIZE=7000 INSTALL_HEADERS=yes KERNEL_CONFIGURE=no RELEASE=noble ROOTFS_TYPE=btrfs SEVENZIP=no

@kadrabak
Copy link

here is a build test on my setup:

./compile.sh build BOARD=bananapim5 BRANCH=edge BUILD_DESKTOP=no BUILD_MINIMAL=yes KERNEL_CONFIGURE=no RELEASE=bookworm
..failed

./compile.sh build BOARD=bananapim5 BRANCH=edge BUILD_DESKTOP=no BUILD_MINIMAL=yes KERNEL_CONFIGURE=no RELEASE=bookworm FIXED_IMAGE_SIZE=7000
..failed

./compile.sh build BOARD=bananapim5 BRANCH=edge BUILD_DESKTOP=no BUILD_MINIMAL=yes KERNEL_CONFIGURE=no RELEASE=bookworm BOOTSIZE=300 FIXED_IMAGE_SIZE=7000 ROOTFS_TYPE=ext4
... success
note: The system image was built with everything in one partition on filesystem ext4 because Armbian build system knows u-boot is able to boot from ext4 so it will not create boot partition

system: Ubuntu Mantic in Virtualbox, 12880MB Ram, 16Cores, 6.6.29-060629-generic
note: everything is done without reboot

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

9 participants