Category Archives: Ubuntu

I found two ways to configure the /etc/resolv.conf file to prevent it to be overridden by the system.

  1. Edit the base file under the resolv.conf.d file
sudo vim /etc/resolvconf/resolv.conf.d/base

and then add the nameservers to the file:

nameserver 8.8.8.8
nameserver 8.8.4.4

lastly, update resolvconf:

sudo resolvconf -u

2. Install dnsmasq and edit /etc/dnsmasq.conf to add the nameservers you want.

sudo apt install dnsmasq
and
vim /etc/dnsmasq.conf

Then restart the network services:

sudo service dnsmasq restart and
sudo service network-manager restart

You should be all set now.

References:
1. https://unix.stackexchange.com/questions/128220/how-do-i-set-my-dns-when-resolv-conf-is-being-overwritten

2. https://unix.stackexchange.com/questions/128220/how-do-i-set-my-dns-when-resolv-conf-is-being-overwritten/163506#163506

Cheers!

Advertisements

Static IP config with netplan (ubuntu)

If you use a modern Ubuntu distribution (the latest 18.04 LTS or 17.XX), you might have noticed that the package to configure the network changed.

Ubuntu changed to Netplan, that is more modern and relatively simpler to use. The file configuration for a static IP should be as follows.

# cat /etc/netplan/01-netcfg.yaml
network:
 version: 2
 renderer: networkd
 ethernets:
 eth0:
 dhcp4: no
 addresses: [YOUR.STATIC.IP.ADDRESS/24]
 gateway4: X.X.X.X
 nameservers:
 addresses: [YY.YY.YY.YY, 8.8.8.8]

Reference: I extracted the following information from  https://ppc64el.wordpress.com/2018/03/22/ubuntu-18-04-netplan/

Please visit the link above for more information (including the original /etc/network/interfaces format of the eth0 interface before the transition to netplan).

Cheers!

Install Silversearcher-ag on Ubuntu

The Silversearcher tool is a super fast search tool that gives you rich information when searching for a string through all your files.

To install it:

sudo apt install silversearcher-ag

The Github project page:

https://github.com/ggreer/the_silver_searcher

You can find answers about why it is so fast, a chance to collaborate and other info there.

Cheers!

npm/yarn: live-server installation issue

Executive summary:

ISSUE:

$ live-server
zsh: command not found: live-server SOLUTION: $ export PATH=$PATH:/home/user/.yarn/bin/

DETAILS:

Today my attempt to install the live-server package in a Linux Mint Sylvia (Ubuntu Xenial) box using yarn failed. The installation went just fine, with just some info messages:

$ yarn global add live-server
yarn global v1.3.2
[1/4] Resolving packages...
[2/4] Fetching packages...
warning Pattern ["object-assign@latest"] is trying to unpack in the same destination "/home/dbkreling/.cache/yarn/v1/npm-object-assign-4.1.1-2109adc7965887cfc05cbbd442cac8bfbb360863" as pattern ["object-assign@^4.1.0","object-assign@^4"]. This could result in a non deterministic behavior, skipping.
info fsevents@1.1.3: The platform "linux" is incompatible with this module.
info "fsevents@1.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "live-server@1.2.0" with binaries:
- live-server
Done in 1.98s

Cool! And then..

$ live-server
zsh: command not found: live-server

 

Whatta?

Digging it further I found it (no pun intended) hidden in my home directory:

$ sudo find / -name "*live-server*"
[sudo] password for dbkreling:
find: ‘/run/user/1000/gvfs’: Permission denied
/home/dbkreling/.yarn/bin/live-server
/home/dbkreling/.config/yarn/global/node_modules/.bin/live-server
<...snip...>

Looking at my PATH, I had no .yarn directory whatsoever, so this is what I got:

export_yarn_to_path

After adding ~/.yarn/bin to my $PATH I had no more problems  to run it:

$ export PATH =$PATH:$HOME/.yarn/bin

Cheers!

Mount HFS+ as R/W without a MacOS

If you created a usb flash drive using MacOS, chances are you might have an HFS+ (journaled) file system device in your hands.

NOTE: If you do have a Mac sitting around, try this before.

In case you do not have access to a Mac, you may have to tweak a little to get your device working normally.

When you try to use your usb stick in Linux, you will have it mounted as a Read Only file system.

/dev/sdb3 on /media/dbkreling/dbkusb type hfsplus (ro,nosuid,nodev,uhelper=udisks2)

A filesystem check (fsck) did not work for me:

$ sudo fsck /dev/sdb3
fsck from util-linux 2.20.1
fsck: fsck.hfsplus: not found
fsck: error 2 while executing fsck.hfsplus for /dev/sdb3

