Skip to content

Loop doesn't seem to be working with Ubuntu 19.04, fails at losetup #46

Closed

Description

@WheresWaldo

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.

Activity

  1. guysoft commented on Apr 21, 2019

    @guysoft
    Owner
  2. WheresWaldo commented on Apr 21, 2019

    @WheresWaldo
    Author

    Loop is not a loadable module in the newest versions of Ubuntu, it is compiled into the kernel, so::

    sudo modprobe loop

    does nothing

  3. WheresWaldo commented on Apr 21, 2019

    @WheresWaldo
    Author

    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.

  4. WheresWaldo commented on Apr 21, 2019

    @WheresWaldo
    Author

    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.

  5. guysoft commented on May 6, 2019

    @guysoft
    Owner

    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.

  6. added a commit that references this issue on May 8, 2019
    1519e8e
  7. guysoft commented on May 8, 2019

    @guysoft
    Owner

    @WheresWaldo If you feel like testing out this fix it would be great

  8. WheresWaldo commented on May 8, 2019

    @WheresWaldo
    Author

    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.

  9. guysoft commented on May 8, 2019

    @guysoft
    Owner

    Cool!
    Once you get it going you are more than welcome to add it to the list at here.

  10. WheresWaldo commented on May 9, 2019

    @WheresWaldo
    Author

    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.

  11. guysoft commented on May 12, 2019

    @guysoft
    Owner

    @WheresWaldo Can you give the output of
    losetup ?

    Also note you need the latest dev build.

  12. WheresWaldo commented on May 12, 2019

    @WheresWaldo
    Author

    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.

  13. guysoft commented on May 12, 2019

    @guysoft
    Owner

    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.

  14. 6 remaining items

  15. RyanBalfanz commented on May 15, 2019

    @RyanBalfanz

    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
    
  16. RyanBalfanz commented on May 15, 2019

    @RyanBalfanz

    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.

  17. guysoft commented on May 16, 2019

    @guysoft
    Owner

    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.

  18. WheresWaldo commented on May 16, 2019

    @WheresWaldo
    Author

    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
    
    
  19. RyanBalfanz commented on May 17, 2019

    @RyanBalfanz

    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.

  20. guysoft commented on May 19, 2019

    @guysoft
    Owner

    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.

  21. guysoft commented on May 21, 2019

    @guysoft
    Owner

    Ok, pushed a fix, docker-compose pull and try building now.

  22. WheresWaldo commented on May 23, 2019

    @WheresWaldo
    Author

    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.

  23. guysoft commented on May 24, 2019

    @guysoft
    Owner

    Great! Thanks for testing and reporting!

  24. Rattkener commented on Jan 28, 2024

    @Rattkener

    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
    
  25. guysoft commented on Jan 28, 2024

    @guysoft
    Owner

    @WheresWaldo see #55 that tracks it

  26. Rattkener commented on Jan 29, 2024

    @Rattkener

    Are these not separate issues? #55 seems to be related to issues inside the docker container.

  27. guysoft commented on Jul 18, 2024

    @guysoft
    Owner

    @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.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions