0

I have 18.04 and default desktop (IMHO GNOME) and XFCE. I need my home directories are located on external HDD and I can unmount it at any time.

Today I was surprised when I unmounted HDD and mounted HDD at once and then I tried to get access to XFCE. I got an error:

Unable to Load Failsafe Session
...

I understood that I need to restart XFCE.

xfce4-session-logout doesn't suit me in that case. It shows dialogue and doesn't log out itself.

When I work I use Windows (where no opportunity to install X11 or emulator of X11) and the remote connection (XRDP, SSH).

After work I do that:

killall -u user1
umount /mnt/hdd1

I can unmount HDD 'cause I do killall. I manually do these actions via SSH only.

What commands do I need to restart XFCE/GNOME (I think that it has the same problem) without any dialogues via SSH?

UPDATE:

Maybe, I change the structure of unmounting HDD. Let's say I logout DE first. But what commands are?

[logout from DE]
killall -u user1
umount /mnt/hdd1

It seems I need commands for log out all users logged into DE.

Bob
  • 208
  • 1
    You're asking for problems in my opinion if you want to umount $HOME before you logout of a GUI. Maybe I'm missing something in your request, but to me it doesn't make sense (being very risky) – guiverc Oct 06 '20 at 03:42
  • @guiverc Why do you think it's very risky (killall safely shut down any app, is it)? And how do safely disconnect HDD? – Bob Oct 06 '20 at 05:29
  • 1
    Desktops (as in GUI) tend to create & expect many config & other files to remain present, those vary in location but almost all desktop store them somewhere in $HOME (home directory). The GUI should be exited before any home directory is unmounted. The risk as I see it is potential for corrupted files (data unable to be completely written because of the unmount), the problems occurring in subsequent boots or in the future.. The effects will vary on DE & applications in use. – guiverc Oct 06 '20 at 05:30
  • @guiverc But IMHO killall is to give the safety, it correctly completely finish all apps. If I'll do unmount without killall, HDD doesn't unmount because other apps use it. With killall HDD isn't used by anyone apps. I checked it with lsof. Or I'm wrong? – Bob Oct 06 '20 at 05:55
  • I said the effects will vary on DE & applications in use. I don't know what applications you're using & thus killing so you'll have to assess what applications are running to decide which are risky & which are safe. For apps that only read data there will be no risk, but applications vary in how they write data... (opinion, but note your DE itself is a program, so its reliability will/may be lost unless user is logged out first) – guiverc Oct 06 '20 at 06:05
  • @guiverc Hm... I understand you. It looks like we come to opinion what I need console commands to log out from DE. FS will be safe 100% if they are existent. I'll edit the post. Thanks for the explanation. – Bob Oct 06 '20 at 06:53
  • @guiverc I leave killall for bash, sudo and other shell apps. – Bob Oct 06 '20 at 07:02
  • I’m smelling an XY problem here… What is the purpose of having the whole $HOME on an external hard drive? See https://askubuntu.com/a/842929/250300 for a viable alternative. – Melebius Oct 06 '20 at 07:45
  • @Melebius, There is no need to look for what is not there. There is no XY problem. So you don't get a score this case. If you are going to help to solve the problem - help to solve, don't need to make spam or flood as last times. I thought about do not store $HOME at the external drive, unfortunately, it destroys my other real structures. If I will not find the solution to this problem I will be forced to reject this idea but I will store $HOME at the external drive. It's simpler for me. – Bob Oct 06 '20 at 08:30

0 Answers0