Let’s install it then. The name of the package is hfsprogs:

$ sudo apt-get install hfsprogs

Preparing to unpack .../hfsprogs_332.25-11_amd64.deb ...
Unpacking hfsprogs (332.25-11) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up hfsprogs (332.25-11) ...

Now let’s try fsck again:

$ sudo fsck -f /dev/sdb3
fsck from util-linux 2.20.1
** /dev/sdb3
** Checking HFS Plus volume.
** Checking Extents Overflow file.
** Checking Catalog file.
** Checking Catalog hierarchy.
** Checking Extended Attributes file.
** Checking volume bitmap.
** Checking volume information.
** The volume dbkusb appears to be OK.

Nice! Making progress… Then create a mounting point for it, other than the default one (without this step, I could not make it work, so make sure you do it):

$ mkdir /mnt/usb

Make sure the flash drive is unmounted and remount it at the new mount point, forcing r/w mode:

$ sudo umount /dev/sdb3
$ sudo mount -t hfsplus -o force,rw /dev/sdb3 /mnt/usb/
$ mount
....
/dev/sdb3 on /mnt/usb type hfsplus (rw,force)

Cheers!

References:

https://askubuntu.com/q/332315

https://superuser.com/a/84447

Solve VirtualBox Guest Additions Autorun issue on Fedora 26 and Debian 9

Install VirtualBox Guest Additions on Fedora 26

NOTE: If your user does not have root rights, add it to the root group (probably ‘wheel’).

$ dnf update kernel*

$ sudo reboot

After it boots up again, the guest additions should be up and running, and you should be able to see your desktop on full screen.

Install VirtualBox Guest Additions on Debian Stretch (9)

Insert the VBoxGuestAdditions CD image from the ‘Devices’ menu. (I had a lot of mount issues with this). It should automatically mount and automatically run.

If it does not autorun, you have to manually run the VBoxLinuxAdditions.run script. First solve any root permissions you may have (adding $USER to the visudo file should solve it: insert a line right after ‘root’ with your user name). Then go to /media/cdrom0 or wherever your VBoxGuestAddition.iso is mounted and issue:

# bash VBoxLinuxAdditions.run

It should run seamlessly if everything is OK.

You are welcome to share your comments.

Cheers

List gpg keys in your system

1.1. RPM based distros (RHEL, CentOS, Fedora)

Import:

$ sudo rpm --import repomd.xml.key

List:

$ rpm -q gpg-pubkey|sort

Getting info:

rpm -qi  | grep Summary   

(or without the ‘grep’ part to view full info of the key package)

To remove:

sudo rpm -e --allmatches 

Example:

[root chip ~]# rpm -q gpg-pubkey|sort
gpg-pubkey-1ac70ce6-41bebeef
gpg-pubkey-30c9ecf8-3f9da3f7
gpg-pubkey-4f2a6fd2-3f9d9d3b
gpg-pubkey-8df56d05-3e828977
gpg-pubkey-8df56d05-3e828977
gpg-pubkey-a109b1ec-3f6e28d5
gpg-pubkey-db42a60e-37ea5438
gpg-pubkey-e42d547b-3960bdf1
[root chip ~]# rpm -e --allmatches gpg-pubkey-8df56d05-3e828977
[root chip ~]# rpm -q gpg-pubkey|sort
gpg-pubkey-1ac70ce6-41bebeef
gpg-pubkey-30c9ecf8-3f9da3f7
gpg-pubkey-4f2a6fd2-3f9d9d3b
gpg-pubkey-a109b1ec-3f6e28d5
gpg-pubkey-db42a60e-37ea5438
gpg-pubkey-e42d547b-3960bdf1

1.2 Debian / Ubuntu

$ gpg --list-keys user_ID

Example:

$ gpg --list-keys
/home/iplsdk/.gnupg/pubring.gpg
-------------------------------
pub   2048R/E5****A4 2015-01-12
uid                  IBM Software Development Kit for Linux on Power
sub   2048R/F2*****9 2015-01-12

pub   4096R/78C*****4 2016-02-11
uid                  IBM SDK for Linux on Power (The IBM Software Development Kit for Linux on Power is a free Eclipse-based Integrated Development Environment) <iplsdk@linux.vnet.ibm.com>
sub   4096R/B3*****0 2016-02-1

Add a gpg-key in your environment:

After you get the .gpg file, you need to 'add-apt-key' it into your keyring. Here:
$ sudo apt-key add .gpg

Don’t forget:
$ sudo apt-get update

Cheers!