• Sign in to Neowin Faster!

    Create an account on Neowin to contribute and support the site.

Sign in to follow this  

Linux, Unix and BSD: Tips, Tricks, Useful Commands and Interesting ways to get things done! Share your knowledge!

Recommended Posts

+Gary7    7,372

When I get off of The TP Program in June or July, I am going to give Linux another shot. Not sure how it would boot with Win 10 and I do not want to do it while I am Testing Previews.

Share this post


Link to post
Share on other sites
simonlang    530

check the status of your bios/mainboard battery with the following command (can be run without root privileges)

 

[~] cat /proc/driver/rtc | grep batt_status                            15:15:35 
batt_status     : okay

if it says not okay but dead you better exchange it asap. 

  • Like 2

Share this post


Link to post
Share on other sites
Unobscured Vision    2,644

Next couple of Tips N Tricks articles are forthcoming ... you folks are gonna love these. :yes: I'll post them as time permits (starting College Term #2 this week). Shoulder is doing a bit better too, thankfully. Maybe I'll escape another surgery after all.

Share this post


Link to post
Share on other sites
Unobscured Vision    2,644

Get a Canon Multifunction (All-In-One) Printer/Scanner/Copier Working:

 

References:

http://ubuntuhandbook.org/index.php/2014/12/canon-driver-scangear-mp-ubuntu-14-04/

https://wiki.ubuntu.com/HardwareSupportComponentsPrintersCanon

http://askubuntu.com/questions/168089/how-do-i-install-my-new-canon-mg5250-printer-mg5200-series

http://www.canon.com.my/personal/productlanding?languageCode=EN

 

Background

This one was a real problem, up until I ran across a very obscure (and actually quite simple) procedure. Thought I'd pass this one along. Hope it helps someone else. The reason the fix eluded me was primarily because the Proprietary blobs are available for my device, but aren't listed as such for my very common model (Canon-MG-2970, also called a Pixma-2970). The Printer part of the driver? No problem getting that working. The Scanner part was a different story entirely; for weeks I was banging my head against a brick wall trying to get it working. No solution worked, until I tried (literally!) "Door #3 -- the 'this is what the Simple-Scan and the SANE routines should have been doing from the start, but aren't doing for whatever reason!'" solution. To my utter shock and complete amazement, the Scanner which thus far had been totally non-compliant was working -- and working BETTER than on Windows! HUZZAH! The obscure reference about invoking scangearmp2 from the command line had worked!

 

So here's how I got it installed and working:

 

The difference is that instead of following the VERY convoluted and INCORRECT instructions about installing SANE and Simple-Scan, which will result in nothing working except the Printer part; we install the Proprietary Debian Printer Driver (called "cnijfilter") then the Scanner Driver (called "scangearmp2") manually. Download each of the drivers from Canon-Asia (link to the website above), agree to their T&C. Open Terminals in each archive after decompressing, run the ./install.sh files for each as sudo. The only real constraint is that you should probably install the Printer Driver (cnijfilter) first to get the device registered with the system, and that I didn't have any luck getting it working wirelessly so you'll need to connect it via USB cable. After we install cnijfilter, install scangearmp2. Afterwards, make a launcher in whatever way works best for you (I use Linux Mint/Cinnamon, so I had the use of a GUI Menu Editor available) to create a launcher for "scangearmp2". That's the actual application we use to scan with, too.

 

Your results may differ according to Model, but generally the instructions should work for all Canon Multifunction Printer/Scanner/Copiers.

 

Good luck!

Edited by Unobscured Vision
  • Like 1

Share this post


Link to post
Share on other sites
Unobscured Vision    2,644

Sadly, my next article for the Tips N' Tricks thread "Install an OS (including Windows) using an ISO from Hard Disk via GRUB" has run into a major snag; meaning that the information and procedures are woefully convoluted, tangled, and don't always work. The major factor is the ISO preparation (for whatever reason, which makes no sense to me). Windows, oddly enough, is pretty forgiving and installs relatively fine -- it's the LINUX Distros that are the problem! Imagine that.

 

And bear in mind that it isn't the "stock" Distros -- Ubuntu, Debian, Red Hat, they're straightforward. It's the more "specialty/derivative" ones that put up a fuss. Mint, for example, has one of the more oddball setups I've ever seen. Why? Who knows. Might explain why LM 17.3 is impossible to get onto a USB Stick cleanly. I've always, always had to use 17.2 and then upgrade ... 

 

