Tuesday, June 01, 2021

Mount your Virtualbox OS Guest file system as a Hard Drive in Ubuntu

In case something is broken within your VirtualBox Guest OS or if you just want to access the files, the following will allow you to mount your VirtualBox Guest OS disk images in your Ubuntu (Host) like it's an attached hard drive or just another directory.  This access will have full read/write permissions so you'll be able to copy files to/from it, delete files, or change files on your VirtualBox Guest OS.

Make sure your VirtualBox Guest OS is shutdown and the virtual disk image is NOT in use. 

NOTE: Remember to UN-MOUNT it once your finished accessing the Guest OS files (see below).


Let's get started:

1.  Open a Terminal Window. Run the following command:

vboximg-mount --list

vboximg-mount  is how you make your VirtualBox Disk Images (Guests) available to the Host. The --list option will list all VirtualBox Disk Images along with their UUID.

2.  Next perform a FUSE mount of the virtual disk image:

Create a folder as a mount point. In this case let's use vboxdisc:

mkdir vboxdisc

Then enter the following command:

vboximg-mount -i UUID -o allow_root vboxdisc

NOTE: (remember to replace the UUID with your own in the above command): 

NOTE: You might need to edit the “/etc/fuse.conf” to allow the -o allow_root flag to work. To do this run the command sudo gedit /etc/fuse.conf and enable, by remove # at it's beginning, “user_allow_other” line.

3.  Now mount your partition (vol2 for instance) to /mnt by typing the following command:

sudo mount vboxdisc/vol2 /mnt

NOTE: change vol2 to match your partition name.

4.  Finally go to the /mnt directory to see your Guest OS files.


*************************************************************

Remember to UN-MOUNT once your finished accessing the Guest OS files.


How to Unmount:

To unmount the VirtualBox Guest OS file system, run the following command:

sudo umount /mnt

To unmount the VirtualBox Disk Image, run the following command:

umount ~/vboxdisc

And finally to remove ~/vboxdisc  folder run the following command:

rm -r ~/vboxdisc

Tuesday, May 11, 2021

Useful TERMINAL Commands

I will try to keep updating this post with useful Terminal shortcuts and commands I find helpful.  So bookmark this one and leave any commands you think should be added in the comments and I'll move them to the main post.

Don't get writers block at the Terminal Window


sudo !!

This runs the last command you typed but runs it as sudo.  If you typed a long command and forgot to start it with sudo or didn't know you needed sudo, instead of retyping the whole thing or using UP ARROW to paste the command back in, just type sudo!! and hit ENTER.  This will add the sudo and re-run the command as soon as you press the ENTER key.


CTRL x e

To use this just hold the CTRL key, press x, then press e while still holding down the CTRL key.  This will open the nano text editor where you can type out whatever commands you want to run in Terminal even multi lines.  Think of it as a one use bash script file. When you exit nano your typed in commands will then run in your open Terminal window.


ls -h --group-directories-first --color=auto

This command displays a directory list in colors and puts folders first, organizing them in ascending alphabetical order. Following the folders are the files in said directory also listed in ascending alphabetical order.  It's a little long so you may want to open a text editor and save it as a bash script, that's what I did, so now I can just type l (lower case L) in my terminal and a nice colored, folder first, directory list appears.  HERE is a quick guide on how to write a bash script, make it executable, and add it's folder to your PATH.  The only thing I notice that this tutorial didn't say was you SAVE your script file as a .sh files in a folder that is in your PATH.


mv FileName.txt NewFileName.txt

To RENAME a file you use the command mv for some reason. Simple repalce FileName.txt with the file name you want to rename and replace NewFileName.txt with the name you want the file to have. The mv command also functions as a MOVE command too. To use it as a MOVE command just add a destination directory path in front of the NewFileName.txt part. i.e.


mv FileName.txt /home/UserName/Documents/NewFileName.txt

This will move the FileName.txt to /home/UserName/Documents/ directory and rename the file to NewFileName.txt if you don't want to rename the file and just want to move it, then just make the file name the same as it was (mv FileName.txt /home/UserName/Documents/FileName.txt)


Some simple commands I forget:

  • ~  is a shortcut or substitution for the directory /home/userName/  think of it as the root of your home directory.

  • cp FileName.txt ~/Documents/ This copies FileName.txt to the Documents folder in your home directory. cp FileName.txt ~/Documents/NewFileName.txt would copy and rename FileName.txt  to NewFileName.txt and put it in your Documents folder.

  • find . -name "*.bak" -type f -delete  This deletes all files with the .bak extension in your current directory and in all sub-directories below your current directory. BEFORE USING THIS YOU SHOULD RUN  find . -name "*.bak" -type f TO SEE THE LIST OF ALL FILES YOU WILL BE DELETING.  USE WITH CAUTION.

  • rm -r DirectoryName This will remove a directory and everything below it.  This is a recursive delete of a directory or directories and all their files. USE WITH CAUTION. 

  • rmdir dir1 is a safer command that will remove empty directories but will give you an error if dir1 has files or sub-directories in it.  This command deletes the empty directory called dir1 .



