Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news


  

Author Topic: Linux GUI/Xorg without a window manager, and autologon  (Read 6713 times)

0 Members and 1 Guest are viewing this topic.

elvis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1150
  • penguin poker
    • StickFreaks
Linux GUI/Xorg without a window manager, and autologon
« on: November 28, 2013, 05:39:39 am »
I keep seeing posts on here where people talk about using LXDE/Lubuntu or XFCE/Xubuntu to try and build a speedy MAME cab and keep memory down.  It's prompted me to share how I build my Linux MAME cabinets (6 cabs and counting, spread across Slackware, Debian and Ubuntu).  I'm a long time Linux user for home and work (getting on 17 years now), and it's great to see so many folks turning to Linux these days for specific tasks like cab building.

If all you're running on a MAME system is a frontend and emulators (like most cabinets do), you don't need a window manager at all.  Window managers are there simply to aid with graphical tools and allow you to position/resize windows easily, load themes and eye candy, etc.  For a full screen frontend, you're just throwing away system memory.  While probably not an issue for more powerful systems, I like the challenge of seeing what's the oldest hardware I can find to knock together yet another MAME cabinet, and that often means running configurations with just 256-512MB.

You don't need any particular window manager installed to run matching libraries and applications.  You can easily run GTK applications out of KDE, and vice versa Qt applications out of GNOME or Unity.  You can run anything you like even without a window manager, as long as the relevant libraries are installed. 

I use Xorg in all of my current cabinets (still the current graphical subsystem on most popular distros - the bit that sits "underneath" GNOME/KDE/Unity/LXDE/XFCE/etc), and most of this guide works on older XFree86 setups too.  I don't use direct frame buffer modes or Mir craziness, so that's all out of scope.

Here's how to do it:

1)
Disable any sort of graphical login manager from running at startup.  Ubuntu uses LightDM these days.  You might be using GDM with GNOME or other GTK setups, KDM for KDE, etc.  Either disable the service via your distro's preferred method, or simply uninstall the relevant package (avoid that if you want to log in to the GUI as a different user at some point).  I'll leave disabling of services as "homework". :)

2)
For the user you want to auto-login on boot (for me, it's always the user "mame"), go to that user's home directory.  In that home directory, edit/create a file called ".xinitrc".  Note the dot at the front of the filename - this convention means it's a configuration file.  In this case, it's the rc (Runtime Configuration) for XInit (the X Initialisation program).  In here, you put the full path to the file you want to run when X starts.

This can be a program directly.  For example, it could contain something like:
Code: [Select]
/usr/local/bin/wahcade --full-screen --no-gstreamer --no-pygame
Or it could point to a shell script you've written with a bit more complexity in it. 

What this does is execute that particular thing when X starts.  When it's all complete, X will die and send you back to the command line.  If you want to run several tasks, you can background them with the & character (say, background music, or some power management or screensaver application, etc).  For example:

Code: [Select]
/path/to/music/player some_nice_music.mp3 &
/usr/local/bin/wahcade --full-screen --no-gstreamer --no-pygame

You can test this at any time, by logging in to the command line as the user, and typing "startx".  You should see nothing but your chosen program launch, as if you'd launched it from within the GUI.

3)
Now to make it happen at startup.  There's a million ways to achieve this.  My method is pretty brute-force, but it works.

First, edit /etc/X11/Xwrapper.config (I believe this is Debian/Ubuntu specific), which by default contains the line:
Code: [Select]
allowed_users=console
This stops X being started by anyone other than a console user.  Change it to:
Code: [Select]
allowed_users=anybody
Then edit your /etc/rc.local to start X as the user in question:
Code: [Select]
su - mame -c 'startx'
"su" is the user switching tool, as the system starts by default as the root user.  The hyphen tells su to completely load the profile of the user you're switching to.  Then it's the user's name (again, I have a user called "mame"), then the -c flag informs su to run a particular command on switch, which in our case is 'startx'.  The Xwrapper.config allow s any user to start X, and the .xinitrc file tells X what to load when it starts.

