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


Recommended Posts

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.

Link to comment
Share on other sites

  • 2 weeks later...

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 1 month later...

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. 

Link to comment
Share on other sites

  • 10 months later...

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.

Link to comment
Share on other sites

  • 4 weeks later...

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
Link to comment
Share on other sites

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!

Link to comment
Share on other sites

  • Mindovermaster unlocked this topic

After several years I'm resurrecting the Tips N Tricks thread here, thanks to the kind permission of @Mindovermaster. :D

lot has happened in seven (yes, seven) years and I feel it's important - especially with Windows 10 support ending in a year, leaving millions of otherwise useful systems in the dust due to Microsoft's arbitrary practices - to do my part.

I've got 3 posts cooking but I work a LOT so it's gonna take some time. I appreciate everyone's patience.

New content coming!

Link to comment
Share on other sites

On 11/08/2024 at 13:33, BetaguyGZT said:

New content coming!

Thank you for your help! Love member content like this!

  • Like 1
  • Love 1
Link to comment
Share on other sites

zRAM refresher!

(Original Neowin thread for reference:

For anyone not familiar with zRAM, here's a bit of information about it:

https://en.wikipedia.org/wiki/Zram
https://wiki.archlinux.org/title/Zram
https://wiki.debian.org/ZRam

A number of distributions, such as Garuda, ship with it out of the box. Other distros will need to install it but it's fairly easy to get up and running.

So it begs the question "why would anyone need this in 2024?" -- systems are RAM-rich (16+gb) now. And it's honestly a good point; but there are use cases where zRAM is helpful. Examples being gaming-focused distributions, high-intensity workloads like content creation or computational tasks that require as much memory as it can get, etc.

"We already have memory compression!" -- yes, also true -- but built-in memory compression isn't this and there are (again) justifications on using zRAM in conjunction with compression techniques. Think of zRAM as another layer rather than a replacement for something. 

"It's just a swap space in RAM -- surely there's no reason!" -- actually, that's exactly what it is and yes, there is a good reason. Now you'll have two - one on-disk and one in-RAM. Disk is far slower -- which is why the system will chug along slowly if you're using disk swap -- versus moving right along nearly at-speed with zRAM. You have the disk-based Swap as a fallback if you really need it but the system won't go to it first, it'll go to the zRAM initially.

Another selling point of zRAM is that you can, if so desired, assign it MORE than the amount of physical RAM you actually have installed. zRAM will then engage the compression routines automatically giving you additional functional memory than not. I have personally gone +200% with no ill effects although the documentation states that the sweet spot is 150%.

So the next question is should one use zRAM? I can't think of a good reason not to. It'll only help your system.

The procedures for getting it running are exactly the same as before. I won't reinvent the wheel so I encourage users to simply follow the original thread's instructions. 😃

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

To Zen or not to Zen ...

Moving right along. 😃

https://wiki.archlinux.org/title/Kernel

To start, Zen kernels are not realtime. Those are for different application use cases (Audio or Video development, for example). Zen kernels are instead tuned in favor of performance and responsiveness with Gaming in mind (like Garuda). SteamOS uses its own modified kernel tuned to the needs of that particular hardware although a more general-use kernel (with patches for the hardware) is constantly being worked on in order to bring SteamOS to other systems.

Zen kernels aren't for every use case. There are things that Zen kernels aren't really suited for (such as Servers) -- and they can introduce instabilities that wouldn't otherwise be present with other kernels.

Ubuntu-based distributions (Mint, in particular) aren't really any worse at gaming than a focused, purpose-crafted gaming distro (again, Garuda). Certainly it has more to do with the base distribution (in Garuda's case, Arch) than anything.

In my personal experience, a Zen-based distribution is snappier on the Desktop level but can be unstable. I personally want stability over a bit of speed so I stick to whatever kernel (plus updates, obviously) is the latest for that distro.

Is it worth it? Not really, imho. All the effort that goes into maximum stability and driver support cannot be ignored and I think the average GNU/Linux user is more than happy to "let well enough alone".

Do I recommend using a Zen kernel? Honestly, no, especially if we consider that Ubuntu kernels are tuned for Ubuntu-based distributions and aren't prone to breaking.

The next topic is coming very soon -- my own testing & results concerning Cloud Gaming services on 'nix and how to mitigate a few issues.

Edited by BetaguyGZT
Link to comment
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