Posts

Showing posts with the label fedora

Linux date Command: Day of Week

To find the day of week (e.g. Friday) on a particular date using the Linux version of the `date` utility, execute:

$ date -d 'Jan 03 2004' "+%a" Sat

The -dflag tells the utility to display the information only, instead of setting the date, etc.

The "+%a" options are`date`'s FORMAT options, which are listed in the manpages.
So, for example, we can also have the full name of the weekday output by changing the "+%a" to "+%A". $ date -d 'Jan 03 2004' "+%A" Saturday
DATE(1) User Commands NAME date - print or set the system date and time SYNOPSIS date [OPTION]... [+FORMAT] ... ... FORMAT controls the output. Interpreted sequences are: %% a literal % %a locale's abbreviated weekday name (e.g., Sun) %A locale's full weekday name (e.g., Sunday) %b locale's abbreviated month name (e.g., Jan) %B locale's…

SELinux Failure after Fedora22 Upgrade

SELinux got somehow mangled during upgrade process from Fedora21 -> Fedora22. Some of the modules were changed between the versions and as a result my SELinux "system" is borked. It'd be nice to have more available documentation on re-installing and/or resetting SELinux on a system.  I can't use any of the normal tools to manage SELinux, as it only prints out errors like `libsepol.permission_copy_callback...`.  Attempting to relabel a filecontext, for example results in:

# semanage fcontext -a -t system_dbusd_var_lib_t /var/lib/dbus/machine-id libsepol.context_from_record: type radicale_port_t is not defined (No such file or directory). libsepol.context_from_record: could not create context structure (Invalid argument). libsepol.port_from_record: could not create port structure for range 5232:5232 (tcp) (Invalid argument). libsepol.sepol_port_modify: could not load port range 5232 - 5232 (tcp) (Invalid argument). libsemanage.dbase_policydb_mo…

SDL2 With Eclipse on Fedora22

On a Fedora22 system with Eclipse Mars version 4.5.1 this worked for me.

Create a new C++ project (File > New > C++ Project). You will need to pick a toolchain - Linux GCC.
If you want to use C++11 do the following:

Right click your Project under “Package Explorer” and select Properties.Select (C/C++ Build > Settings > GCC C++ Compiler > Dialect) Under “Language standard” select: "ISO C++11 (-std=c++0x)". Click Apply, then OK.
Configure Eclipse to use SDL2

At this step, I'd suggest to use the system's terminal/shell to find out or verify the existence/location of the necessary files/libraries for SDL2 on your system. 

First, if you want to find the location of the necessary libraries on your system, executing the following in the terminal will provide you with the "include" location and other compiler/preprocessor flags

$ sdl2-config --cflags
Similarly, to list the libraries/linker-flags

