Closed WheresWaldo closed 5 years ago
Ok, tested here on my 19.04 installation, and it works. In your run it says:
failed to setup loop device for
Are you sure the loopback device is mounted? Did you use:
sudo modprobe loop
Note - if you did something to your system, I can't really support it, that is why we have vagrant and docker, so you don't get environment issues.
Loop is not a loadable module in the newest versions of Ubuntu, it is compiled into the kernel, so::
sudo modprobe loop
does nothing
I have since created a new VM using Debian 9 and it is appearing to work. I still want to get it installed on Ubuntu since I am more familiar with it than Debian. For now I am going to create a new Ubuntu VM and see if it isn't osboxes.org nonsense. Please leave this open until I report back that it is working.
Okay, I can now say with confidence that osboxes.org prebuilt VM for Ubuntu is the fault. I created a new Ubuntu VM installed VBoxGuestAdditions and was able to successfully build a rPi image. please note there are two corrections to your instructions needed if running on Ubuntu 18.04 RTS or newer (I ran CustomPiOS on Ubuntu 19.04). the first command to install dependencies needs realpath removed.
sudo apt-get install gawk util-linux qemu-user-static git p7zip-full python3
Secondly, since loop is now built into the kernel, there is no need to execute the following command:
sudo modprobe loop
I am closing this issue as it appears it was a configuration issue with the pre-built VM.
Ok, I found out why this happends.
When running losetup you get a list, including
/dev/loop7
0 50331648 0 0 /distro/workspace/2019-04-08-raspbian-stretch-lite.img (deleted)
If you run losetup -d /dev/loop7
it solves the issue.
Will try write up a fix.
@WheresWaldo If you feel like testing out this fix it would be great
Yes, I will, give me 24 hours to get things set up again.
Been busy actually trying to use CustomPiOS, we have a community project trying to duplicate the functionality of Robo 3D's RoboOS, which is OctoPi based Kivy frontend for their printers. They have appeared to have stopped all development and left their users with very old versions of all parts, myself and a few others are trying to update it to work with the latest versions of OctoPrint / plugins / Kivy. It is located here, https://github.com/WheresWaldo/CommunityOS.
By the way, I have no issues using Debian 9 guest OS in VirtualBox on a Windows 10 host.
Cool! Once you get it going you are more than welcome to add it to the list at here.
Still doesn't appear to work under Ubuntu, I am beginning to think it is because Ubuntu (other distros also) obscures or doesn't have a 'root' user. I haven't tried any other distros except for Debian 9, Ubuntu 19.04 and Mint 19.1. Debian is the only one that works 100% of the time, baring stupid commands I put in the chroot_script.
@WheresWaldo Can you give the output of
losetup
?
Also note you need the latest dev build.
I will git clone the dev build of CustomPiOS, then try my setup. I will try to do it on Monday / Tuesday, since I am busy trying to fix stupid scripting errors in my distribution. I will start with a initial snapshot VM of Ubuntu 19.04 as it appears, once it is broken it is almost impossible to fix.
You dont need to clone for the docker-build. just pull from https://hub.docker.com/r/guysoft/custompios/ the devel tag.
Also be sure to run losetup
, even if the code does not fix the issue, you should be able to see it.
If you see files with (deleted)
entry next to them, it means we know that is the issue that is causing the problem.
You dont need to clone for the docker-build. just pull from https://hub.docker.com/r/guysoft/custompios/ the devel tag.
Also be sure to run
losetup
, even if the code does not fix the issue, you should be able to see it. If you see files with(deleted)
entry next to them, it means we know that is the issue that is causing the problem.
If this works will you release a new tagged version to Docker Hub? I think when I first tried, I assumed latest
as I normally would, but then noticed that 1.1.0
existed and it seemed the most appropriate.
I think this wiki change might help a bit. There's another docker-compose.yml
in the repo at the original location which I don't think is the correct file.
Yes, if it works it justifies a new version, can be tagged. Would love to confirm it fixes the issue first.
losetup -d /dev/loop7
ubuntu@ip-172-26-7-42:~/CustomPiOS/TestOS/src$ losetup -d /dev/loop7
losetup: /dev/loop7: detach failed: Permission denied
ubuntu@ip-172-26-7-42:~/CustomPiOS/TestOS/src$ sudo losetup -d /dev/loop7
losetup: /dev/loop7: detach failed: No such device or address
ubuntu@ip-172-26-7-42:~/CustomPiOS/TestOS/src$ uname -a
Linux ip-172-26-7-42 4.15.0-1021-aws #21-Ubuntu SMP Tue Aug 28 10:23:07 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
…
+++ detach_all_loopback 2019-04-08-raspbian-stretch-lite.img
++++ awk '{ print $1 }'
++++ grep 2019-04-08-raspbian-stretch-lite.img
++++ losetup
++++ losetup -f --show -o 50331648 2019-04-08-raspbian-stretch-lite.img
losetup: 2019-04-08-raspbian-stretch-lite.img: failed to set up loop device: Permission denied
+++ LODEV=
+ exit 1
Note that this is 18.04, not 19.04.
I got this working on my AWS LightSail box (see above) just by using sudo ./build_dist
(after everything I did above). I will try to do this locally next so that I can actually add some modules and test that I can boot the new image on a Pi.
The filesystem is already 328704 (4k) blocks long. Nothing to do!
+++ losetup -d /dev/loop2
+++ trap - EXIT
+++ popd
~/CustomPiOS/TestOS/src
+++ echo_green -e '\nBUILD SUCCEEDED!\n'
+++ echo -e -n '\e[92m'
+++ echo -e '\nBUILD' 'SUCCEEDED!\n'
BUILD SUCCEEDED!
+++ echo -e -n '\e[0m'
+ exit 0
After apt dist-upgrade
(i.e. not an out-of-the-box fresh 19.04) this is still working as described above.
I cannot get this working on 19.04 (DigitalOcean, fresh 19.04 instance) even with sudo-ing as I mentioned previously on an updated 18.04 box.
+++ detach_all_loopback 2019-04-08-raspbian-stretch-lite.img
++++ awk '{ print $1 }'
++++ grep 2019-04-08-raspbian-stretch-lite.img
++++ losetup
++++ losetup -f --show -o 50331648 2019-04-08-raspbian-stretch-lite.img
losetup: 2019-04-08-raspbian-stretch-lite.img: failed to set up loop device: Resource temporarily unavailable
+++ LODEV=
+ exit 1
root@ubuntu-s-1vcpu-1gb-sfo2-01:~/CustomPiOS/TestOS1904/src# history
1 git clone https://github.com/guysoft/CustomPiOS.git
2 cd CustomPiOS/
3 ./src/make_custom_pi_os -g TestOS1904
4 sudo apt-get install gawk util-linux qemu-user-static git p7zip-full python3
5 sudo apt-get install gawk util-linux git p7zip-full python3
6 sudo apt update
7 sudo apt-get install gawk util-linux qemu-user-static git p7zip-full python3
8 ./src/make_custom_pi_os -g TestOS1904
9 sudo apt-get install python
10 ./src/make_custom_pi_os -g TestOS1904
11 cd TestOS1904/src/
12 vim config
13 ./build_dist
14 sudo ./build_dist
15 sudo modprobe loop
16 sudo ./build_dist
19 ./build_dist
20 history
root@ubuntu-s-1vcpu-1gb-sfo2-01:~/CustomPiOS/TestOS1904/src# losetup -d /dev/loop7
losetup: /dev/loop7: detach failed: No such device or address
root@ubuntu-s-1vcpu-1gb-sfo2-01:~/CustomPiOS/TestOS1904/src# ls -l /dev/loop*
crw-rw---- 1 root disk 10, 237 May 15 19:26 /dev/loop-control
brw-rw---- 1 root disk 7, 0 May 15 19:26 /dev/loop0
brw-rw---- 1 root disk 7, 1 May 15 19:26 /dev/loop1
brw-rw---- 1 root disk 7, 2 May 15 19:34 /dev/loop2
brw-rw---- 1 root disk 7, 3 May 15 19:26 /dev/loop3
brw-rw---- 1 root disk 7, 4 May 15 19:26 /dev/loop4
brw-rw---- 1 root disk 7, 5 May 15 19:26 /dev/loop5
brw-rw---- 1 root disk 7, 6 May 15 19:26 /dev/loop6
brw-rw---- 1 root disk 7, 7 May 15 19:26 /dev/loop7
root@ubuntu-s-1vcpu-1gb-sfo2-01:~/CustomPiOS/TestOS1904/src# losetup -d /dev/loop7
losetup: /dev/loop7: detach failed: No such device or address
root@ubuntu-s-1vcpu-1gb-sfo2-01:~/CustomPiOS/TestOS1904/src# losetup -d /dev/loop
/dev/loop0 /dev/loop1
I've not been able to successfully build a simple distro on my macOS host using Docker for Mac and the referenced Dockerfile
and docker-compose.yml
. A more complete example with a basic TestOS or something might be helpful.
Can you just give an example of plain, with no arguments losetup
In a failed machine?
I see no example of what I asked for in the previous comment.
Here is a plain output from 'losetup' on a failed Ubuntu 19.04 build that works 100% on Debian 9.
waldo@debian-dev:~/CommunityOS/src$ losetup
NAME SIZELIMIT OFFSET AUTOCLEAR RO BACK-FILE DIO LOG-SEC
/dev/loop1 0 0 1 1 /var/lib/snapd/snaps/gnome-characters_254.snap 0 512
/dev/loop6 0 0 1 1 /var/lib/snapd/snaps/gnome-logs_61.snap 0 512
/dev/loop4 0 0 1 1 /var/lib/snapd/snaps/gnome-calculator_406.snap 0 512
/dev/loop2 0 0 1 1 /var/lib/snapd/snaps/gnome-3-28-1804_31.snap 0 512
/dev/loop0 0 0 1 1 /var/lib/snapd/snaps/gnome-system-monitor_77.snap 0 512
/dev/loop7 0 0 1 1 /var/lib/snapd/snaps/core18_941.snap 0 512
/dev/loop5 0 0 1 1 /var/lib/snapd/snaps/gtk-common-themes_1198.snap 0 512
/dev/loop3 0 0 1 1 /var/lib/snapd/snaps/core_6673.snap 0 512
I've built (many many times now) my OS on my Mac but have since run into other problems. I'm using @guysoft's image on docker hub on devel, so I guess this isn't really a problem for me anymore.
Ok, found another scenerio where you will get an error "no such file or directory". If you run out of loopack devices! @WheresWaldo all 7 loopback devices are taken for you. So it would fail to mount boot.
Try running outside the container:
sudo mknod -m640 /dev/loop8 b 7 8
Then build again using docker.
Should create /dev/loop8
(taken from here)
Will try and see if there is a way to output an error about this.
Ok, pushed a fix, docker-compose pull and try building now.
Ok, had a chance to test it today and now it is building properly on Ubuntu. No other changes except using new code from devel.
Great! Thanks for testing and reporting!
Having this issue on a later bookworm PiOS release. No changes made that should have impacted this. Were there any fixes identified for the host system not being able to use loop devices or is this an entirely unsupported feature now?
# sudo modprobe loop
# lsmod |grep loop
# losetup -a
# losetup
# uname -a
Linux neo 6.1.0-rpi7-rpi-v8 #1 SMP PREEMPT Debian 1:6.1.63-1+rpt1 (2023-11-24) aarch64 GNU/Linux
@WheresWaldo see #55 that tracks it
Are these not separate issues? #55 seems to be related to issues inside the docker container.
@Rattkener sorry for the late reply. I don't know of an issue with that outside a docker container, you might be missing. Open a separate issue and post the exact error messages you are getting.
Building my own version of OctoPrint with a few plugins when the build command is issued and it appears to go all the way through building the necessary modules and ripping apart the image, only to fail rebuilding the image.
Using Ubuntu 19.04 (64-bit) in a VirtualBox VM from osboxes.org. Simply using 'terminal' and not trying to install in Docker or with Vagrant.
build.log
I am pretty sure it is a permissions issue, but can't figure out how to fix it, sorry I am a linux noob.
A couple of notes, 'realpath' is not in the current Ubuntu package repository so it cannot be installed, also 'curl' needed be added to the install list in order to download the source via the provided instructions. Also, loop is not built into the kernel and not a loadable module so 'modprobe loop' does nothing. Nor does it list loop when searching for modules with 'lsmod'.
I studied the four other issues that mention loop failing (2 closed, 2 open) and it does not appear to provide a clear understanding of what is going on.
Just to verify if my setup of OctoPrint was the culprit, I tried building AlarmPi and OctoPi and both failed at the same location.