Author Topic: pm-utils?  (Read 600 times)

Offline poohduck

  • Newbie
  • *
  • Posts: 21
  • motorbikes, mountain bikes, photography
pm-utils?
« on: November 20, 2017, 11:55:54 am »
I have an ssd. I don't know whether it was enabled or not, but I used systemctl to prevent suspend and hibernate from running. My questions are:

1. can I uninstall pm-utils?

2. is there a way to modify the shut down menu to get rid of hibernate and suspend?

Kind regards :)

Offline penguin

  • Newbie
  • *
  • Posts: 43
Re: pm-utils?
« Reply #1 on: November 20, 2017, 12:39:26 pm »
Read this post :

[codehttps://sparkylinux.org/forum/index.php/topic,4164.msg10296.html#msg10296
Code: [Select]

also this

[ocde]https://forum.manjaro.org/t/fstab-okay-for-ssd/894/6

Offline poohduck

  • Newbie
  • *
  • Posts: 21
  • motorbikes, mountain bikes, photography
Re: pm-utils?
« Reply #2 on: November 21, 2017, 01:03:11 am »
Thanks Penguin. I'm ok with trim, I think :) Part of the whole ssd thing was to disable hibernate and suspend, which I've done even though I don't know whether it was enabled or not. So, I'd like to uninstall pm-utils, and if possible modify wm-logout so that suspend and hibernate no longer show, or just get rid of wm-logout and use openbox alternative? (I'm using the minimal install)

Offline poohduck

  • Newbie
  • *
  • Posts: 21
  • motorbikes, mountain bikes, photography
Re: pm-utils?
« Reply #3 on: November 21, 2017, 03:06:16 am »
I have modified the shutdown menu now. The only thing I'm aware of that may not be elegant is my reboot command. I have the minimal install, so using openbox as windows manager (if I understand correctly). In the shutdown menu I replaced wm-logout with the command "openbox --exit". So now when I click on computer icon I get a meu that shows Logout, Reboot and Shutdown. My concern is that if I have programs open and run the openbox --exit command, what happens to those programs? Are they shut down correctly?

I did all the above in Advanced Settings, Panel.

Offline poohduck

  • Newbie
  • *
  • Posts: 21
  • motorbikes, mountain bikes, photography
Re: pm-utils?
« Reply #4 on: November 21, 2017, 03:56:44 am »
I think I'm all good re the logout command I have used. I continued trying to find how to modify wm-logout and in the process it looks as though wm-logout uses this same command (openbox --exit) :) So, I have removed wm-logout :)

Offline poohduck

  • Newbie
  • *
  • Posts: 21
  • motorbikes, mountain bikes, photography
Re: pm-utils?
« Reply #5 on: November 21, 2017, 11:28:15 am »
Nothing is simple with this. I can search and read and try and nothing works. There isn't much info on sparky, so I look for instruction for debian. Even something that I would have though would be really simple - create a script to run trim on 2 different partitions; something I can just click on manually. Nothing works in sparky. For example, I've spent a couple of hours just trying to follow this: https://joao.machado-family.com/2014/04/01/linux-ssd-trim-setup/ to get a script to run on shutdown by putting it in /etc/rc0.d. It looks simple but just won't work. Very frustrating. How do you guys get stuff done?

Offline penguin

  • Newbie
  • *
  • Posts: 43
Re: pm-utils?
« Reply #6 on: November 23, 2017, 07:23:45 am »
I use xcfe desktop. I have modified my logout dialog that shows only LogOUT, Restart and ShutDown.

Code: [Select]
https://www.linuxquestions.org/questions/linux-desktop-74/change-logout-layout-from-xfce-871357/
I use ssd and from Power Manager or Settings Editor I can disable/change hibernate or suspend and so on.

Maybe OpenBox ,LXQT or LXDE are lighter than XCFE but I can find things easily on it.   

Offline poohduck

  • Newbie
  • *
  • Posts: 21
  • motorbikes, mountain bikes, photography
Re: pm-utils?
« Reply #7 on: November 23, 2017, 01:06:06 pm »
openbox is a windows manager as opposed to a desktop environment. From what I understand it's a lot lighter - definitely not as user friendly
« Last Edit: November 24, 2017, 07:11:56 am by poohduck »

Offline penguin

  • Newbie
  • *
  • Posts: 43
Re: pm-utils?
« Reply #8 on: November 23, 2017, 04:58:07 pm »
Much lighter much not user friendly. You must to be a Pro :).
Try XCFE. A good balance of memory resources and what offer.Install XCFE, do not uninstall. Next time you boot in XCFE.
When you will be ready for OpenBox return back and use it.

Offline poohduck

  • Newbie
  • *
  • Posts: 21
  • motorbikes, mountain bikes, photography
Re: pm-utils?
« Reply #9 on: November 24, 2017, 07:16:43 am »
just trying to maximise this ancient netbook. It has atom n450 processor and originally 1gb ram new for $200 about 8 years ago. I've upped the ram to 2gb (max) and put in the ssd, which was cheap. Traditionally on windows machines I'd get rid of everything I could, minimise running processes, services etc to maximise performance AND minimise problems. I'm just carrying over that ethos to linux :) I do it on my phones too. I see a friend's new laptops and think - this shit heap would drive me nuts; it's like wading through treacle.

Offline penguin

  • Newbie
  • *
  • Posts: 43
Re: pm-utils?
« Reply #10 on: November 24, 2017, 10:40:37 am »
Hi poohduck ! For You and any other that want to migrate to Linux.

Hmmmm... If you find a a cheap lenovo x201(this is great because boot natively from SD Card) , x220, x230 or T410,T420,T430 or Hp 8470p, Hp 2570p (Look at Elite hp laptops Wiki
Code: [Select]
https://en.wikipedia.org/wiki/HP_EliteBook - for more info). 
But for a very good performance you should replace your hdd with ssd. For this you need :
Find/install cheap 64GB/128GB SSD and mount your hhd in a caddy as second hdd.
or
If Laptop can boot from Micro SATA SSD (read catalog/user manual book of your machine),install Micro SATA SSD intead of SSD ( Lenovo T430 maybe X230 can boot from Micro SATA SSD and you can install it on Ericson wireless slot,backside your laptop,near memory slots or on a free reserved wireless slot device - read manuals or see on Internet forums ).
or
If your Machine/Laptops that can boot from SD Card (find a cheap 16-32GB SD Card,install Linux on it, boot and Run Linux from SD Card).
Install Sparky on them and you really  amaze your friend :)

About fstrim

look here :

Code: [Select]
https://sparkylinux.org/forum/index.php/topic,4164.msg10296.html#msg10296
shortly :

Code: [Select]
https://blog.liw.fi/posts/2017/08/05/enabling_trim_discard_on_debian_ext4_luks_and_lvm/
your fstab should be changed as suggested in this forum:

Code: [Select]
https://forum.manjaro.org/t/fstab-okay-for-ssd/894/6
to see if fstrim service  is enabled use in terminal these commands

// to see what timers are active
systemctl list-timers

// to see if a service is active or enabled
systemctl is-active fstrim.service     (or just fstrim - I am farway Linux machine to verify this )
systemctl is-enabled fstrim.service  (or just fstrim - I am farway Linux machine to verify this )

//to see journal of fstrim , log activity of fstrim
journactl - U fstrim


Some tricks from my arch and debian linux distros

+++++++++++++++++++++++
Some trciks that I grabed from my text file.

// journalctl related
journalctl --boot=-0 last boot
journalctl --since "20 min ago"
journalctl --vacuum-size=500M 
journalctl -u *some service


// list timers
systemctl list-timers

//check if service is active or enabled
systemctl is-active *service
systemctl is-enabled *service


//choose a service to start or stop
sudo systemctl enabled *service
sudo systemctl start *service
sudo systemctl stop *service
sudo systemctl disable *service


// list of failed services
systemctl #failed
systemctl status systemd-modules-load # failed  to start kernel modules

find more here :

Code: [Select]
https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units
// list all packages and output to a file under user directory
dpkg --list >~/packages_till_$(date +%F_%T:%3N)

// simple bash file saved under /usr/local/bin  > shortcut to desktop > speedtest of your internet ine
#!/bin/sh
curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python -
read -n 1 -s -r -p
"Press any key to continue"

or simply in terminal
curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python -

// simple bash file saved under /usr/local/bin  > shortcut to desktop > test uour download internet speed
#!/bin/sh
wget --output-document=/dev/null http://speedtest.wdc01.softlayer.com/downloads/test500.zip
read -n 1 -s -r -p "Press any key to continue"

or simply in Terminal
wget --output-document=/dev/null http://speedtest.wdc01.softlayer.com/downloads/test500.zip

++++++++++++++++++++++++++++++++++++++

How to make a file executable  and create a launcher in your desktop?

Example
+++++++++++++++++++
#!/bin/sh
curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python -
read -n 1 -s -r -p
"Press any key to continue"
+++++++++++++++++++
1-Save all rows in a file. Lets say save file names MySpeedTest in your desktop.
2- Cope (somewhere) let's say under your file under directory /usr/local/bin by command
sudo cp MySpeedTest /usr/local/bin
3- Make it executable
sudo chmod 755 /usr/local/bin/mySpeedTest

Now create launcher in your desktop to this file.

How to run a sh (script file) file in Linux?

Code: [Select]
https://askubuntu.com/questions/38661/how-do-i-run-sh-files
For additional info for about commands just make a google search.

Hope that this helps !
« Last Edit: November 24, 2017, 10:47:04 am by penguin »

Offline poohduck

  • Newbie
  • *
  • Posts: 21
  • motorbikes, mountain bikes, photography
Re: pm-utils?
« Reply #11 on: November 24, 2017, 11:49:27 am »
Dear Penguin, you're an awesome mentor.

Thankyou for your comprehensive answer. I didn't want to rebuild everything; pride I suppose, learning how to fix things and keep them going rather than starting from scratch again, which can go on forever because there is usually some issue.

I'm all good. Var and Home are on their own partitions. Not only that, but my original home was really /home/basil - it still is that. I copied all to a folder in sda3 named basil. Then mounted sda3 to /home - so I still have /home/basil :)

With the

trim command:

*sda1
fstrim -v /

*sda3
fstrim -v /home

*sda4
fstrim -v /var. I tested these individually then put them (as you have suggested) into fstrim.sh along with output to a log file - all looks good. There is a symbolic link to etc/init.d/fstrim.sh in rc0.d so that the commands are run on shutdown. I think this is pretty elegant, cleaning up any deletions after a session seems better than a cron job which might run when you're busy, or might not run because the system isn't on - all a bit hit / miss.

At this point, I'm happy with everything. I consider the netbook finished :) I did get rid of firefox and installed opera - I really like this browser. Have also installed opera on phones. You can actually disable ads playing videos which you can't quite do in firefox - other better options for security, tracking etc, that firefox doesn't quite stop anything really. And it's faster.

Offline poohduck

  • Newbie
  • *
  • Posts: 21
  • motorbikes, mountain bikes, photography
Re: pm-utils?
« Reply #12 on: November 24, 2017, 12:35:15 pm »
actually, just checked out my fstrim.sh script, it hasn't been working. I came up with a more concise script that does work on the 3 different partitions and outputs the log file:

#!/bin/sh
#
#
#
#Run "fstrim" command on sda1, sda3 and sda4
LOG=/var/log/trim.log
fstrim -a -v / >>$LOG
echo "Time: $(date)" >>$LOG
exit 0

The trick is in the -a option: trim all mounted filesystems on devices that support the discard operation. Sure enough, it trims the 3 partitions (the only other partition is swap). And again, it runs on shutdown or reboot (rc0.d)

Offline penguin

  • Newbie
  • *
  • Posts: 43
Re: pm-utils?
« Reply #13 on: November 24, 2017, 01:00:39 pm »
I do not know how you activated your trim service. Read links I gave in the previous post, because is the faster way to activate services. Tried and by me and I confirm as successful way. Remember Unix philosophy. KISS - Keep It Simple Stupid.
« Last Edit: November 24, 2017, 01:02:54 pm by penguin »

Offline poohduck

  • Newbie
  • *
  • Posts: 21
  • motorbikes, mountain bikes, photography
Re: pm-utils?
« Reply #14 on: November 28, 2017, 02:23:41 am »
thanks penguin. I actually like my implementation of trim at shutdown or reboot. It seems more elegant to clean up anything at the END of the session rather than trying to pick a time to run it which seems a bit hit and miss (will the netbook be on at that time? Will the netbook be busy at that time? Will thers be any need to run trim at that time (you might delete heaps of stuff after the command runs).

I have refined the command again (refining), learning as I go along. I noticed that I still had a mistake in there with / (root). This is what it should be:
#!/bin/sh
#
#
#
#Run "fstrim" command on sda1, sda3 and sda4
LOG=/var/log/trim.log
fstrim -a -v >>$LOG                  (no / after the -v like I had in previous post)
echo "Time: $(date)" >>$LOG
exit 0

So basically the above just says find all file systems eligible for trim command (that's the -a). Display all the details (that's the -v). Output the results to a log file with date and time. I found the info to do this from an article - https://joao.machado-family.com/2014/04/01/linux-ssd-trim-setup/

I modified the instruction in the link. In the link the guy has the script running hourly, on start up, on shut down and on reboot. I just wanted to run it at shutdown but by putting the script in the one place (rc0.d) it runs at shutdown and reboot. This seems ideal. I have a symlink in documents to the log file so that I can check on it next time I boot in. I'm only really using the log file to confirm whether it has run or not while I was playing around with the script. It is solid now.