$ sdl2-config --libs
For example, on my Fedora22 (64bit…

RHEL7 Fedora as Network Router and Gateway

Hardware Requirements:2 Ethernet Network Cards: 1 for WAN; 1 for LANOptional Wireless Router for wifi
Software Requirements:NIC Configuration Filessysctl Kernel ParametersFirewall Configurationdhcpd Server For the sake of clarity the two network cards will be called ifcfg-wan (WAN) and ifcfg-lan (LAN); make the necessary changes for your environment accordingly, e.g. eth0, ens1, enp0s77, etc., as I will not outline how to make naming changes for hardware devices.  The configuration files for the relevant network adapters/cards are located in /etc/sysconfig/network-scripts/ifcfg-wan and /etc/sysconfig/network-scripts/ifcfg-lan files.

First, make sure all the interfaces are "down" and the ethernet cables are unplugged from both adapters.  Assuming you're not using NetworkManager this can be accomplished on the commandline with "ifdown wan" and/or "ifdown lan".

Next, check the system's network activity for open ports and close them all for now:

# netst…

Virtual Interfaces and VLANs in Fedora20

Setting up VLAN interfaces in Fedora20 VLAN is an acronym for Virtual Local Area Network. Several VLANs can co-exist on a single physical switch, which are configured via Linux software and not through hardware interface (you still need to configure actual hardware switch too).

Hardware Device Requirements
• To be able to use VLANs you will need a switch that support the IEEE 802.1q standard on an Ethernet network.
• You will also need a NIC (Network Interface Card) that works with Linux and support 802.1q standard. Setting Up 802.1q VLAN Tagging This is based on Fedora documentation, specifically F17-System Administrators Guide http://docs.fedoraproject.org/en-US/Fedora/17/html/System_Administrators_Guide/s2-networkscripts-interfaces_802.1q-vlan-tagging.html .
• First, ensure that the 8021q kernel module is loaded with the following command:
# lsmod | grep 8021q# modprobe 8021q is the command to load it if no output results from the grep command above.
• Configure the physical interf…

How to Connect a TI Graphing Calculator to a Linux PC

Image
This post will document how to install a linking program for a TI-83+ on a Fedora18-x86_64 laptop. The purpose of the program is to be able to connect your Graphing Calculator via a USB TI Connectivity Cable, in order to transfer data to/from your Graphing Calculator. I should mention that I am not in any way affiliated with the developers of any of these programs, and I take no credit for any of its development; this is merely meant to help those who are struggling to install this valuable software on their computers.
What you will NeedTI Graphing Calculator (obviously)Connectivity Cable (GraphLink cable)TILP2 (TI Linking Program)TILIBS (the library files for the program)libglade2-dev, libusbx-devel (development files for certain libraries on your Fedora/Linux computer) Installation I will assume that you already have the calculator and the necessary cables for the remainder of this procedure, and so we will proceed to download the necessary files from ticalc.org. That's a g…

Samsung Printer Scanner on Linux

Once again, I've been made to feel as just another outcast in the information age of script-kiddies and spreadsheet warriors; yet another instance of a corporation neglecting Linux users with lacking software support and drivers for their devices.  As in most other cases, the linux community provides their own workaround in this instance as well; namely, the SANE (Scanner Access Now Easy) backend and libraries for the Samsung CLX-3185 Multifunction Printer/Scanner device.  The Samsung support website claims to offer a "Universal Linux Driver", but that's just a smokescreen created by the ineffective binaries and poorly constructed installation scripts from Samsung.  Notwithstanding, the SANE backend implementation isn't perfect  either--as there are still issues with certain System setups, USB 3.0, or simply non-supported devices--but it's far better integrated into the Linux ecosystem. 

It can be very frustrating not being able to complete an important task …

Power Management and Performance in Enteprise Linux (EL7)

As with most things in Linux, there are an array of different tools and options available when dealing with the performance and power consumption of hardware components. Nevertheless, certain standard or even non-standard defaults always emerge, either distribution-specific or -agnostic. While a greater number of available tools provides greater control and more possible solutions, it also brings with it the possibility of greater potential for confusion and unclear incompatibilities. One such confusion arose when I noticed the inconsistency in my CPU frequency preference across reboots. I was used to using the cpupower utility from the kernel-utils package; however, options in the configuration file in /etc/sysconfig/cpupower had no effect on the system during the boot up process. It turns out that RHEL7 and, by extension, Centos EL7 use the tuned utility by default for performance tuning. As a result, according to a forum post in the Centos forum, ...that service conflicts …

Ricoh SD-Card Reader and Linux

The linux kernel adds the benefit of making firmware drivers available for a large number of widely-used hardware devices and components. This provides great convenience and ensures portability and sane defaults across the various OS distributions. The open-source nature of the Linux kernel, however, relies on the hardware manufacturers to make the firmware and/or drivers available to the Linux community; a process that can be frustratingly slow at times, depending on the hardware manufacturer. Furthermore, once the driver is included in the kernel, it falls on the various OS distributions to make the kernel or a patch to the kernel available for the users to install.
The functionality of rarely-used hardware like a multimedia card reader (SD-card reader) are often overlooked by users until the day when they try to use the device. Usually, the kernel will load the necessary modules for the device to function properly during the boot-up process. Though, if an SD-card is not …

Configure rsyslog Server on Fedora

Image
It can be very beneficial for system administrators and network administrators, especially, to log system messages from other machines on the network to a centralized hub. Fedora 20 uses rsyslog as the default syslogd service; this allows administrators to configure remote logging. I'll be detailing the necessary configuration steps of rsyslog in Fedora 20 to allow logging messages from a DD-WRT router. This will entail Edit /etc/rsyslog.confSet up firewall rule to allow incoming connection to serverConfigure DD-WRT router to send syslogd messages to our server
rsyslog server Our server will be the Fedora 20 machine. There are two configuration files in the /etc/ directory that are of interest to us: /etc/rsyslog.conf /etc/sysconfig/rsyslog However, the latter file is not useful anymore as it states: # Options for rsyslogd # Syslogd options are deprecated since rsyslog v3. # If you want to use them, switch to compatibility mode 2 by "-c 2" # See rsyslogd(8) for mor…

SystemD Debate and Configuration by Example

Image
A "healthy" debate on the virtues, use-cases, and overall disdain and misconceptions of SystemD. Specific use-cases in "less-common" configurations provide a challenge as well as an opportunity to learn about the underlying mechanism of certain aspects of the Operating System. A substantial number of years working in/with Linux doesn't preclude a person from learning how to use new tools and mechanisms even if, or perhaps especially when, the mechanism is low-level software.

Users and Administrators must not get so entrenched in their ways of comfort that they reject advancements in the underlying pieces of the OS on the basis of overestimating the merit of their own existing knowledge, while downplaying the benefits of the advancements and exaggerating their problems an perceived shortcomings on surface value. Nevertheless, even though change is inevitable in our universe, it breeds chaos in the early stages of wide-spread adaptation. It's in this st…

Recover Fedora21 after Removing swap LVM Partition

Image
"God" help you if you make the mistake, as I did today on a newly-installed Fedora21 system, to delete an LVM swap partition without taking the proper precautions before rebooting. If you are in this position, or have been in the past, you've come face to face with the dracut rescue shell and its limited set of "shell" commands. While the rescue shell offers some potentially useful functions (commands), I could not successfully use it to implement any of the advised steps from manual pages and internet forums I came across when searching for a solution to this problem.
The Fedora Wiki page on "How to debug Dracut problems" suggested activating the root and any other logical volumes by executing  # lvm vgscan # lvm vgchange -ay "With the root volume available, you may continue booting the system by exiting the dracut shell" exit Though, in fairness, that resolution was dealing with unlocking an encrypted root volume with an additional …

How to Reset Root Password in RHEL7

Image
Without a doubt, one of the most powerful and essential tools a system's administrator has is the ability to gain root privileges. While it's generally a bad idea, to say the least, to perpetually operate as the root user on any given system, being able to log in as the root user on the command console is essential at times. Therefore, it's frustrating to be in the position as a system administrator if you've forgotten or otherwise lost the password and are, subsequently, unable to gain escalated privileges on a system.
Since the shift to grub2, as well as other changes with the init system, the method of gaining access to a system for such low-level purposes has changed.
Reboot the system, wait for the grub menu, press the letter 'E' on the keyboard to edit the menuentry. Then, scroll down to the bottom of the screen to the line starting with linux and append the space-separated kernel commands rw and init=/bin/bash
before hitting the F10 key to boot the …

Set Focus to Follow Mouse Cursor in GNOME 3

Install dconf-editor in RHEL or Fedora, then go to org -> gnome -> desktop -> wm -> preferences and make sure auto-raise check-box is checked on.
Also, change the focus-mode to sloppy or mouse.
The window focus mode indicates how windows are activated. It has three possible values; "click" means windows must be clicked in order to focus them, "sloppy" means windows are focused when the mouse enters the window, and "mouse" means windows are focused when the mouse enters the window and unfocused when the mouse leaves the window.
There's a nice, detailed write-up available on worldofgnome.org. Auto Raise Delay:
The time delay before raising a window if auto-raise is set to true. The delay is given in thousandths of a second.

Focus Mode:
The window focus mode indicates how windows are activated. It has three possible values; “click” means windows must be clicked in order to focus them, “sloppy” means windows are focused when the mouse e…

fail2ban configuration in Fedora/RHEL

The configuration files in Fedora20 for fail2ban are located in the /etc directory under /etc/fail2ban/
with further sub-directories for actions, filters and jails.drwxr-xr-x.2 root 4.0K May 162014 action.d drwxr-xr-x.2 root 4.0K Mar 192014 fail2ban.d drwxr-xr-x.2 root 4.0K May 162014 filter.d drwxr-xr-x.2 root 4.0K Mar 192014 jail.d -rw-r--r--.1 root 2.1K Mar 142014 fail2ban.conf -rw-r--r--.1 root 33 Dec 1000:16 fail2ban.local-rw-r--r--.1 root 14K Dec 1001:06 jail.conf -rw-r--r--.1 root 16K Dec 1000:54 jail.conf.rpmnew -rw-r--r--.1 root 805 Dec 1007:48 jail.local-rw-r--r--.1 root 1.5K Mar 142014 paths-common.conf -rw-r--r--.1 root 606 Mar 142014 paths-debian.conf -rw-r--r--.1 root 649 Mar 142014 paths-fedora.conf -rw-r--r--.1 root 1.2K Mar 142014 paths-freebsd.conf -rw-r--r--.1 root 290 Mar 142014 paths-osx.confNOTE: In order to preserve your edits and customizations you should create separate *.local files, as the normal *.conf files (may) get overwritten during an upgrade.…