chmod options permissions file_name
   
   Examples

  • chmod u=rwx,g=rx,o=r myfile.txt
  • chmod 754 myfile.txt
  • chmod -R 755 /PATH/TO/DIRECTORY

In the first Example above;

The Current User(u=) can read(r), write(w) and execute(x) myfile.txt 
Members of Current User's Group(g=) can read(r) and execute(x) myfile.txt
Others(o=) may only read(r) the file myfile.txt


If you wanted to, you could add r,w and/or x 's to the g= or o= part of that command or take away either r, w, or x from the u= part of that example, BUT YOU SHOULDN'T.  Very, very, rarely do want to give USER, GROUP and OTHERS all permission or take all permission away for all.  With the wrong combinations of r,w, and/or x you could easily lock yourself and everyone else out of access to a file by not giving enough permission to the file or cause security risks by giving too many permissions to your files.  The above example is the most common permissions you will find on user's files (home directories or additional hard drives storage space).  The System Files are another matter and you should read a more in depth article before playing with those permissions.

In the second Example above;
This means the exact same thing as the first example, it's just 
using octal permissions notation.  Here is how it works;

The first position of the 3 digit number, represents the user(u=), the 2nd digit position represents the group(g=), the 3rd digit position represents others(o=).  The actual numbers in those positions are derived from the following table;

4 stands for "read"
2 stands for "write"
1 stands for "execute"
0 stands for "no permission."

By simply adding the above numbers together you will get a single digit number that will represent the permissions you want the User, Group and Others to have.  Lets say you want to give User full access (read, write and execute) and you want Group's to just have read access (read) and you want Others to have any write and read but not execution.  All you do is add; you want User to read (4) + write(2) + execute(1). Well that's 4+2+1=7.  So our first number is 7.  You want Group to have only read. Well that's just 4. So our second digit is 4.  You also want Others to have read and write, but no execute. Well that's read(4) + write(2). So it's 4 + 2 = 6.  Our last digit is 6.  You now have your three digit number, 746.  Your command to set those permissions on myfile.txt would be chmod 746 myfile.txt.  

In the third example above we uses an Option;

In the third example we want to change the permissions on all the files and folders and subfolders/subfiles in the directory located at /PATH/TO/DIRECTORY.  This is called a Recursive Change. So if we run the command chmod -R 777 Documents from our Home directory, this would change the permissions of every files, folder, subfolder, and subfiles in the Documents directory allowing everyone full unrestricted access to everything contained in the Documents directory (Not a good Idea BTW).  When using the -R option with chmod you should check all the subfolders and subfiles you'll be changing.  You can use chmod in combination with find for a more selective recursive like change (see chmod Helper Commands below). 
Of special note on options, chmod -r 777 Documents means something completely different from chmod -R 777 Documents  CASE MATTERS -R means Recursive, -r means take away read permissions

Options for chmod

-c, --changes Like --verbose, but gives verbose output only when a change is actually made.
-f, --silent, --quiet Quiet mode; suppress most error messages.
-v, --verbose Verbose mode; output a diagnostic message for every file processed.
--no-preserve-root Do not treat '/' (the root directory) in any special way, which is the default setting.
--preserve-root Do not operate recursively on '/'.
--reference=RFILE Set permissions to match those of file RFILE, ignoring any specified MODE.
-R, --recursive Change files and directories recursively.
--help Display a help message and exit.
--version Output version information and exit.

chmod Helper Commands;

ls -l myfile.txt  
Show a single file called myfile.txt and displays its permissions. Here is what that output will look like;

-rwx-rw-r-- 1 UserName GroupName 2441 May 27  2022 myfile.txt

This mean that the UserName has read(r), write(w), and execute(x) permissions and the group called GroupName has read(r) and write(w) permissions, no execute. And Others have read(r) only permission, no write, no execute. (it also says the file is 2441 bytes in size and was created on May 27, 2022)

ls -l  
This will list all the files in your current directory and show you their permissions. This an easy way to the permissions from a bunch of files all at once.

find . -name "*.sh" -exec chmod +x {} \; 
This example will make all .sh files in the current directory executable.

sudo chown -R UserName:UserGroup DirectoryToOwn
The chown command  above changes the Ownership of every file, subdirectory, and subfile in the directory DirectoryToOwn to be owned by the user UserName and by the group UserGroup.  Most of the time UserName and UserGroup are the same. No space before or after the colon (:).  Leave out the -R and replace DirectoryToOwn with a single file name to just assign ownership of a single file or combine chown with find command (above) for a selective group of files. 

