Skip to content

Multiple mounts of chroot/dev, chroot/run cause 'cannot execute 'command': unable to open pty' #86

Description

@rebast85

** This appears to be a duplicate of #48. Either way I fixed it in a decent manner.

Describe the bug
Multiple mounts of dev and run in the chroot file system cause the host system to give the error ''cannot execute 'command': unable to open pty'.
For example, when trying to run 'sudo umount chroot/run', one gets the error.
This happens in both the GUI terminals as in the linux command line itself (the one reachable with ctrl+alt+F3 etc)

** NOTE:
I think this may only be related to the /dev mount in the chroot but I am not sure.
The reason I thought /run had to do anything with it was because /dev and /run are the only ones in the chroot getting mounted multiple times when rerunning the script.
Having multiple mounts of such directories onto the same path is a bad idea whatsoever.

This happens because the script does not unmount the mounted directories in the chroot when it exits because of an error. Currently the error in the chroot_build.sh script is due to wireless-tools not being available. I will file another bug report for this issue.

The only way to get the host system to work again is to perform a reboot.

To Reproduce
Steps to reproduce the behavior:

  1. Run the build.sh script. Once it calls chroot_build and an error occurs in there, it exits.
  2. Re-run the build.sh script with the chroot_build command. Do this two, three times.
  3. Try to run sudo umount chroot/dev or a sudo su.
  4. See error.

Expected behavior
I expected this script not to blindly mount already mounted directories. Perhaps a check to see if these are already mounted would be a good idea. Or better, a routine where the script cleans up the mounts when it quits due to an error.

Desktop (please complete the following information):

  • OS: debian trixie 13, running the script on an ubuntu 26.04 install in a qemu vm.

Additional context
I will attempt to work in both checks for the mounted filesystems and a routine that cleans up the mounts after an error into your script in the upcoming days when I have some time to do so. I am willing to share the improved bits of code with you.

Activity

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