still want to do this article .. just not sure how to go about it. Until then, it's delayed. Apologies to all.

Share this post


Link to post
Share on other sites
Unobscured Vision    2,644

Get newer Nvidia binary Drivers sooner on currently supported Debian, Ubuntu, Debian-derivative and Ubuntu-derivative Distributions:

(Credits go to @Boo Berry for this one.)

Reference:

https://launchpad.net/~graphics-drivers/+archive/ubuntu/ppa

 

Background and Purpose:

Generally we all like having the latest driver for our GPU. Bugfixes, new/improved features, better performance; the list goes on. While we generally can deal with the drivers we've been offered, there are occasionally issues -- most often when new cards are released that the old drivers don't support properly (if at all), or when we're using an LTS release and those old drivers don't get updated for two years ... Case and point, Linux Mint. Great Distribution, large following -- but much to our eternal sadness their hands are tied. They can't offer driver updates because that's Ubuntu territory and they can't pre-add PPA's to the sources list because it violates some kind of licensing with Ubuntu ... ugh. Who knows.

 

So, users are left to deal with the problem themselves when getting newer hardware. Either switch to Ubuntu's non-LTS releases or "find our own drivers". In the past, that option was limited to the Xorg-Edgers PPA; and their offerings weren't always completely reliable or up-to-date. They did try, though.

 

Now there's another option that is much more current, and receives far more benchmarking and testing. Problems are addressed immediately and fixes are pushed to users as quickly as they have been tested and found to be good to go.

 

Currently, the Graphics-Drivers PPA Team is only doing Nvidia Drivers for now. Hopefully that will change in the future.

 

Enough talk! How do I install the new hotness?

In your Terminal:

sudo add-apt-repository ppa:graphics-drivers/ppa

Press Enter to add it after the obligatory text about what the PPA contains. Then issue the command:

sudo apt-get update