sudo blkid
This list all of your hard drive or other mounted drives (flash, etc..) on your system.  You can use this command to find the uuid of a hard drive or flash drive to use in your fstab file for auto-mounting drives on system boot.



sudo dmidecode --type 17
Want to know what kind of memory is in your system?  This handy command will tell you way more information than you'll ever want.  I need to know my manufactures name and this command returned that information under the TYPE heading.


Thursday, April 15, 2021

HDMI Audio not showing as an option

Ran a update today (4-15-2021) on my Ubuntu 20.04.1.  The update asked for a reset and I think I saw something about kernel 5.4 before the update started (after the update my kernel is 5.4.0-72-generic according to the uname -r command).  

After the reboot I had no audio (I use the HDMI Output to my monitors built-in speakers).  I checked my Sound Setting as some kernel updates in the past have flipped my sound output to Digital Output Built-in Sound.  I checked and sure enough it was flipped.  When I went to change it back there was only one sound output option (Digital Output Built-in), no HDMI to be found.  After some Googling I found this solution that worked for me:

Step 1

Open a terminal and run the following command:

pulseaudio -k

This kills the running sound process

Step 2

Physically unconnect then reconnect your monitor from the HDMI port while Ubuntu is running.

Step 3

Open Sound Settings and you should see the option of HDMI in the Output tab:


Hopefully this written howto will help someone who loses their sound after an update.  When Googling for help on this problem I ran across several videos with solutions but without sound they were not very helpful. 


Saturday, March 20, 2021

Fix Graphic Glitches in Windows 10 running in VirtualBox 6.1

 I was having weird graphical glitches on my guest Windows 10 running in VirtualBox 6.1.18 on an Ubuntu 20.04 host.  Some of the glitches I was seeing were multiple cursors in Photoshop cs6, some menu's needed minimized to see items I checked, show checked (refresh), and some transparency problems (again tied to a screen refresh).  None of these broke the system or caused crashes but were annoying, especially the Photoshop multiple cursor thing.

I noticed that I did NOT have ENABLE 3D ACCELERATION checked on my Virtualbox host. I figured that this might be causing my problems so I checked it.


The multiple cursors magically went away but my transparency and screen refresh problems multiplied exponentially.   Just to use the virtual, I went into my Windows 10 (guest) then to SETTING and turned off TRANSPARENCY EFFECTS in the Windows 10 guest(see screen shot below).  Once I did that everything worked flawlessly.


I've decided that I do not need or even want the transparency effects in Windows 10.  And by Enabling 3D Acceleration on my VirtualBox host for the Windows 10 guest, some programs that had some 3d effects disable are now working.  Win! Win! (minus Windows 10 transparency) 

Saturday, January 16, 2021

Wine 6.0 installing on Ubuntu 20.04

Wine 6.0 has been released as the newest stable build.  You can read about it at winehq.org.  I use Wine to run a couple of MS Windows programs that I haven't found good Linux replacements for (Photoshop and Omniforms,  I know GIMP is a good Photoshop replacement but I'm used to Photoshop and the workflow is not the same, besides I haven't taken the time to learn GIMP)...Anyway, let's install Wine 6.0 on Ubuntu 20.04 LTS (or 20.10 noting the difference in step 3).

Open a Terminal Window and type the following commands:

1.  Enable 32-bit support on your system.

     sudo dpkg --add-architecture i386 

2.  Add the Wine keys to your system.

    wget -nc https://dl.winehq.org/wine-builds/winehq.key

    sudo apt-key add winehq.key

3. Add the repository for Ubuntu 20.04 (only run one of these commands)

IF YOU'RE RUNNING 20.04

    sudo add-apt-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ focal main'

IF YOU'RE RUNNING 20.10

    sudo add-apt-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ groovy main'

4. Install Wine 6.0

    sudo apt install --install-recommends winehq-stable

If you want to check your Wine Version just type the following in a Terminal Window;

    wine --version


That's it you're done.

*NOTES: When I ran Photoshop after the update, Wine asked to install a couple of items it needed to work.  I just clicked on the yes button.  On step 1, I had already enabled this but running the command again did not hurt anything.

Saturday, September 05, 2020

Expand Your Virtualbox Virtual Hard Drives

This How To will walk you through expanding the virtual hard drive size of a guest Windows 10 virtual which is being hosted on an Ubuntu 20.04 machine running Virtualbox 6.1.

There are three sections to this guide.  

Section I is work that needs done from a Terminal Window inside your Linux Host System and from inside the Virtualbox 6.1 program.

Section II is work that needs done from inside you virtual Windows 10.

Section III is work done inside your virtual Windows 10 in an Admin Command Prompt but only needs done if you encounter certain problems in Section II. 

------------------------------------------------------------------------------------------------------------------

SECTION I
Work done in Linux and Virtualbox


1.  Make sure your virtual is shut off.

2. Locate your Windows 10 virtual image file (.vdi).  Mine is located in "/Home/username/VirtualBox VMs/Windows 10 Home/Windows 10 Home.vdi"

