Create a live usb Ubuntu to run an application without desktop environment












0















I need to create a USB live ubuntu to run an application. I want to open my application after the boot as fullscreen without any other option to the end user.



I read that I should use Gtk+ or Qt5 if I want to run an app without a desktop environment or display manager so I created my app using Gtk+.



To be able to open the app without a desktop environment I added to .bashrc the following:



export DISPLAY=:0
while true; do ./myapp; done


I put it inside a while because sometimes I got the following error:



Failed to connect to Mir: Failed to connect to server socket: No such file or directory
Unable to init server: Could not connect: Connection refused
(myapp:4918): Gtk-WARNING **: cannot open display:


I suppose I was trying to run the application before the display manager is running.



Enable auto-login for the default user makes .bashrc on tty1 to be executed and my application is launched.



mkdir /etc/systemd/system/getty@tty1.service.d
nano /etc/systemd/system/getty@tty1.service.d/override.conf
[Service]
ExecStart=
ExecStart=-/sbin/agetty --noissue --autologin ubuntu %I $TERM
Type=idle


To make it work I also needed to edit /usr/share/xsessions/ubuntu.desktop so it doesn't launch the desktop environment.



I'm using Ubuntu 16.04.



It is working however there are some points that I don't understand.



1 - Most of the answers to this problem say to edit ubuntu.desktop and change exec to my application however I wasn't able to make it work. It doesn't run Ubuntu desktop indeed but I wasn't able to make it run my app. I didn't find how I could debug why it was failing.



2 - I read that Gtk+ and Qt5 can use Wayland so I didn't a desktop environment neither a display manager, how could I do that?



3 - Which alternatives do you recommend to obtain the same result? The way I did it in .bashrc sounds a little bit hackish.



Thank you










share|improve this question























  • I had originally marked this for close as duplicate, but I don't think it's a super good match. You might look at the method used, to see if it helps you. https://askubuntu.com/questions/124759/customize-ubuntu-for-a-library-internet-kiosk

    – Charles Green
    7 hours ago











  • @CharlesGreen I tried but it didin't work pastebin.com/z1fQQFbp

    – metRo_
    6 hours ago
















0















I need to create a USB live ubuntu to run an application. I want to open my application after the boot as fullscreen without any other option to the end user.



I read that I should use Gtk+ or Qt5 if I want to run an app without a desktop environment or display manager so I created my app using Gtk+.



To be able to open the app without a desktop environment I added to .bashrc the following:



export DISPLAY=:0
while true; do ./myapp; done


I put it inside a while because sometimes I got the following error:



Failed to connect to Mir: Failed to connect to server socket: No such file or directory
Unable to init server: Could not connect: Connection refused
(myapp:4918): Gtk-WARNING **: cannot open display:


I suppose I was trying to run the application before the display manager is running.



Enable auto-login for the default user makes .bashrc on tty1 to be executed and my application is launched.



mkdir /etc/systemd/system/getty@tty1.service.d
nano /etc/systemd/system/getty@tty1.service.d/override.conf
[Service]
ExecStart=
ExecStart=-/sbin/agetty --noissue --autologin ubuntu %I $TERM
Type=idle


To make it work I also needed to edit /usr/share/xsessions/ubuntu.desktop so it doesn't launch the desktop environment.



I'm using Ubuntu 16.04.



It is working however there are some points that I don't understand.



1 - Most of the answers to this problem say to edit ubuntu.desktop and change exec to my application however I wasn't able to make it work. It doesn't run Ubuntu desktop indeed but I wasn't able to make it run my app. I didn't find how I could debug why it was failing.



2 - I read that Gtk+ and Qt5 can use Wayland so I didn't a desktop environment neither a display manager, how could I do that?



3 - Which alternatives do you recommend to obtain the same result? The way I did it in .bashrc sounds a little bit hackish.



Thank you










share|improve this question























  • I had originally marked this for close as duplicate, but I don't think it's a super good match. You might look at the method used, to see if it helps you. https://askubuntu.com/questions/124759/customize-ubuntu-for-a-library-internet-kiosk

    – Charles Green
    7 hours ago











  • @CharlesGreen I tried but it didin't work pastebin.com/z1fQQFbp

    – metRo_
    6 hours ago














0












0








0








I need to create a USB live ubuntu to run an application. I want to open my application after the boot as fullscreen without any other option to the end user.



I read that I should use Gtk+ or Qt5 if I want to run an app without a desktop environment or display manager so I created my app using Gtk+.



To be able to open the app without a desktop environment I added to .bashrc the following:



export DISPLAY=:0
while true; do ./myapp; done


I put it inside a while because sometimes I got the following error:



Failed to connect to Mir: Failed to connect to server socket: No such file or directory
Unable to init server: Could not connect: Connection refused
(myapp:4918): Gtk-WARNING **: cannot open display:


I suppose I was trying to run the application before the display manager is running.



Enable auto-login for the default user makes .bashrc on tty1 to be executed and my application is launched.



mkdir /etc/systemd/system/getty@tty1.service.d
nano /etc/systemd/system/getty@tty1.service.d/override.conf
[Service]
ExecStart=
ExecStart=-/sbin/agetty --noissue --autologin ubuntu %I $TERM
Type=idle


To make it work I also needed to edit /usr/share/xsessions/ubuntu.desktop so it doesn't launch the desktop environment.



I'm using Ubuntu 16.04.



It is working however there are some points that I don't understand.



1 - Most of the answers to this problem say to edit ubuntu.desktop and change exec to my application however I wasn't able to make it work. It doesn't run Ubuntu desktop indeed but I wasn't able to make it run my app. I didn't find how I could debug why it was failing.



2 - I read that Gtk+ and Qt5 can use Wayland so I didn't a desktop environment neither a display manager, how could I do that?



3 - Which alternatives do you recommend to obtain the same result? The way I did it in .bashrc sounds a little bit hackish.



Thank you










share|improve this question














I need to create a USB live ubuntu to run an application. I want to open my application after the boot as fullscreen without any other option to the end user.



I read that I should use Gtk+ or Qt5 if I want to run an app without a desktop environment or display manager so I created my app using Gtk+.



To be able to open the app without a desktop environment I added to .bashrc the following:



export DISPLAY=:0
while true; do ./myapp; done


I put it inside a while because sometimes I got the following error:



Failed to connect to Mir: Failed to connect to server socket: No such file or directory
Unable to init server: Could not connect: Connection refused
(myapp:4918): Gtk-WARNING **: cannot open display:


I suppose I was trying to run the application before the display manager is running.



Enable auto-login for the default user makes .bashrc on tty1 to be executed and my application is launched.



mkdir /etc/systemd/system/getty@tty1.service.d
nano /etc/systemd/system/getty@tty1.service.d/override.conf
[Service]
ExecStart=
ExecStart=-/sbin/agetty --noissue --autologin ubuntu %I $TERM
Type=idle


To make it work I also needed to edit /usr/share/xsessions/ubuntu.desktop so it doesn't launch the desktop environment.



I'm using Ubuntu 16.04.



It is working however there are some points that I don't understand.



1 - Most of the answers to this problem say to edit ubuntu.desktop and change exec to my application however I wasn't able to make it work. It doesn't run Ubuntu desktop indeed but I wasn't able to make it run my app. I didn't find how I could debug why it was failing.



2 - I read that Gtk+ and Qt5 can use Wayland so I didn't a desktop environment neither a display manager, how could I do that?



3 - Which alternatives do you recommend to obtain the same result? The way I did it in .bashrc sounds a little bit hackish.



Thank you







16.04 gtk display-manager






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 7 hours ago









metRo_metRo_

11




11













  • I had originally marked this for close as duplicate, but I don't think it's a super good match. You might look at the method used, to see if it helps you. https://askubuntu.com/questions/124759/customize-ubuntu-for-a-library-internet-kiosk

    – Charles Green
    7 hours ago











  • @CharlesGreen I tried but it didin't work pastebin.com/z1fQQFbp

    – metRo_
    6 hours ago



















  • I had originally marked this for close as duplicate, but I don't think it's a super good match. You might look at the method used, to see if it helps you. https://askubuntu.com/questions/124759/customize-ubuntu-for-a-library-internet-kiosk

    – Charles Green
    7 hours ago











  • @CharlesGreen I tried but it didin't work pastebin.com/z1fQQFbp

    – metRo_
    6 hours ago

















I had originally marked this for close as duplicate, but I don't think it's a super good match. You might look at the method used, to see if it helps you. https://askubuntu.com/questions/124759/customize-ubuntu-for-a-library-internet-kiosk

– Charles Green
7 hours ago





I had originally marked this for close as duplicate, but I don't think it's a super good match. You might look at the method used, to see if it helps you. https://askubuntu.com/questions/124759/customize-ubuntu-for-a-library-internet-kiosk

– Charles Green
7 hours ago













@CharlesGreen I tried but it didin't work pastebin.com/z1fQQFbp

– metRo_
6 hours ago





@CharlesGreen I tried but it didin't work pastebin.com/z1fQQFbp

– metRo_
6 hours ago










0






active

oldest

votes











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1118261%2fcreate-a-live-usb-ubuntu-to-run-an-application-without-desktop-environment%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Ask Ubuntu!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1118261%2fcreate-a-live-usb-ubuntu-to-run-an-application-without-desktop-environment%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Category:香港粉麵

List *all* the tuples!

Channel [V]