There you have it.  Auto login, straight to a fullscreen frontend.  Use a tool like "htop" to compare your system RAM usage with a window manager and without.  You'll be amazed to see how much memory even lightweight window managers gobble up doing absolutely nothing.

General_Faliure

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 84
    • My Arcade Cab
Re: Linux GUI/Xorg without a window manager, and autologon
« Reply #1 on: January 03, 2014, 01:21:22 am »
Thanks for this tutorial.
I might try it on a next project.
I have just built in a newer mainboard in my cab, a core 2 duo 8400 @3.6 Ghz and 4 Gb of mem, so no lack of resources here.
I started out with an Athlon XP 2100 with 512 Mb which worked fine for most mame games, but came up short with the newer emulators.
I keep the window manager for ease of use, i asume you can still start the window manager for maintenance?
My Arcade cab: https://goo.gl/photos/yE1KACHryQjCaaCj7
Core2 duo8400 @3.6 Ghz, 4Gb of mem, Geforce 9500.
Linux Mint 17.3 XFCE, Mame, Mess, Daphne FS-Uae, Mednafen and some more.
Mah!cade

elvis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1150
  • penguin poker
    • StickFreaks
Re: Linux GUI/Xorg without a window manager, and autologon
« Reply #2 on: February 23, 2014, 02:10:44 am »
i asume you can still start the window manager for maintenance?
You can, but why bother?  Change your .xinitrc to load "xterm".  From there you can run any commands you like to fire up programs (including GUI ones like Nautilus, Wahcade Setup, etc).

Ansa89

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 377
Re: Linux GUI/Xorg without a window manager, and autologon
« Reply #3 on: March 11, 2014, 06:21:12 am »
Change your .xinitrc to load "xterm".
Or just use ssh with x-forward.
Earth could be the hell of another world

MotorHedJr

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 46
  • Christmas everyday!!!
Re: Linux GUI/Xorg without a window manager, and autologon
« Reply #4 on: April 02, 2014, 10:49:06 pm »
Elvis,

Great work. Can you please tell what Linux distro and version you're using? I've beaten my head all summer trying to get the AdvMAME (106)/SVGAlib Linux build to work on a multi-core newer processor.

I've verified my video card works per the AdvMAME procedures too on a way old version of Ubuntu (8.02 something I think)

I've had problems getting the right version of SVGAlib (that AdvMAME wants) to compile on a kernel that's still compatible w/ a current MOBO w/ a multi-core processor... Specifically, I can get everything to compile but when I goto launch AdvMAME my issue is the console seems to be 'corrupted'. (Bunch of text error messages) Thanks!

Regards,
John

elvis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1150
  • penguin poker
    • StickFreaks
Re: Linux GUI/Xorg without a window manager, and autologon
« Reply #5 on: May 10, 2014, 05:32:16 am »
These days I use Ubuntu. In the past I've used Debian, Slackware and Gentoo.

It makes little difference in the long run, particularly for cut down installs with no window manager.

s_busby_uk

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 276
Re: Linux GUI/Xorg without a window manager, and autologon
« Reply #6 on: May 10, 2014, 03:28:10 pm »
I've tried Ubuntu and Debian, and of the two Debian seems WAY more secure. They're closely related but Debian undergoes much more rigorous testing from what I can tell before they release updates. I have a home server and Ubuntu completely screwed up after some updates (back before I ran backups prior to updating). Debian has been rock solid so far.

elvis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1150
  • penguin poker
    • StickFreaks
Re: Linux GUI/Xorg without a window manager, and autologon
« Reply #7 on: May 19, 2014, 07:06:08 am »
Security is the last thing on my mind for an arcade cabinet.  The thing boots into a single-user, single-purpose operating system with no Internet connection.

I've used Linux professionally since 2003, and a lot of that has been in high security environments.  In those situations, yes security certainly matters.  For my home arcade machines, it doesn't matter in the slightest to me.   Speed, and the flexibility to customise the system the way I want it are the most important features.

