Archive

Posts Tagged ‘Fedora’

How to label a partition

February 26th, 2013 No comments

Labelling a partition can be quite handy, especially for partitions on usb drives that usually get auto-mounted to a folder that corresponds to their label.

Usually the label is set when the partition is created. If the label is not explicitly specified, it is usually auto-generated. To change the label, there are a couple of tools available:

ext2/ext3/ext4 partitions

You can either use e2label

# e2label device [newlabel]

or tune2fs

# tune2fs -L [newlabel] device

FAT/FAT16/FAT32 partitions

Again, there are multiple tools available, from simple perl scripts to mtools, but the easiest to use is probably dosfslabel from the dosfstools package

# yum install dosfstools
[...]
# dosfslabel device [newlabel]

NTFS partitions

ntfslabel is available as part of the ntfsprogs package

# yum install ntfsprogs
[...]
# ntfslabel device [newlabel]
Categories: Uncategorized Tags: ,

Search for a package containing a certain file

January 30th, 2013 No comments

Assumed you want to find the package that contains the shared object libGLU.so.1, e.g. because a binary is dynamically linked against it, and ldd tells you that the shared library requirements are not met. On Fedora (or any yum-type os) you’d run

$ yum whatprovides */libGLU.so.1

and yum would tell you, that mesa-libGLU comes with /usr/lib64/libGLU.so.1 which could fulfill your need (could because you could also be missing the i686 version of the package, depending on your binary).

The Ubuntu way of achieving the same thing:

$ apt-file search libGLU.so.1

And of course the corresponding package would be libglu1-mesa on any recent Ubuntu os.

Categories: Uncategorized Tags: , ,

Changing the default displaymanager in Fedora 18

January 21st, 2013 1 comment

With the release of Fedora 18, there have been some changes to the /etc/sysconfig directory. For example, switching the default display manager is no longer done by altering parameters in /etc/sysconfig/desktop but via

# systemctl enable --force displaymanager.service 

Therefore, to switch from the default gdm to kdm you’d run:

# systemctl enable --force kdm.service 
Categories: Uncategorized Tags: ,

How to send a client’s hostname to the DHCP server

January 5th, 2013 1 comment

In contrast to Ubuntu (or even Microsoft Windows) default installations of Fedora do not send the client’s hostname to the DHCP server.

To change this behaviour, add a DHCP_HOSTNAME variable to your /etc/sysconfig/network-scripts/ifcfg-eth0 file (eth0 being your NIC’s interface name):

UUID="616426f3-ac0b-4a4a-9221-62a0055bfb07"
NM_CONTROLLED="yes"
NETBOOT="yes"
BOOTPROTO="dhcp"
DHCP_HOSTNAME="MyFedoraBox"
DEVICE="eth0"
TYPE="Ethernet"
ONBOOT=yes
NAME="DHCP"
HWADDR=00:25:22:4A:3F:F2
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
USERS=user

Of course, this only works if you actually get your IP address via DHCP (since the DHCP server hands off the hostname to the DNS server). If you use a static IP configuration, nsupdate can be used to dynamically update the DNS server records. Examples and instructions on how to use nsupdate can be found at http://linux.yyz.us/nsupdate/ or http://dijks.wordpress.com/2012/07/17/register-a-hostnames-static-ip-with-your-corporate-dns-server/.

Categories: Uncategorized Tags: ,

Expendable Fedora 17 default services

November 16th, 2012 No comments

Based on Harald Hoyer’s great tutorial on boot time optimization for Fedora 17, here’s a list of services I usually disable on my Fedora 17 boxes:

cd /lib/systemd/system
for i in abrt* auditd* sendmail* sm-client* firstboot* ip6tables* fedora*storage* plymouth-*.* lvm2-monitor.* mdmonitor*.*;
do
  systemctl mask $i
done
for i in livesys livesys-late spice-vdagentd ; do sudo chkconfig $i off;done

This is just a memory hook for myself. YMMV and of course what’s expendable depends on the configuration you use on your box.

For an explanation of the systemctl mask command have a look at Lennart Poettering’s systemd tutorial or the systemctl manpage.

Categories: Uncategorized Tags:

Bootstrapping a Fedora 17 rootserver

October 20th, 2012 No comments

Quite a few things have changed since I made the Bootstrapping a Fedora 15 rootserver post, e.g. download urls, anaconda options and the way you add boot targets to grub2 (in contrast to legacy grub). So here’s an updated version…

Get initial ramdisk and kernel

This is basically still the same as with Fedora 15. The download links have changed a bit since download.fedora.redhat.com doesn’t exist any longer (but I’ve updated the old post anyway)

cd /boot/
wget http://dl.fedoraproject.org/pub/fedora/linux/releases/17/Fedora/x86_64/os/isolinux/initrd.img
wget http://dl.fedoraproject.org/pub/fedora/linux/releases/17/Fedora/x86_64/os/isolinux/vmlinuz

Add a boot target to grub

Edit /etc/grub.d/40_custom and add the following menu entry

[...]
menuentry 'Fedora 17 Install' {
  set root='hd0,2'
  echo    'Loading Linux'
  linux   /vmlinuz vnc vncpassword=SECRET ksdevice=link ks=http://server/ks.cfg
  echo    'Loading initial ramdisk ...'
  initrd  /initrd.img
}

