LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 02-04-2018, 09:51 PM   #1
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,593

Rep: Reputation: 179Reputation: 179
KDE permit logout with Virtual Machine


When a KDE user goes to logout with a Virtual Machine running (in this case VirtualBox, WIN7 VM), it initially prevents the user from logging out if the VM is running. Normally, this is a great feature as it prevents the user from "pulling" the plug" on the VM. However, I have added a VM shutdown script to System Settings > Startup and Shutdown > Autostart which does shutdown the VM when the user logs out. However, it still aborts the actual logout and the user has to log out again.

Is there a way to turn off this feature?
 
Old 02-05-2018, 07:54 AM   #2
Aeterna
Senior Member
 
Registered: Aug 2017
Location: Terra Mater
Distribution: VM Host: Slackware-current, VM Guests: Artix, Venom, antiX, Gentoo, FreeBSD, OpenBSD, OpenIndiana
Posts: 1,011

Rep: Reputation: Disabled
Quote:
Originally Posted by mfoley View Post
When a KDE user goes to logout with a Virtual Machine running (in this case VirtualBox, WIN7 VM), it initially prevents the user from logging out if the VM is running. Normally, this is a great feature as it prevents the user from "pulling" the plug" on the VM. However, I have added a VM shutdown script to System Settings > Startup and Shutdown > Autostart which does shutdown the VM when the user logs out. However, it still aborts the actual logout and the user has to log out again.

Is there a way to turn off this feature?
I don't know how to turn it off but it is easy to circumvent:
1) mouse click on host desktop so it becomes active then press ctrl - alt - L for a bit longer (if you do this too short then you get logged out and logged in instantly)
2) if you have virtual desktops, just switch to another desktop and press ctrl - alt - L

both ways work for me

hope this will help
 
Old 02-05-2018, 11:42 AM   #3
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,593

Original Poster
Rep: Reputation: 179Reputation: 179
Thanks, I'll experiment with that, but it's not entirely satisfactory. This workstation is in production in an office and the user is an accountant, not a techy. They can click on things to log out (KDE Launcher > Leave), but would like be more adverse to using a "secrect" key combination than doing the logout twice. Like I said, it's a great feature and one not present in Kubuntu and one reason I chose Slackware/KDE, but if it can't be disabled I'll remove the shutdown script and let the user do it the old way.
 
Old 02-05-2018, 05:45 PM   #4
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,593

Original Poster
Rep: Reputation: 179Reputation: 179
The message I get is, "KDE Workspace / Logout canceled by '/opt/VirtualBox/VirtualBox'
 
Old 02-05-2018, 08:34 PM   #5
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,593

Original Poster
Rep: Reputation: 179Reputation: 179
I've done more searching on this. There are DOZENS of posts on the Internet about this issue -- none of them have resolutions. In addition to VirtualBox, other packages exhibiting this phenomenon that I've come across are ckb, seafile, smplayer, Steam, Viber; with distros: Kubuntu, Archlinux, Manjaro.

So, this appears to be a KDE issue, not necessarily related to VirtualBox or Slackware.

Do any KDE experts know how to turn this off? So far, none of the above listed reports have a solution, so maybe we just have to live with it.
 
Old 02-06-2018, 10:42 AM   #6
Aeterna
Senior Member
 
Registered: Aug 2017
Location: Terra Mater
Distribution: VM Host: Slackware-current, VM Guests: Artix, Venom, antiX, Gentoo, FreeBSD, OpenBSD, OpenIndiana
Posts: 1,011

Rep: Reputation: Disabled
Quote:
Originally Posted by mfoley View Post
I've done more searching on this. There are DOZENS of posts on the Internet about this issue -- none of them have resolutions. In addition to VirtualBox, other packages exhibiting this phenomenon that I've come across are ckb, seafile, smplayer, Steam, Viber; with distros: Kubuntu, Archlinux, Manjaro.

So, this appears to be a KDE issue, not necessarily related to VirtualBox or Slackware.

Do any KDE experts know how to turn this off? So far, none of the above listed reports have a solution, so maybe we just have to live with it.
I don't think that there is anything wrong with KDE and Virtualbox (I don't know about other software).
If you logout then any user running sessions - including vb - will be shut down. Because vb is running whatever os guest then logging out will in fact kill running os in unclean manner assuming that guest os is running some applications.

While you can lock user (crtl+alt+L) and switch user with running vb, logging out/killing guest os is not the best idea.

I would think that vb is not the best idea for your multiuser setup.
 
Old 02-07-2018, 08:42 AM   #7
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,593

Original Poster
Rep: Reputation: 179Reputation: 179
Aeterna - As mentioned, I do have a KDE shutdown script that works fine to shutdown the VM when a user logs out. What I want is for after that script runs, the logout process to complete and go ahead and log the user out. Instead, the VM is shutdown via the script, but the user gets the message "KDE Workspace / Logout canceled by '/opt/VirtualBox/VirtualBox'" and the user has to Leave/Logout again.

