Jump to content

i need some help in regards to fixing a problem an or making a .desktop file for auto-functions

is ther a way to make one that will open an perform certain tasks


specifically for some reason when my pop os custom pc boots to the main screen

 

the two auto mounted drives (the 2nd nvme drive)(an my nas drive) are not recognized by the system even tho both are visible in the main file locations window ,unless i open the my locations window an with the mouse click on both

they dont seem to be awake meaning unless i click on both after boot any program that is set to save or download or render to them will save , download , or render to my main os nvme drive which is what i dont want because it would

 

fill up quick but

 

also defeat the primary purpose which is backup

 

so is ther a way to make a .desktop file that will fix this problem an if so how would i write it

Link to comment
https://linustechtips.com/topic/1386980-auto-mount-issues-pop-os/
Share on other sites

Link to post
Share on other sites

You use /etc/fstab to mount local drives at boot.

 

1) From terminal do blkid and find the drives UUID in the list

2) nano /etc/fstab

3) Add the following line to it bottom of it

Quote

UUID=b6c9d0fe-edc5-4be4-b979-f1749701ecb5       /run/media/*acctname*/*drivename*    ext4            rw,relatime                                             0 2

4) Change the following...

UUDD to your drives UUID

/*acctname*/*drivename* to your user account name and an easy to remember mount point name, example /run/media/steve/apps

ext4 to whatever filesystem the drive is using

5) Do sudo mkdir /run/media/acctname/drivename (as you set it above)

6) Reboot and it should auto mount

 

For network drives you can also use fstab but I found it to be unreliable so instead I use a systemd service to mount my NAS drives before the OS has even finished loading.

 

I'll just give you my file as an example and explain a few points

Quote

# /etc/systemd/system/mnt-nfs.mount

 

[Unit]
Description=Mount home at boot

 

[Mount]
What=192.168.0.40:/volume1
Where=/mnt/nfs
Type=nfs
TimeoutSec=30

 

[Install]
WantedBy=multi-user.target

 

So obviously you need to adjust the What value to your own share address

 

Where is important. First you must make sure the directory exists (so using my example "mkdir /mnt/nfs") and second you must ensure the service name matches the mount point name otherwise you'll get errors. So again for my example the service MUST be called mnt-nfs.mount If you wanted to use /mnt/steve then the service must be called mnt-steve.mount.

 

Type is the filesystem type you are mounting. NFS is obvs NFS, if you want to mount a SMB share then its cifs

 

Next save the file into /etc/systemd/system/mnt-whatever.mount

 

Then you'll need to install either cifs-utils or nfs-utils

 

Finally do systemctl enable --now mnt-whatever.mount

 

This will run during every boot and mount your drives for you.

Main Rig:-

Ryzen 7 3800X | Asus ROG Strix X570-F Gaming | 16GB Team Group Dark Pro 3600Mhz | Corsair MP600 1TB PCIe Gen 4 | Sapphire 5700 XT Pulse | Corsair H115i Platinum | WD Black 1TB | WD Green 4TB | EVGA SuperNOVA G3 650W | Asus TUF GT501 | Samsung C27HG70 1440p 144hz HDR FreeSync 2 | Ubuntu 20.04.2 LTS |

 

Server:-

Intel NUC running Server 2019 + Synology DSM218+ with 2 x 4TB Toshiba NAS Ready HDDs (RAID0)

Link to post
Share on other sites

@Master Disaster Is the right way to fix your drive mounting issues.

3 hours ago, johnny45 said:

making a .desktop file for auto-functions

is ther a way to make one that will open an perform certain tasks

If you want to know how to make desktop launchers for other reasons we'd need to know what Distribution and Desktop you're running.

You can find this via GUI on some distros and terminal on all of them.

  • Terminal:
lsb_release -a && echo "Desktop Environment: "$XDG_CURRENT_DESKTOP
  • GUI: Unfortunately as there are many forks in linux there is no one stop answer for this so below are a few example apps that may or may not exist on your linux distro that would allow you to view your distro and desktop information.
    • System Information
    • About
    • Settings, subheading About

 

Link to post
Share on other sites

17 hours ago, LurkAndLoiter said:

@Master Disaster Is the right way to fix your drive mounting issues.

If you want to know how to make desktop launchers for other reasons we'd need to know what Distribution and Desktop you're running.