3. Make a backup copy of the .vdi file and put it in a safe place (this will take a little time since it is probably several gigs in size, mine was 60gb).

4. Open Virtualbox (not your virtual Windows 10, but Virtualbox itself).

5. Once in Virtualbox, Right Click on your Windows 10 virtual and select SETTINGS.

6. In settings, select STORAGE, then Right Click on your .vdi file (mines called "Windows 10 Home.vdi") and then click on the REMOVE ATTACHMENT.  

NOTE:  Don't worry this does not delete anything it just disconnects it from this virtual.  Think of it as taking the hard drive out of your computer, you can put it back in whenever you want, nothing is lost)

8.  With the .vdi file detached, close Virtualbox

9. Open a Terminal Window and navigate to the location where your .vdi file is located (Mine is in /Home/username/VirtualBox VMs/Windows 10 Home/Windows 10 Home.vdi) (from Step 2).

10 Once you are in the same folder as your .vdi file, type the following into your Terminal Window.

vboxmanage modifyhd "NameOfYourVDIfile.vdi" --resize 128000

NOTE: You will need to replace "NameOfYourVDIfile.vdi" with the actual name of your .vdi file. The 128000 at the end is the new size you want your virtual hard drive to become.  This number is in megabytes (mb) so in this case 128000 mb equals 128gbs.  This number has to be bigger than your original virtual hard drive size (you can't make it smaller this way) and has to be able to fit in your actual physical hard drive's free space (this is your physical computer's physical hard drive). 

11. Once you've made the changes needed to the above command, hit ENTER.  You will then see something that looks like this:

0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

12.  You can now close your Terminal Window, you have resized your virtual hard drive, now you have to reconnect it to your Virtual Windows 10.

13. Open Virtualbox, Right Click on your Windows 10 virtual and select SETTINGS.


14. Once Settings opens select STORAGE then Single Left Click on CONTROLLER:SATA, then Double Left Click on the little picture of a hard drive (circled in red in this slide)


15. Once you've clicked on the little hard disk icon you will be present with the option to pick the .vdi file you want to attach to your Windows 10 Virtual.  Pick your Windows 10's .vdi file that we just expanded.  Mine is called "Windows 10 Home.vdi" and shows up under NOT ATTACHED in the popup window.


16.  If you've done everything right so far you should now see your newly expanded virtual hard drive (.vdi file) reattached to your Windows 10 Virtual like in the slide below.




Congratulation you've expanded your virtual hard drive for your virtual Windows 10 and your Windows 10 virtual machine will now boot but you will not see any difference in the amount of space on your virtual hard drive.  Now we have to tell Windows 10 that it has more hard drive space and we have to expand it's virtual hard drive though Windows 10.

------------------------------------------------------------------------------------------------------------------

SECTION II
Working inside your Virtual


1. Start your Windows 10 Virtual.


2. Once logged in click on START then ADMINISTRATION TOOL then COMPUTER MANAGEMENT and select DISK MANAGEMENT.  You should see something like this slide:


NOTE:  You may see a 4th partition between your C: and the Unallocated block, named Windows Recovery Partition.  If you see this 4th partition (Windows Recovery Partition) you will need to skip to Section III labeled Remove Windows Recovery Partition below this section.  Once you complete all the steps in the Remove Windows Recovery Partition section return to this point and proceed with the remaining steps in this section.

3. Assuming that your partitions look like the slide in Step 2 (Just 3 partitions; System Reserved, C:, and unallocated).  If so, great.  Right Click on on the Block labeled "C:" (One with a blue line over it in the middle).  This will bring up a menu, select the EXTEND VOLUME option which will start a wizard. (if the Extend Volume option is grayed out then read the NOTE in Step 2 above)


4.  Once the wizard starts you can pretty much just accept the defaults until the wizard finishes.  Here is a walk thru of my wizard:




NOTE: Your partition size numbers will be different than mine base on how much you expanded your virtual hard drive in the first section of this how to.  Generally you just want to accept the defaults which will try to add all the additional space it can. 


5.  When you finish the wizard you now see that you only have two partitions, System Reserved and C:. Congratulation you are done and you can close COMPUTER MANAGEMENT.  Check your C: drive you should now have more room and can breath a little easier.

------------------------------------------------------------------------------------------------------------------

SECTION III
Removing a Windows Recovery Partition
ONLY DO THE STEPS IN THIS SECTION IF YOUR EXTEND PARTITION WAS GRAYED OUT IN SECTION II

If you encountered a 4th partition named Windows Recovery in Section II and it was between your C: and Unallocated partitions, you can not combine the two (C: and Unallocated) without removing the Windows Recovery Partition.  If the option to EXTEND VOLUME is grayed out on your C: partition, removing the Recovery Partition is the only way I know of to proceed. We will need to do this from an Admin DOS Command Prompt from within the virtual Windows 10.  Here's how:

1. From within the virtual Windows 10
 Right-click the Start Menu and select Command Prompt (Admin).

2. Type diskpart and press Enter.

3. Type list disk and press Enter.
 (A list of disks will be displayed.)

4. Type select disk # and press Enter.
 (Replace # with the number of the disk containing the recovery partition) 

5. Type list partition and press Enter.
 (A list of partitions will be displayed.) 

6. Type select partition # and press Enter.
 (Replace # with the number of the recovery partition

7. Type delete partition override and press Enter.

After the confirmation message, you can close the DOS Command Prompt and go back to Section II and finish those steps.

Friday, January 10, 2020

Create Desktop Shortcut Ubuntu 19.10

I'm running Ubuntu 19.10 in a Virtualbox and wanted to create desktop shortcuts to programs so that I can quickly launching them (my machine is still running 16.04 since I skipped 18.04 because of Gnome Desktop).

It shouldn't be this much of a pain to create a desktop shortcut but the Gnome Desktop people think the desktop should be nothing more than a Theme Machine.  The Gnome Desktop looks and acts so much like an Apple Ipad I see Steve Jobs ghost every time I look at it.   Alright enough whining from me it's what we got so let's try to make it work for us our way.

First we need to install Gnome Tweaks.  In Terminal (Command Line) type the following:

sudo apt-get install gnome-tweaks

Once it installs, run it. Now navigate to the EXTENSIONS section and turn on the DESKTOP ICONS option.


That's all you need for Desktop Shortcuts but there are other niceties that Gnome Tweaks offers and it's worth looking over later.

To make our desktop shortcut we need to locate the "launcher" file for our chosen program. These "launcher" files are stored in a couple of locations on Ubuntu systems and they have the extension ".desktop" The ".desktop" files are located in the following two directories:

/usr/share/applications/
/home/YOURUSERNAME/.local/share/applications/

*** replace YOURUSERNAME with your logon name (user name)
*** most ".desktop" files are stored in the first location

To get to the ".desktop" files just launch the FILES program and navigate to one of the two folders where the .desktop files are stored.  (NOTE:  to get to the "/usr/share/applications" you will have to first click on the OTHER LOCATIONS option in the left hand column in FILES)


After Clicking on the OTHER LOCATIONS options you click on the COMPUTER option in the left top section of the FILES program.  After that just navigate to the "/usr/share/applications" folder and find the ".desktop" file for the program you want to create a desktop shortcut for.



Below is where ".desktop' files are stored in your home directory.
They are in a hidden folder so you have to check 
the "Show Hidden" option in FILES

Once you've found the ".desktop" file for your desired program you simple Right Click on it and select COPY.  Then navigate to the DESKTOP directory (left side panel in your FILES program) and PASTE your ".desktop" file into the DESKTOP folder.

That will make the ".desktop" file appear on your desktop but the icon will be wrong and it will not function yet. Below you can see that I copied and pasted the ".desktop" file for the program Darktable.  Notice that the "shortcut" looks like a text file and you can see ".desktop" extension still.


To finish make this a usable desktop shortcut you will need to Right Click on the ".desktop" file on your desktop and select properties. Now click on the PERMISSIONS tab and check the "Allow executing file as program" option.  Just closing Properties saves your change (click on the X in the upper right corner).



Okay now the last step.  Once again Right Click on your ".desktop" file on your desktop and you should have an option that says "Allow Launching"  just Left Click on it and it will then be ready and the icon should change to what your use to seeing associated with your program.


You can now double click on your new desktop shortcut and it should start your program.


Wouldn't it be a lot easier to just allow a right click on your desktop and browse to your desired application?  Or even have an GUI app installed by default that did most of the heavy lifting for you?  Well there's not that I know of and it gets harder from here.


METHOD 2


MAKE YOUR OWN ".DESKTOP" FILE

What if you've installed AppImages and need make a desktop shortcut for them or  if there is no "launcher" file on your system for your progam?  or maybe you've written your own Bash Script  or Python program and want a quick desktop shortcut to it.  Well you will have to make your own ".desktop" file.

I'm going to go through this quickly so that you can just get it done.  I encourage you to read more about ".desktop" files and all their options here.

First open a text editor, create a new blank document, and copy & paste the below information into it:


[Desktop Entry]
Version=2.6
Name[en_US]=Darktable
GenericName[en_US]=Graphic Editor
Comment[en_US]=This is an AppImage file link of Darktable
Exec=/home/YOURUSERNAME/AppImages/Darktable2.8.AppImage
Path=/home/YOURUSERNAME/AppImages/
Icon=/home/YOURUSERNAME/Pictures/Icons/darktable.png
Terminal=false
Type=Application
Categories=Application



Now you need to change what you copied & pasted to fit your needs.  Here is what each line means and what you should change:

[Desktop Entry]
All .desktop files start with this

Version=2.6
This is the version of your program and you really don't have to have this line or it doesn't have to be correct but you should try to get it right

Name[en_US]=Darktable
This is the name that will appear under your new desktop shortcut

GenericName[en_US]=Graphic Editor
This is a general type of application i.e. webbrowser, text editor, graphic editor etc.

Comment[en_US]=This is an AppImage file link of Darktable
Whatever you want to help you know about this shortcut

Exec=/home/YOURUSERNAME/AppImages/Darktable2.8.AppImage
This is the path to and your programs startup command.  My program's startup command is "Darktable2.8.AppImage" and that program is located in "/home/YOURUSERNAME/AppImages/" directory.  This program happends to be in my home directory in the folder AppImages.  If your's is similar you would change YOURUSERNAME to your logon or user name.

Path=/home/YOURUSERNAME/AppImages/
This is path to your program and where your program will startup

Icon=/home/YOURUSERNAME/Pictures/Icons/darktable.png
This is the path to and file name of the graphic you want to use as an icon for your program.  I have a folder in my "Pictures" folder called "Icons" where I keep all my icon graphics. Change this to fit your needs.

Terminal=false
Is this a Terminal program or command.  i.e. if this was a bash script you would set this to "true".

Type=Application
This specification defines 3 types of desktop entries: Application, Link or Directory.

Categories=Application
Categories in which the entry should be shown in a menu.

There are more options you can add and for a better explanation you really should follow this link and read more about it.

Okay, once you've changed the ".desktop" file to fit your needs save it to the DESKTOP directory with the extension ".desktop".  Make sure you have you icon graphic saved in the proper place that was referenced in the ".desktop" file you just saved.

The ".desktop" file should have appeared on your desktop after you saved the ".desktop" file to the DESKTOP directory but it will look like a text file and will not function yet.


You will now need to Right Click on the ".desktop" file on your desktop and select properties. Now click on the PERMISSIONS tab and check the "Allow executing file as program" option.  Just closing Properties saves your change (click on the X in the upper right corner).



Okay last step.  Once again Right Click on your ".desktop" file on your desktop and you should have an option that says "Allow Launching"  just Left Click on it and it will then be ready and the icon should change to what your use to seeing associated with your program.



You can now double click on your new desktop shortcut and it should start your program.


***NOTES:  When editing make sure you mind your Capital Letters in file and path names.  I tried the "~" shortcut for my home directory but it did not work for me.  Watch the "/" and make sure you have them in the right places.  When you copy .desktop file from one of the two directories they tend to have a lot more options set in their .desktop files.  You can make .desktop files that reference Bash scripts just make sure to change the Terminal=false to Terminal=true and in the Exec= part this works for me "Exec=/PathToBashScript/bash BashScriptName.sh" .  The same will work for Python too.

***ICON'S Locations.  The images used as the icons are either referenced directly with their entire path listed in the .desktop file (ICON=/path/image) or are stored in a couple of system directories. One is  "/usr/share/pixmaps" and the second is "/usr/share/icons" (most live here).  If you just see a name without a path listed in the .desktop file (i.e. Icon=imagefile) then it will be stored based off the variable $prefix which can be /usr, /usr/local or ~/.local or in one of the two directories listed above.

Sunday, January 05, 2020

USB Logitech Unified Mouse/Keyboard Quit Working

I had a Logitech Unified USB wireless mouse/keyboard combo that worked plug & play on Ubuntu 16.04.  While cleaning the PC I broke the Unified USB dongle (don't ask).  A new Unified dongle was $15 alone or you could get a new M510 Mouse and dongle for $20.  I figured, why not get the mouse too.  Once I plugged in the Logitech Unified Dongle, the mouse worked great, but there are no hardware buttons for pairing my old keyboard (k360 model).  A quick search online and I found the pairing software for Mac, Windows, and Chrome but not Linux. 

I had a plan I thought might work, I have a virtual windows 10 running on the Ubuntu 16.04 box so I downloaded the pairing software for windows and installed it on my virtual box win 10.  I then associated a USB port with the virtual win 10 and ran the pairing software on the virtual.  I plugged in the Unified Dongle when instructed and amazingly it worked and the k360 keyboard paired with the new Unified Dongle.  I then accidentally hit the RESET switch on the computer and it shut down while the virtual was still running.  Upon reboot I was getting no response from the mouse or keyboard.  In addition no USB keyboard or mouse would work (no input devices at all).  I could get into bios and the keyboards and mice worked fine, but once Ubuntu booted I could not type my password or move the mouse cursor.

How I fixed it;  

1.  After several resets I found the f12 key would bring up the GRUB menu in which I selected the ADVANCED option.


2.  This will bring up a 2nd menu.  I picked the 2nd option down the (upstart) one.


3.  This will drop you to a command line (Terminal) screen.  It will ask for your User Name and Pass Word.  Once you supply those you will be able to type commands.

4.  I reinstalled the xserver-xorg-input software from this command line with the following three commands;

sudo apt-get update
sudo apt-get install --reinstall xserver-xorg-input-all
sudo reboot

That was it.  After doing this everything worked just fine and the keyboard was still paired with the new Unified Dongle.


NOTE:  After doing this the hard way I've read that there is Linux software that does the pairing and more.  I did not use this software so you may want to research it before trying it but to install it you simple open a Terminal Window (command prompt) and type the following three commands;

sudo apt-get update   
sudo apt-get install solaar 
sudo reboot

After the reboot you will see a new icon on the top right of your screen near the date and time.


It's the bluish * looking one.

Here is an article about Solaar.  Good luck.

Saturday, January 04, 2020

Adjust Mouse Sensitivity

The Mouse Sensitivity option is not showing up in Ubuntu 16.04 and using the Terminal Command "xset mouse num num" command has to be done at every log on.  I'm using a Logitech wireless mouse and keyboard.  I've read that if you have a wired mouse the option does show.


There is another way to set the mouse sensitivity with a GUI program, xserver xorg input synaptics. To install it run the following command in a Terminal window.

sudo apt-get install xserver-xorg-input-synaptics

Once the program installs you can find it by searching your programs for KEYBOARD AND MOUSE.  Running it bring up the following with the needed options.



This will allow you to adjust your sensitivity and acceleration along with some keyboard functions.

Thursday, December 05, 2019

Brothers DLL2300D Slow Printing

My Brothers HLL2300D printer started printing very slowly (taking a long time to start printing).  Sometimes it would take up to 10 to 15 minutes per page to print.  When I installed it that was not the case.  Before I tell you how I fixed mine let me say that there are many factors that may affect this problem, i.e. (different CUPPS configurations, printer types, installed software or unique hardware) this is just what fixed my situation. 

My setup:
I have my printer (Brother HLL2300D) connected to an IO Gear Print Server (basically a TCP/IP connection device, 10/100 network port on one side and a USB port on the other).  The printer is connected to the USB port and the 10/100 Network port is hardwired to my router.
I'm running Ubuntu 16.04.3, this is a screen shot of the IO GEAR print server web interface and I installed my Brothers HLL2300D using this method.

-------------------------------------------------------------------

THE FIX.


To fix my issue I just added a new printer to my Ubuntu 16.04 install using the following method:

Open your SYSTEM SETTING then PRINTERS then click on the ADD BUTTON.  Now click on NETWORK in the drop down list and finally select APPSOCKET/HP JETDIRECT.  You should see something that looks like this.

Under HOST put the IP ADDRESS of your printer (we're just doing a networked printer).  Under PORT put 9100 and the CONNECTION section should read APPSOCKET/HP JETDIRECT.  Click on the FORWARD BUTTON.


You will now see this screen.  Just select your printer manufacturer and click on the FORWARD BUTTON.


You will now see this screen.  Just pick your printers model number and click on the FORWARD BUTTON. If you are installing a Brothers HLL2300D cancel out of all this and follow these instructions first so that your model's drivers will show up here.


You will now see this screen.  Just fill in the three block with whatever you want for labeling your printer.  When finished just click on the APPLY BUTTON


If you did everything correctly you should now see a new printer with the name you gave it (I changed mine's name to HLL2300Dnew.  By RIGHT CLICKING on that printer and selecting PROPERTIES you will see the following screen (your's should look like mine except your printers IP address will be different from mine and I've blacked out the last digits of that IP address)

Try printing a test page and see if it starts prints quicker.  If the PRINT TEST PAGE is grayed out, close the properties window and RIGHT CLICK on your new printer again and make sure the ENABLED is checked, if not check it and try the PRINT TEST PAGE again.  You may have to reset your computer to finish this but I didn't.


NOTE:  I think selecting the APPSOCKET/HP JETDIRECT is what fixed my problem or maybe it was just installing a new printer, I don't know but it worked for me.  If this worked for you, you may want to set your new printer to your DEFAULT. 








Thursday, October 03, 2019

apt-get update - stops at "0 [ Connecting to us.archive.ubuntu.com ]"


I've been trying to update my UBUNTU 16.04 and it kept hanging up and not completing the updates. So I opened a TERMINAL window and typed in the following command, which is one of the two commands you use to update Ubuntu from the command line.

    sudo apt-get update

When pressing ENTER after typing in this command you will see a list of software sources that Ubuntu is checking to see if there are any updates you need for the software you have installed and there will be a percentage completed number at each line.  Well I noticed that mine was getting stuck at the following line and kept reading 0%

0 [Connecting to us.archive.ubuntu.com]

Without the list of what software you need to download and install you can't use the second command to finish your updates;  sudo apt-get upgrade

--------------------------------------------------------------

To fix this you have to edit the gai.conf file.  To do this open a TERMINAL window and type;

sudo gedit /etc/gai.conf

This will launch GEDIT and open the gia.conf file.  Now you have to be CAREFUL here because there is another line that looks almost like the one you have to change, you have to change just ONE line, you have to find the line;

     #precedence ::ffff:0:0/96  100

now just delete the # which uncomments it.  Change it to;

     precedence ::ffff:0:0/96  100

Now save the file and your done.

NOTE:  There is another line that reads #precedence ::ffff:0:0/96  10 DO NOT CHANGE THIS LINE.  You are looking for the line that ends with a 100.


In case you are wondering this what is causing the problem.  This is from the Ask Ubuntu article where I found the solution.

"ISPs are starting to setup an internal IPv6 network in preparation for eventually connecting to the IPv6 internet. As a result, servers in this network now try to connect to *.ubuntu.com via its IPv6 address by default when running apt-get. Solution: uncommenting precedence ::ffff:0:0/96 100 allows requests to prefer IPv4"

Thursday, September 26, 2019

Linking AppImages to a File Type

I installed CURA 4.3 on Ubuntu 16.04 and it only comes as an AppImage file.  I don't mind the concept of AppImage's  "single file contains everything needed to run the program" but I couldn't get it to associate with the .STL file format.   It wouldn't come up as one of the OPEN WITH options after right clicking on an .STL file.

To fix this you will need to open GEDIT or your favorite text editor (I use GEANY) then;

1. Create a new blank file.

2. Copy and paste the following into this new blank file.

[Desktop Entry]
Encoding=UTF-8
Name=Cura
Comment=Cura 3D slicing application.
Exec={INSERT PATH TO APPIMAGE} %F
Type=Application
Icon={INSERT PATH TO ICON}
Categories=Graphics; 
MimeType=image/CURA;

3.  Replace the {INSERT PATH TO APPIMAGE} with the path to your AppImage file and the name of your AppImage file.  The COMMENT and NAME should be replaced with info and description name of your AppImage file (the NAME is what will appear in your OPEN WITH list when you right click on a file in Nautilus.

The {INSERT PATH TO APPIMAGE} line looks like this in mine:
Exec=/home/jeff/AppImages/Ultimaker_Cura-4.3.0.AppImage %F

*** NOTE:  The official recommendation by the AppImage developers is to create an extra directory, ${HOME}/Applications/ (or ${HOME}/.local/bin/ or ${HOME}/bin/) and store all AppImages there.  But as you can see I did not follow this recommendation. You can put AppImages anywhere and they'll work, even USB drives.

4.  Replace the {INSERT PATH TO ICON} with the path to the icon image you want to associate with your AppImage program.

This line looks like this in mine:
Icon=/home/jeff/Pictures/Icons/Cura.png

*** NOTE:  I keep all my Icons in this folder to make them easy to find

5.  Save this file to your Downloads directory as a .desktop file, I called mine CURA.DESKTOP.  You can name yours whatever you want but the .desktop part must be there.

6. Now we make your new .desktop file executable by opening Nautilus (Files) and right clicking on your new .desktop file.  Now select the PERMISSION tab and check the "Allow executing file as Program" box.


7.  Now we need to copy your new .desktop file to the /usr/share/applications/ folder.  This has to be done in TERMINAL because of permissions.

    A.  Open a TERMINAL window.
    B.   Then type the following. (Assuming your .desktop file is in Downloads directory)

           cd Downloads

           sudo cp cura.desktop /usr/share/applications/

           * Hit ENTER KEY after each of these two commands and enter your password if asked.

           *** NOTE:  you will need to replace cura.desktop with name of your .desktop file you created in steps 1 - 6 .

         
       

8. After it copies just close the TERMINAL window.

9.  Now we need to edit the mimeapps.list that is locate in your HOME directory under the .config directory.

10.  Open Nautilus (Files) and select VIEW and check SHOW HIDDEN FILES



11.  Now navigate to home/YOURuserNAME/.config/ and open the file mimeapps.list with GEDIT or your favorite text editor.

Mine was located here;
home/jeff/.config/mimeapps.list

12.  Once mimeapps.list is open in your text editor add this line under the section [Added Associations]

image/cura=cura.desktop;

***Note:  Replace cura.desktop with the name of your .desktop file.

13.  Save mimapps.list and close your text editor.

14.  Last step; find an .stl file and right click on it and choose CURA as the default app under OPEN WITH.


I hope this  helps someone out. There might be an easier way but I don't know what it would be.

*** NOTE:  This should work with any file type you would wanted associated with a program.  Basically just replace Cura with your your program and .stl with your file type.  It would be nice if there was a little more integration between AppImages and your OS but I guess that is the point AppImages "one file, run anywhere".  To uninstall AppImages just delete that single AppImage file (and undo all this file association I just showed you :-)