At this point, you can either fire up your Driver Manager (Linux Mint Cinnamon and MATE or any other Distro using Driver-Manager) or the Drivers tab in Software and Updates (Ubuntu and derivatives); or (Debian users will most likely need to do it this way) via the open Terminal (replace the '364' with whatever version is current now ... check the above link. They'll have it there):

sudo apt-get install nvidia-364

Press 'y' to accept the changes, wait for everything to install, restart.

 

Please note that it is possible that some users of the Geforce GTX 900-series cards will need to enter 'nomodeset' to GRUB options when loading their Distro. I say 'possible' because some do, and some don't. There's something else going on with that particular issue that I haven't been able to replicate (sorry @T3X4S). Is it different combinations of chipsets and CPU's and GPU's? I've no idea.

  • Like 2

Share this post


Link to post
Share on other sites
T3X4S    4,532

Thanks for the tips.

  • Like 1

Share this post


Link to post
Share on other sites
simonlang    530

it might also be suggested to disable the ppa afterwards to avoid potential security risks.  i don't know a case yet where malicious software got installed due to an optional ppa and i had many enabled in my ubuntu days, however at the end, i also disabled them after they did their purpose. plus, sudo apt-get update will be quite faster when it does not have to read many ppas. 

  • Like 2

Share this post


Link to post
Share on other sites
Unobscured Vision    2,644
8 hours ago, T3X4S said:

Thanks for the tips.

For my end, not a problem. Sorry I wasn't able to track down what's happening.

8 hours ago, Simon Lang 9047 said:

it might also be suggested to disable the ppa afterwards to avoid potential security risks.  i don't know a case yet where malicious software got installed due to an optional ppa and i had many enabled in my ubuntu days, however at the end, i also disabled them after they did their purpose. plus, sudo apt-get update will be quite faster when it does not have to read many ppas. 

That's not a bad idea; however I prefer to have updates across-the-board. The nvidia-364 driver is a little on the flaky side, and needs some further optimizations. I might revert back to the one I was using before if things keep up the way they are.

Share this post


Link to post
Share on other sites
simonlang    530

if you have got one of these top notch laptops where windows just would not let linux dualboot even if you set UEFI correctly in BIOS and have turned off secure boot, here is your help:

http://itsfoss.com/no-grub-windows-linux/

 

 

bcdedit /set {bootmgr} path \EFI\ubuntu\grubx64.efi

this magic code did the trick for me. 

  • Like 1

Share this post


Link to post
Share on other sites
SarK0Y    37

Just to push topic ahead, i'd like to mention useful utility unshare: sometimes it's very needful to block any network activity for given app ==>> unshare -n --user opera --no-sandbox

netless.thumb.png.3e674c13035ad23be7f661ba1776acad.png

ah, that's russian :) would you like to change locale?  ==>> LANG=en_UK.utf8 unshare -n --user opera --no-sandbox

netless1.thumb.png.5623f49e37a2d280d89ed09cc6c5a6ee.png

for some apps, var LANG doesn't work well or doesn't run at all, so use LC_ALL.

Share this post


Link to post
Share on other sites
Unobscured Vision    2,644

How to deal with a hibernated NTFS drive or partition:

 

References:

https://www.google.com/search?q=mount+a+hibernated+ntfs+partition

https://ubuntuforums.org/showthread.php?t=2327737

https://askubuntu.com/questions/204166/how-do-i-mount-a-hibernated-ntfs-partition

https://superuser.com/questions/678274/trouble-mounting-ntfs-disk-on-linux

https://itsfoss.com/solve-ntfs-mount-problem-ubuntu-windows-8-dual-boot/

 

Problem:

You've installed Linux after using Windows 8 or 10 and you attempt to mount your NTFS-formatted partition(s). You're presented with an error message that reads (for example):

Error mounting: mount exited with exit code 14: Windows is hibernated, refused to mount.
Failed to mount '/dev/sda5': Operation not permitted
The NTFS partition is hibernated. Please resume and shutdown Windows
properly, or mount the volume read-only with the 'ro' mount option, or
mount the volume read-write with the 'remove_hiberfile' mount option.

In essence, the filesystem is in a hibernated (locked) state. Frozen. (Let it go ... let it gooo .... darn it, now that stupid song is in my head. :laugh:)

 

Solution:

There's an easy way to unfreeze it. No fuss, no muss -- although the Terminal output will suggest otherwise, things are gonna be okay. -ish. Nah, just kidding. All is well. :yes: 

 

Step 1: Fire up the Terminal.

Step 2: Type in the following and hit Enter:

sudo ntfsfix /dev/sdc1 (for example -- whichever drive or partition is hibernated)

(The Terminal output will complain about it being an unclean filesystem, etc etc ... yeah, we already know.)

 

Things should be fine now. It won't take any time at all to complete. You can mount the location normally, or use udiskctl to create your startup mounts. Whatever floats your boat.

  • Like 1

Share this post


Link to post
Share on other sites
Unobscured Vision    2,644

The "Easier Way" to handle Filesystem Mounts at Startup:

(Updated from: Forum post: Mount a local Hard Disk/Partition at Login instead of at Startup)

 

Some time ago, I described a safe way for a user to automount Hard Disks and Partitions at login rather than at system start that won't hose your system if one or more of these filesystems aren't available. Over the course of time, it occurred to me that I was actually making the process more difficult than it needed to be.

 

Instead of using archaic "crypto-speak" which makes things harder, I'd forgotten that we can reference our disks and partitions by label. Furthermore, we can mount those items in the same manner. And chances are we'll even remember the names of our items too. Better this way, all-around. :yes: 

 

So. Let's get to it.

 

Step 1We still need the Terminal. Fire it up. Issue the command:

ls -al /dev/disk/by-label

You'll get something like this:

Term1.thumb.jpeg.63fdf11bbda9b505c9f85b32faebed74.jpeg

Now you've got your proper labels for the disks and partitions. Easy peasy.

 

Step 2: Go into your Control Center -> Application Autostart. Add a new entry. If it asks, you're looking for 'custom command'.

 

Your command will be:

udisksctl mount --block-device /dev/disk/by-label/<label>

Where <label> is the label of the disk or partition you'd like to have automounted when you log in. In my example, my commandline would read:

udisksctl mount --block-device /dev/disk/by-label/Storage

Step 3: Give it a name that you want the autostarted command to be known by, and click ok.

 

Step 4: Rinse and repeat. :)

 

And yes, it's really that easy. Enjoy!

Share this post


Link to post
Share on other sites
Mindovermaster    1,739

Is there a "hard way", too? :laugh:

 

  • Like 1

Share this post


Link to post
Share on other sites
Unobscured Vision    2,644
14 minutes ago, Mindovermaster said:

Is there a "hard way", too? :laugh:

 

Yes. Several. :laugh::rofl:

Share this post


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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.