You can find this via GUI on some distros and terminal on all of them.

  • Terminal:
lsb_release -a && echo "Desktop Environment: "$XDG_CURRENT_DESKTOP
  • GUI: Unfortunately as there are many forks in linux there is no one stop answer for this so below are a few example apps that may or may not exist on your linux distro that would allow you to view your distro and desktop information.
    • System Information
    • About
    • Settings, subheading About

 

No LSB modules are available.
Distributor ID:    Pop
Description:    Pop!_OS 21.04
Release:    21.04
Codename:    hirsute
Desktop Environment: pop:GNOME

 

Link to post
Share on other sites

@johnny45

Use an Editor to create a new file on the desktop name doesn't really matter but the contents do.

Below is a generic desktop launcher. All of the fields included excluding Terminal are the required basics. Why did we include terminal? Because we want our launcher to do some magic at the click of a mouse.

[Desktop Entry]
Name=Hello World
Exec=HelloWorld.sh
Icon=browser
Terminal=true
Type=Application

HelloWorlddesktop.png.b374bb698b59e147df93357f3f6bc012.png

 

You can see above that this launcher will use a terminal to execute something called HelloWorld.sh. HelloWorld.sh is nothing to special it just writes a file to our desktop named HelloWorld.txt with the contents being Hello World!

HelloWorldsh.png.a681957efb748235d2c5f397128c7838.png

As you can imagine being able to run stored scripts with a desktop launcher the potential to do rather mundane or even extremely complicated and concise tasks can be simplified into a simple click with some setup.

 

So where is HelloWorld.sh? Well on PopOs we have a user bin that is already configured into the $PATH by default. As shown below I have a bin located in my /home...directory. the $PATH is where Terminal looks for executables. So we'll be creating our executable in /home/YOURNAME/bin/HelloWorld.shPATHforbin.png.e425ac7e114d5d966cfe74ef1732ca65.png

 

#!/usr/bin/env sh

echo "Hello World!" > ~/Desktop/HelloWorld.txt

Now before we can run HelloWorld.sh we need to make it executable. We can do this in Terminal or by GUI, just locate the bin folder and then right click go to properties, permissions tab and check the Execute check box.

In Terminal we can simply chmod the file and add execute permissions to the file.

chmod +x ~/bin/HelloWorld.sh

 

At this point we need to also add execute permissions to the Desktop Launcher file.

 

LauncherProperties.png.42b0f09a42ab801f612b37295a3fd815.png

 

Now when you right click the desktop shortcut you should see an option to "Allow Launching".

AllowLaunching.png.88f8443e6bdc4b5135bfff863664afbb.png

 

If you do not see Allow Launching then there is something broken in our setup.

  • Check the Desktop Launcher and HelloWorld.sh for typos. for example having Exec=HellowWorld.sh could cause this to be unlaunchable.
  • make sure HelloWorld.sh and DekstopLauncher are executable.

At this point you should have a launcher that looks like:

HelloWorldDesktopLauncher.png.b0f6c766e89ca784912022e52bb80ca7.png

This Launcher should generate a text file on your desktop after being clicked.

 

Though this is a relatively useless desktop launcher. Now that you know how to launch a custom made script the potential is endless. GLHV.

 

PS. your script HelloWorld.sh and any other executable you make in ~/bin would also be launchable in terminal from any location by just typing out their name.

Link to post
Share on other sites

1 hour ago, johnny45 said:

No LSB modules are available.
Distributor ID:    Pop
Description:    Pop!_OS 21.04
Release:    21.04
Codename:    hirsute
Desktop Environment: pop:GNOME

 

sudo apt install lsb-core

Main Rig:-

Ryzen 7 3800X | Asus ROG Strix X570-F Gaming | 16GB Team Group Dark Pro 3600Mhz | Corsair MP600 1TB PCIe Gen 4 | Sapphire 5700 XT Pulse | Corsair H115i Platinum | WD Black 1TB | WD Green 4TB | EVGA SuperNOVA G3 650W | Asus TUF GT501 | Samsung C27HG70 1440p 144hz HDR FreeSync 2 | Ubuntu 20.04.2 LTS |

 

Server:-

Intel NUC running Server 2019 + Synology DSM218+ with 2 x 4TB Toshiba NAS Ready HDDs (RAID0)

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×