Adjust the root parameter depending on the partition that contains the vmlinuz and initrd.img files (/dev/sda2 in this example, see also Adding custom boot target to GRUB2).

Also note, that I changed the ksdevice parameter from eth0 (which sets a specific interface) to link (which uses the first interface with link up) since NIC interface names are no longer predictable in recent kernel versions (p10p1, em1, eth0, etc.). For a list of all possible value of ksdevice hava a look at the corresponding Fedora wiki page.

After editing /etc/grub.d/40_custom, don’t forget to recreate grub.cfg by invoking

grub2-mkconfig -o /boot/grub2/grub.cfg

After rebooting, connect to the vnc server using the password you specified as usual.

F17vncInstall

click for full size image

Categories: Uncategorized Tags: ,

Change GRUB2 default boot target

September 19th, 2012 No comments

In GRUB, the default boot menu entry was determined by the order of entries in /boot/grub/menu.lst, the default one being the n-th specified by the default=n parameter.

In GRUB2 the main configuration file /boot/grub2/grub.cfg isn’t usually altered manually any more but automatically generated by invoking grub2-mkconfig. You can change the default boot target by changing the GRUB_DEFAULT paramater in /etc/default/grub. It takes three different values:

GRUB_DEFAULT=n specifies the n-th entry in /boot/grub2/grub.cfg. The first entry is selected with GRUB_DEFAULT=0, just like in GRUB.

GRUB_DEFAULT="String" chooses an entry by name (e.g. “Fedora (3.5.3-1.fc17.x86_64)”)

GRUB_DEFAULT=saved chooses the boot target specified in /boot/grub/grubenv regardless whether the order of entries has changed (e.g. due to a kernel update).

To manipulate /boot/grub/grubenv, you can list all possible entries

grep ^menuentry /boot/grub2/grub.cfg | cut -d "'" -f2

and specify the desired one with

grub2-set-default <menu entry title>

To verify the default menu entry, use

grub2-editenv list

Note that you have to run

grub2-mkconfig -o /boot/grub2/grub.cfg

if you make any changes to /etc/default/grub (e.g. change the GRUB_DEFAULT parameter). You don’t have to invoke it, if you just change the default target with grub2-set-default since this just alters grubenv but doesn’t make any changes to grub.cfg.

Resources:
http://fedoraproject.org/wiki/GRUB_2
http://www.linuxreaders.com/2011/11/fedora-16-how-to-change-boot-sequence-grub2.html

Categories: Uncategorized Tags: ,

How to list rpm packages from certain repository

June 21st, 2012 No comments

Usually, rpm --queryformat can be used to generate all sorts of rpm package listing. You could, for example, use the vendor tag to separate the packages that are tagged with RPM Fusion from the list of all installed packages (rpm -qa):

$ rpm -qa --queryformat "%{Name}:%{Vendor}\n" | grep -F "RPM Fusion"

Unfortunately, there is no 1:1 mapping between rpm’s vendor tag and the install repository. In some cases, the vendor tag is just slightly altered (upper case letters, etc.) or the tag is completely empty.

And there is obviously no rpm tag for repositories, since rpm itself doesn’t know anything about repositories (you can list all available tags by invoking rpm --querytags). But of course, yum does!
To get a list of packages from the RPM Fusion repository, you can use

$ yum list installed | grep -i fusion

Resources:
http://unix.stackexchange.com/questions/22560/list-all-rpm-packages-installed-from-repo-x
http://www.rpm.org/max-rpm/s1-rpm-query-parts.html

Categories: Uncategorized Tags: , ,

Error “you have not created a bootloader stage1 target device”

April 10th, 2012 2 comments

This rather cryptic error may appear during a Fedora 16 installation and simply tries to tell you, that you forgot to create a BIOS boot partition.
If you’re doing a kickstart install, a look at Fedora’s Kickstart wiki page may be helpful. A big yellow alert box essentially tells you to add the following line

part biosboot --fstype=biosboot --size=1

to your kickstart file that used to work with Fedora versions <= 15.

Resources:
Fedora 16 common bugs
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=752063

Categories: Uncategorized Tags: ,

Changing rpmbuild working directory

March 18th, 2012 No comments

Usually, rpmbuild related variables are set in ~/.rpmmacros. To change the current working directory, one could simply alter the default settings:

%_topdir      %(echo $HOME)/rpmbuild

This would change rpmbuild’s working directory on a per-user basis.

Sometimes it’s quite convenient to keep the default setting and change the working directory on a per-project basis:

$ rpmbuild --define "_topdir workingdir" -ba project.spec

To use the current directory as working directory, one could invoke rpmbuild as follows:

$ rpmbuild --define "_topdir `pwd`" -ba SPECS/project.spec

Careful: Double quotes are mandatory as well as having a proper subdirectory structure in the new working directory (BUILD, SRPM, RPM, SPECS and SOURCES).

Resources:
http://www.rpm.org/max-rpm/s1-rpm-anywhere-different-build-area.html
http://stackoverflow.com/questions/416983/why-is-topdir-set-to-its-default-value-when-rpmbuild-called-from-tcl

Categories: Uncategorized Tags: ,