drakkar-lig / debootstick

Generate a bootable live image from any Debian/Ubuntu filesystem tree.
62 stars 18 forks source link

umount: /dev: target is busy #6

Closed omac777 closed 8 years ago

omac777 commented 8 years ago

debootstrap --arch=amd64 --variant=minbase stretch mystretchfs http://ftp.debian.org/debian/ debootstick --system-type installer mystretchfs/ /tmp/mystretch.img I: generating a UEFI bootloader binary... done I: draft image - computing a size large enough... done I: draft image - partitioning and formatting... allocation/use_blkid_wiping=1 configuration setting is set while LVM is not compiled with blkid wiping support. Falling back to native LVM signature detection. allocation/use_blkid_wiping=1 configuration setting is set while LVM is not compiled with blkid wiping support. Falling back to native LVM signature detection. done I: draft image - copying filesystem tree... done I: draft image - updating package manager database... done I: draft image - installing packages: linux-image-amd64 lvm2 gdisk grub-pc... done I: draft image - setting up bootloader... done I: draft image - updating fstab... done I: draft image - performing sanity checks... done I: draft image - generating /etc/hosts (it was empty or missing)... done umount: /dev: target is busy (In some cases useful info about processes that use the device is found by lsof(8) or fuser(1).) umount: /sys: not mounted

E: an error occured. E: did you try 'debootstick --help-os-support'? I: restoring a clean state... umount: /tmp/tmp.dbstck.StAzt.d/draft/lvroot: target is busy (In some cases useful info about processes that use the device is found by lsof(8) or fuser(1).)

eduble commented 8 years ago

Hi, thanks for reporting. I will check it. On which operating system version did you run the tool? Thanks.

omac777 commented 8 years ago

I tried two different versions: -first sid(unstable) -second stretch

Both exhibited the same bug not being able to unmount stuff then resulting in errors. I tried unmounting, but order needs to be considered as I observed when unmounting.

The other constructive criticism would be to display the actual commands that your script executes in order to produce the thumb drive image.

These days, I have attempted creating thumb drives using live-build, live-wrapper and debootstick and all of them fail to produce something that works on sid and stretch. It's quite odd. It shouldn't be this difficult to customize a live thumb drive. It's as if creating thumb-drive is still a dark art when it shouldn't be.

On 01/05/2016 04:17 AM, Etienne Dublé wrote:

Hi, thanks for reporting. I will check it. On which operating system version did you run the tool? Thanks.


Reply to this email directly or view it on GitHub: https://github.com/drakkar-lig/debootstick/issues/6#issuecomment-168941640

eduble commented 8 years ago

Thanks for the comments. I could reproduce it. The commit I just pushed should solve it.

The problem occurred when debootstick installs a recent version of the package lvm2 (required for the live system). The setup scripts of this package apparently cause a daemon called lvmetad to be started. This daemon was opening /dev/null, which was causing the issue you found when unmounting /dev.

In the last commit, I activate a temporary configuration preventing any daemon to be started when installing packages.

A workaround with the version of debootstick you have would be to add '--include=lvm2' on the debootstrap phase: $ debootstrap --arch=amd64 --variant=minbase --include=lvm2 stretch mystretchfs http://ftp.debian.org/debian/ And then the same command line you used for debootstick. (This way, since lvm2 is already in the filesystem, debootstick will not try to install it.)

Sorry for the inconvenience, I did not have time to check debootstick for versions newer than jessie yet.

eduble commented 8 years ago

I don't think creating a thumb drive is a dark art, but this is not simple at least (I mean in the case of a generic tool). Some aspects of the complexity are:

Actually this complexity was one of the reason why I wrote debootstick. In order to simplify this task, I reduced the scope of the tool as much as possible: it is only responsible for converting a filesystem tree to a live image. (Whereas the other tools I know about include the creation of the filesystem tree.) This has the added benefit to allow combining debootstick with various other tools, such as docker (see https://github.com/drakkar-lig/debootstick/wiki/Docker). But still, unexpected issues may occur since the debian OS, which is the entry of the program, evolves.

I noted your remark about the possibility to display what's happening in more details. For this issue more in-depth diagnose was needed anyway: the command that was failing was just "umount /dev", which is not very informative ;). I may improve the filtering of the output or add a log file in a later release.

Thanks again for the feedback!

eduble commented 8 years ago

There is apparently another issue that seems related when the system boots. Stay tuned.

eduble commented 8 years ago

Hi again, sorry for the delay, I was busy with other things. I have pushed one fix, it should work fine now. (But keep in mind that stretch is not stable yet. I noticed a few minor issues in the initramfs, and these are not due to debootstick... However, the system should boot anyway.) You can get this version working with stretch by cloning this repository and running "make install".

About this issue: New versions of LVM have a default conf where LVM commands rely on external daemons (lvmetad, udev, etc.) In debootstick system startup scripts, these are not started yet, which was causing the system to hang. With the fix I did, the LVM config is modified in order to be able to run the commands with no daemons. And this config is restored once the startup scripts are done.

I will close this issue in a few days unless you notice something else running wrong. And I will propose an update for the debian package.