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

Can't open display: (null) : Inappropriate ioctl for device #65

Open
manibharathytu opened this issue May 21, 2020 · 3 comments
Open

Can't open display: (null) : Inappropriate ioctl for device #65

manibharathytu opened this issue May 21, 2020 · 3 comments

Comments

@manibharathytu
Copy link

manibharathytu commented May 21, 2020

This happens only when I run my application as linux service. Executing my node app normally by "node main.js" works good.

Error Thrown at :

/home/mani/Desktop/mani/tools/screenshot-easy/node_modules/clipboardy/lib/linux.js:43
throw makeError(xselError, fallbackError);
^

Full Error Stack :

            Error: Both xsel and fallback failed
                at makeError (/home/mani/Desktop/mani/tools/screenshot-easy/node_modules/clipboardy/lib/linux.js:16:11)
                at xselWithFallbackSync (/home/mani/Desktop/mani/tools/screenshot-easy/node_modules/clipboardy/lib/linux.js:43:10)
                at Object.copySync (/home/mani/Desktop/mani/tools/screenshot-easy/node_modules/clipboardy/lib/linux.js:53:3)
                at Object.exports.writeSync (/home/mani/Desktop/mani/tools/screenshot-easy/node_modules/clipboardy/index.js:45:14)
                at Watcher.onChangeDetection (/home/mani/Desktop/mani/tools/screenshot-easy/main.js:85:16)
                at Watcher.emit (events.js:310:20)
                at /home/mani/Desktop/mani/tools/screenshot-easy/node_modules/node-watch/lib/watch.js:305:19
                at /home/mani/Desktop/mani/tools/screenshot-easy/node_modules/node-watch/lib/watch.js:39:7
                at /home/mani/Desktop/mani/tools/screenshot-easy/node_modules/node-watch/lib/watch.js:303:7
                at /home/mani/Desktop/mani/tools/screenshot-easy/node_modules/node-watch/lib/watch.js:109:10 {
            xselError: Error: Command failed: xsel --clipboard --input
            xsel: Can't open display: (null)
            : Inappropriate ioctl for device
            
            
                at makeError (/home/mani/Desktop/mani/tools/screenshot-easy/node_modules/execa/index.js:174:9)
                at Function.module.exports.sync (/home/mani/Desktop/mani/tools/screenshot-easy/node_modules/execa/index.js:338:15)
                at xselWithFallbackSync (/home/mani/Desktop/mani/tools/screenshot-easy/node_modules/clipboardy/lib/linux.js:38:16)
                at Object.copySync (/home/mani/Desktop/mani/tools/screenshot-easy/node_modules/clipboardy/lib/linux.js:53:3)
                at Object.exports.writeSync (/home/mani/Desktop/mani/tools/screenshot-easy/node_modules/clipboardy/index.js:45:14)
                at Watcher.onChangeDetection (/home/mani/Desktop/mani/tools/screenshot-easy/main.js:85:16)
                at Watcher.emit (events.js:310:20)
                at /home/mani/Desktop/mani/tools/screenshot-easy/node_modules/node-watch/lib/watch.js:305:19
                at /home/mani/Desktop/mani/tools/screenshot-easy/node_modules/node-watch/lib/watch.js:39:7
                at /home/mani/Desktop/mani/tools/screenshot-easy/node_modules/node-watch/lib/watch.js:303:7 {
                code: 1,
                stdout: '',
                stderr: "xsel: Can't open display: (null)\n: Inappropriate ioctl for device\n",
                failed: true,
                signal: null,
                cmd: 'xsel --clipboard --input',
                timedOut: false
            },
            fallbackError: Error: Command failed: /home/mani/Desktop/mani/tools/screenshot-easy/node_modules/clipboardy/fallbacks/linux/xsel --clipboard --input
            /home/mani/Desktop/mani/tools/screenshot-easy/node_modules/clipboardy/fallbacks/linux/xsel: Can't open display: (null)
            : Inappropriate ioctl for device
            
            
                at makeError (/home/mani/Desktop/mani/tools/screenshot-easy/node_modules/execa/index.js:174:9)
                at Function.module.exports.sync (/home/mani/Desktop/mani/tools/screenshot-easy/node_modules/execa/index.js:338:15)
                at xselWithFallbackSync (/home/mani/Desktop/mani/tools/screenshot-easy/node_modules/clipboardy/lib/linux.js:41:17)
                at Object.copySync (/home/mani/Desktop/mani/tools/screenshot-easy/node_modules/clipboardy/lib/linux.js:53:3)
                at Object.exports.writeSync (/home/mani/Desktop/mani/tools/screenshot-easy/node_modules/clipboardy/index.js:45:14)
                at Watcher.onChangeDetection (/home/mani/Desktop/mani/tools/screenshot-easy/main.js:85:16)
                at Watcher.emit (events.js:310:20)
                at /home/mani/Desktop/mani/tools/screenshot-easy/node_modules/node-watch/lib/watch.js:305:19
                at /home/mani/Desktop/mani/tools/screenshot-easy/node_modules/node-watch/lib/watch.js:39:7
                at /home/mani/Desktop/mani/tools/screenshot-easy/node_modules/node-watch/lib/watch.js:303:7 {
                code: 1,
                stdout: '',
                stderr: "/home/mani/Desktop/mani/tools/screenshot-easy/node_modules/clipboardy/fallbacks/linux/xsel: Can't open display: (null)\n" +
                ': Inappropriate ioctl for device\n',
                failed: true,
                signal: null,
                cmd: '/home/mani/Desktop/mani/tools/screenshot-easy/node_modules/clipboardy/fallbacks/linux/xsel --clipboard --input',
                timedOut: false
            }
            }
@sindresorhus
Copy link
Owner

Some possible workarounds:

https://unix.stackexchange.com/questions/566081/xsel-cant-open-display-null

https://stackoverflow.com/questions/18695934/unable-to-copy-ssh-id-rsa-pub

Would be nice if we could handle this case in Clipboardy. If not, we should at least improve the error message.

@github0013
Copy link

I encountered the same issue as I was trying to setup semantic-release-cli (running npx semantic-release-cli setup, you probably are running a different command though).

Environment

Mac => ssh => ubuntu (headless)

My server (headless)

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.2 LTS
Release:	20.04
Codename:	focal

I am using a mac to control the server.

 Model Name:	MacBook Air
  Model Identifier:	MacBookAir10,1
  Chip:	Apple M1

Things I tried (didn't work)

  1. install xsel on the ubuntu like it told me
  2. got out of tmux on the ubuntu, then run npx semantic-release-cli setup
  3. reconnecting to ubuntu by ssh -X ...

Solution

Then I did more googling and found an article saying to install X11(XQuartz) on Mac. So I did it like this.

  1. downloaded and installed X11(XQuartz)
  2. logged out & logged in (on Mac)
  3. ran XQuartz (opens a terminal, but I used my own terminal - iTerm2 to do the next step)
  4. then did ssh -X ...
  5. then ran the command I had this problem with
  6. worked!

@Davidalfa081
Copy link

encountering same issue but there should be a command line for a solution to this isuue

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

No branches or pull requests

4 participants