s_busby_uk

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 276
Re: Linux GUI/Xorg without a window manager, and autologon
« Reply #8 on: May 19, 2014, 07:24:44 am »
Sorry, I should've said "stability" rather than security. Debian I've found to be rock solid in terms of stability, but Ubuntu crashed and ultimately lead me to lose a lot of data.

elvis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1150
  • penguin poker
    • StickFreaks
Re: Linux GUI/Xorg without a window manager, and autologon
« Reply #9 on: May 22, 2014, 07:33:23 pm »
Sorry, I should've said "stability" rather than security. Debian I've found to be rock solid in terms of stability, but Ubuntu crashed and ultimately lead me to lose a lot of data.

I run Ubuntu in a production VFX studio across three sites, and it's rock solid.   

If a modern operating system crashes a lot on you, it generally comes down to either hardware faults or particular driver stability.   We push our machines hard (high end 3D visual effects for hollywood films), and they survive the punishment.   Across thousands of machines we get one or two that crash, and it always comes down to faulty hardware.

s_busby_uk

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 276
Re: Linux GUI/Xorg without a window manager, and autologon
« Reply #10 on: May 22, 2014, 08:15:46 pm »
Do you keep these machines bang up to date? I encountered problems by assuming updates would work fine and in the end they killed my system.

I can only speak from personal experience, and Debian just feels more stable. Updates are less frequent and well tested, it's not trying too hard to assimilate users, there's no dodgy Amazon tie-ins, and as it's based in Debian anyway why not just go for the core experience?

Anyway, glad you're not having issues cos if I was doing serious work on any OS the last thing id want is it erasing all my data!

elvis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1150
  • penguin poker
    • StickFreaks
Re: Linux GUI/Xorg without a window manager, and autologon
« Reply #11 on: May 25, 2014, 12:46:57 am »
Do you keep these machines bang up to date? I encountered problems by assuming updates would work fine and in the end they killed my system.
Yes.  We use Puppet to centrally manage/configure all systems, and part of what it does is to install updates on a regular basis.

miner49er

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16
Re: Linux GUI/Xorg without a window manager, and autologon
« Reply #12 on: July 22, 2014, 07:30:46 pm »
I know this is an old thread but I had to stick my 2p's worth in! I have been running Debian since 2009, using advanceMame with no x-server. I've never updated it (it's not connected to the internet) and it's never failed. I absolutely love it. It's connected to 15Khz arcade monitor and a JPAC (bought from a smashing chap from the this very forum). I've also replaced the motherboard once (I destroyed it by dropping a 12v cable onto the board!) - because it's linux, I just swapped over all the cards and hard drives and it worked. First time. Absolutely beautiful.

Linux rules!

oxy

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 9
  • I want to build my own arcade controls!
Re: Linux GUI/Xorg without a window manager, and autologon
« Reply #13 on: August 12, 2014, 10:53:36 am »
Hi elvis, I have used ratpoison as window manager. Its i think its easier to configure for newcomers and more useful than just the xterm. Give it a try!

elvis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1150
  • penguin poker
    • StickFreaks
Re: Linux GUI/Xorg without a window manager, and autologon
« Reply #14 on: September 24, 2014, 07:00:43 am »
Hi elvis, I have used ratpoison as window manager. Its i think its easier to configure for newcomers and more useful than just the xterm. Give it a try!
I have friends who use ratpoison and quite like it.  "i3" is another mousless/tiled window manager that is gaining popularity:
http://i3wm.org/

The point of my guide above is to do away with any window manager or compositor all together.  As much as some of them can get pretty lightweight and minimalist, they'll never beat not running any WM at all for a lean system.  WM-less Linux is the closest you'll get to an embedded-style setup on desktop hardware.
« Last Edit: September 15, 2015, 02:42:28 pm by elvis »

  
 

Sitemap 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31