I don't know if this is a KDE thing or a VirtualBox thing. As mentioned in my post #5, lots of other programs exhibit this phenomenon with KDE on platforms other than Slackware. That leads me to believe there is something KDE related. On the other hand the message says, "canceled by ...VirtualBox", and other programs (Thunderbird, LibreOffice, Firefox) don't exhibit this behavior, they just stop; so perhaps it is an issue with VirtualBox. I've submitted a bug report to VirtualBox: https://www.virtualbox.org/ticket/17528 which is actually a re-open request for a bug report on this going back 4 years ago. We'll see if there is any response.

Last edited by mfoley; 02-07-2018 at 08:43 AM.
 
Old 02-08-2018, 06:51 AM   #8
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,065

Rep: Reputation: Disabled
To make sure that the problem doesn't come from your script please post it and tell us how it runs, in other words what modifications you made so that it runs when the user logs out.

This will also allow us to try to reproduce this behavior, thus confirming the issue.

Last edited by Didier Spaier; 02-08-2018 at 06:57 AM.
 
Old 02-08-2018, 12:24 PM   #9
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,593

Original Poster
Rep: Reputation: 179Reputation: 179
in ~/.kde/shutdown/shutdown:
Code:
#!/bin/bash

LOGFILE=$HOME/logfiles
if [ ! -e $LOGFILE ]; then mkdir $LOGFILE; fi
LOGFILE=$LOGFILE/shutdownVM.log

echo Shutting down VMs

if [ "$1" = "shutdown" ]
then
    mode="acpipowerbutton"
    shift
else
    mode="savestate"
fi

if [ $USER != root ]
then
    VM=`/usr/bin/VBoxManage list runningvms`
    VM=`echo $VM | awk '{print $1}' | tr -d "\""`

    if [ -n "$VM" ]
    then
        echo `date "+%Y-%m-%d %H:%M:%S"` Shutting down \($mode\) VirtualMachine $VM for user $USER >> $LOGFILE
        /usr/bin/VBoxManage controlvm $VM $mode
    fi

    exit 0
fi

Last edited by mfoley; 02-08-2018 at 12:27 PM.
 
Old 02-08-2018, 05:04 PM   #10
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,065

Rep: Reputation: Disabled
I could reproduce this behavior but sorry, no clue.

Incidentally, unless I miss something this script is run by KDE itself without arguments, so $1 being not set mode is always set to powerstate.
 
Old 02-08-2018, 09:43 PM   #11
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,593

Original Poster
Rep: Reputation: 179Reputation: 179
Quote:
Originally Posted by Didier Spaier View Post
Incidentally, unless I miss something this script is run by KDE itself without arguments, so $1 being not set mode is always set to powerstate.
That is correct. The default is to save the state of the VM. I also have an Autostart script that starts to VM when the user logs in. This shutdown script can also be run manually from the command line by any user, so there is the option to do a VM shutdown if desired.

What's interesting is that if I shutdown the VM manually from the VM, then logoff there is no such problem, so there must be some communication between VM and KDE to prevent the logout even after a successful ~/.kde/shutdown script. I've tried putting a long sleep in the script after VM shutdown, but that didn't help.

Thanks for your extra effort. So far no responses on the VirtualBox ticket. It's probably not a high priority for them.

Last edited by mfoley; 02-08-2018 at 09:57 PM.
 
Old 02-09-2018, 12:17 PM   #12
Ian M
Member
 
Registered: Oct 2017
Location: UK
Distribution: Slackware 15
Posts: 39

Rep: Reputation: Disabled
I don't know if this will work or if it's a good idea but you can logout of KDE using the command
Code:
kquitapp ksmserver
so you could try adding that to your shutdown script after the VM has been shutdown, maybe that will force a logout. If you google "KDE logout command" there's other ways to do it if that doesn't work.
 
Old 02-09-2018, 08:43 PM   #13
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,593

Original Poster
Rep: Reputation: 179Reputation: 179
Ian M: good idea, but it didn't work. I'll check out your search suggestion.
 
  


Reply

Tags
kde, logout, virtual box



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to : Open Virtual Machine Manager to create a new virtual machine BKChicago Linux - Newbie 2 11-08-2016 09:48 PM
how to know the remote machine is Virtual machine or physical machine pantdk Linux - Server 19 10-16-2014 01:48 PM
Is base memory of virtual machine used when virtual machine is not running? ravisingh1 Linux - Virtualization and Cloud 3 04-09-2013 03:41 AM
Running virtual pc files in a virtual machine in linux ... preferably virtual box biharibong Linux - Software 4 01-21-2009 01:04 PM
In KDE, can alt+mouse1 permit to Windows to be dragged to next workspace ? Xeratul Linux - General 1 12-17-2006 01:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 07:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration