https://wiki.archlinux.org/api.php?action=feedcontributions&user=81.63.69.182&feedformat=atomArchWiki - User contributions [en]2024-03-28T15:00:08ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Map_Custom_Device_Entries_with_udev&diff=7101Map Custom Device Entries with udev2005-12-17T23:06:44Z<p>81.63.69.182: remove spam</p>
<hr />
<div>[[Category:Hardware]]<br />
<br />
WIP - DibbleTheWrecker<br />
<br />
=== Use udev and hotplug to map multiple nodes to a device===<br />
<br />
This information is basically mirrored from the gentoo wiki with some additional hints.<br />
<br />
This process allows you to always map a specific device to the same /dev node. This can then be used in fstab to ensure you can always mount the device same device in exactly the same place - which is great for desktop shortcuts!<br />
<br />
==== 1. Get the udev info for your usb device====<br />
<br />
Make sure one of your target devices is plugged in and then run the following as root:<br />
<br />
<pre>udevinfo -a -p `udevinfo -q path -n /dev/sda`<br />
</pre><br />
<br />
This gets the udev device info for the device on /dev/sda - if your device is not mapped to /dev/sda then obviously use the correct mapping :)<br />
<br />
You should get some output like this:<br />
<br />
<pre><br />
udevinfo starts with the device the node belongs to and then walks up the<br />
device chain, to print for every device found, all possibly useful attributes<br />
in the udev key format.<br />
Only attributes within one device section may be used together in one rule,<br />
to match the device for which the node will be created.<br />
<br />
device '/sys/block/sda/sda1' has major:minor 8:1<br />
looking at class device '/sys/block/sda/sda1':<br />
SYSFS{dev}="8:1"<br />
SYSFS{size}="499195"<br />
SYSFS{start}="4"<br />
SYSFS{stat}=" 84 84 202 202"<br />
<br />
follow the class device's "device"<br />
looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0':<br />
BUS="scsi"<br />
ID="0:0:0:0"<br />
SYSFS{detach_state}="0"<br />
SYSFS{device_blocked}="0"<br />
SYSFS{max_sectors}="240"<br />
SYSFS{model}="disgo "<br />
SYSFS{queue_depth}="1"<br />
SYSFS{rev}="4.70"<br />
SYSFS{scsi_level}="3"<br />
SYSFS{state}="running"<br />
SYSFS{timeout}="30"<br />
SYSFS{type}="0"<br />
SYSFS{vendor}=" "<br />
<br />
looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1:1.0/host0/target0:0:0':<br />
BUS=""<br />
ID="target0:0:0"<br />
SYSFS{detach_state}="0"<br />
<br />
looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1:1.0/host0':<br />
BUS=""<br />
ID="host0"<br />
SYSFS{detach_state}="0"<br />
<br />
looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1:1.0':<br />
BUS="usb"<br />
ID="1-1:1.0"<br />
SYSFS{bAlternateSetting}=" 0"<br />
SYSFS{bInterfaceClass}="08"<br />
SYSFS{bInterfaceNumber}="00"<br />
SYSFS{bInterfaceProtocol}="50"<br />
SYSFS{bInterfaceSubClass}="06"<br />
SYSFS{bNumEndpoints}="02"<br />
SYSFS{detach_state}="0"<br />
<br />
looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-1':<br />
BUS="usb"<br />
ID="1-1"<br />
SYSFS{bConfigurationValue}="1"<br />
SYSFS{bDeviceClass}="00"<br />
SYSFS{bDeviceProtocol}="00"<br />
SYSFS{bDeviceSubClass}="00"<br />
SYSFS{bMaxPower}="178mA"<br />
SYSFS{bNumConfigurations}="1"<br />
SYSFS{bNumInterfaces}=" 1"<br />
SYSFS{bcdDevice}="0200"<br />
SYSFS{bmAttributes}="80"<br />
SYSFS{detach_state}="0"<br />
SYSFS{devnum}="2"<br />
SYSFS{idProduct}="0012"<br />
SYSFS{idVendor}="08ec"<br />
SYSFS{manufacturer}="M-Sys"<br />
SYSFS{maxchild}="0"<br />
SYSFS{product}="disgo"<br />
SYSFS{serial}="1730C13B18000B84"<br />
SYSFS{speed}="12"<br />
SYSFS{version}=" 2.00"<br />
<br />
looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.0/usb1':<br />
BUS="usb"<br />
ID="usb1"<br />
SYSFS{bConfigurationValue}="1"<br />
SYSFS{bDeviceClass}="09"<br />
SYSFS{bDeviceProtocol}="00"<br />
SYSFS{bDeviceSubClass}="00"<br />
SYSFS{bMaxPower}=" 0mA"<br />
SYSFS{bNumConfigurations}="1"<br />
SYSFS{bNumInterfaces}=" 1"<br />
SYSFS{bcdDevice}="0206"<br />
SYSFS{bmAttributes}="c0"<br />
SYSFS{detach_state}="0"<br />
SYSFS{devnum}="1"<br />
SYSFS{idProduct}="0000"<br />
SYSFS{idVendor}="0000"<br />
SYSFS{manufacturer}="Linux 2.6.10-ARCH uhci_hcd"<br />
SYSFS{maxchild}="2"<br />
SYSFS{product}="Intel Corp. 82801CA/CAM USB (Hub #1)"<br />
SYSFS{serial}="0000:00:1d.0"<br />
SYSFS{speed}="12"<br />
SYSFS{version}=" 1.10"<br />
<br />
looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.0':<br />
BUS="pci"<br />
ID="0000:00:1d.0"<br />
SYSFS{class}="0x0c0300"<br />
SYSFS{detach_state}="0"<br />
SYSFS{device}="0x2482"<br />
SYSFS{irq}="11"<br />
SYSFS{local_cpus}="1"<br />
SYSFS{subsystem_device}="0x4541"<br />
SYSFS{subsystem_vendor}="0x8086"<br />
SYSFS{vendor}="0x8086"<br />
<br />
looking at the device chain at '/sys/devices/pci0000:00':<br />
BUS=""<br />
ID="pci0000:00"<br />
SYSFS{detach_state}="0"<br />
</pre><br />
<br />
Bit too much information! The only bit of this you actaully need is the =SYSFS{serial}= part - so now you know what the above command does just grep out the bit you want in future cases:<br />
<br />
<pre>udevinfo -a -p `udevinfo -q path -n /dev/sda` || grep SYSFS{serial}<br />
</pre><br />
<br />
==== 2. Create a udev rule====<br />
<br />
You then use the SYSFS{serial} in a udev rule as follows:<br />
<br />
Note: The convention for Arch Linux is to place custom rules into /etc/udev/rules.d/00.rules<br />
<br />
<pre>BUS="usb", SYSFS{serial}="0402170100000020EB5D00000000000", KERNEL="sd?1", NAME="%k", SYMLINK="usbdrive", GROUP="storage"<br />
</pre><br />
<br />
==== 3. Create an fstab entry and mount point====<br />
<br />
Create a directory: mkdir /mnt/usbdrive<br />
<br />
In your /etc/fstab, create an entry like this:<br />
<br />
<pre><br />
/dev/usbdrive /mnt/usbdrive vfat noauto,user,noexec,nodev,nosuid 0 0<br />
</pre><br />
<br />
Now root or any user who belongs to the "storage" group can mount the usb stick by simply doing<br />
mount /mnt/usbdrive<br />
<br />
Btw, all the last 3 additional mount options are meant to increase your system's security, e.g. they will prevent you running an executable file directly from the usb drive.<br />
<br />
Check if /etc/group contains an entry called "storage".<br />
<br />
If it does not, simply do a "groupadd storage"<br />
<br />
Then edit /etc/group to make the new storage group entry look like this:<br />
<pre><br />
storage:x:102:user1,user2<br />
</pre><br />
user1 and user2 are the names of the non-root users you wish to have access to the usb stick.<br />
<br />
==== 4. Restart udev====<br />
Only if really needed, you may restart udev like this. As root, run those 3 commands:<br />
<pre><br />
/etc/./start_udev<br />
mount /dev/pts<br />
mount /dev/shm<br />
</pre><br />
<br />
==== 5. Examples====<br />
<br />
Here are some examples from my system. My devices sometimes mount on sda or sda1 so I have two rules for each - this is a work around for device not found problems. The sda node is also needed for disk-level activities e.g. fdisk /dev/sda.<br />
<br />
Note: The convention for Arch Linux is to place custom rules into /etc/udev/rules.d/00.rules<br />
<br />
This always maps my disgo USB pen to /dev/usbpen which i then map in fstab to mount on /mnt/usbpen<br />
<br />
<pre># Symlink USB pen<br />
BUS=="usb", SYSFS{serial}=="1730C13B18000B84", KERNEL=="sd?", NAME="%k", SYMLINK+="usbpen", GROUP="storage"<br />
BUS=="usb", SYSFS{serial}=="1730C13B18000B84", KERNEL=="sd?1", NAME="%k", SYMLINK+="usbpen", GROUP="storage"<br />
</pre><br />
<br />
If you have a device with with multiple partitions, the following example maps the device to /dev/usbdisk, and partitions 1,2,3,etc to usbdisk1, usbdisk2, usbdisk3, etc<br />
<br />
<pre># Symlink multi-part device<br />
BUS=="usb", SYSFS{serial}=="1730C13B18000B84", KERNEL=="sd?", NAME="%k", SYMLINK+="usbdisk", GROUP="storage"<br />
BUS=="usb", SYSFS{serial}=="1730C13B18000B84", KERNEL=="sd?[1-9]", NAME="%k", SYMLINK+="usbdisk%n", GROUP="storage"<br />
</pre><br />
<br />
This always maps our Olympus digicam to /dev/usbcam which i then map in fstab to mount on /mnt/usbcam<br />
<br />
<pre># Symlink USB camera<br />
BUS=="usb", SYSFS{serial}=="000207532049", KERNEL=="sd?", NAME="%k", SYMLINK+="usbcam", GROUP="storage"<br />
BUS=="usb", SYSFS{serial}=="000207532049", KERNEL=="sd?1", NAME="%k", SYMLINK+="usbcam", GROUP="storage"<br />
</pre><br />
<br />
And this maps my Packard Bell MP3 player to /dev/mp3player<br />
<br />
<pre># Symlink MP3 player<br />
BUS=="usb", SYSFS{serial}=="0002F5CF72C9C691", KERNEL=="sd?", NAME="%k", SYMLINK+="mp3player", GROUP="storage"<br />
BUS=="usb", SYSFS{serial}=="0002F5CF72C9C691", KERNEL=="sd?1", NAME="%k", SYMLINK+="mp3player", GROUP="storage"<br />
</pre><br />
<br />
To map your own usb key to /dev/mykey and all of other keys to /dev/otherkey<br />
<br />
<pre># Symlink USB keys<br />
BUS=="usb", SYSFS{serial}=="insert serial key", KERNEL=="sd?1", NAME="%k", SYMLINK+="mykey"<br />
BUS=="usb", KERNEL=="sd?1", NAME="%k", SYMLINK+="otherkey"<br />
</pre><br />
Note the order of the lines. Since all the usb keys should create the /dev/sd<a||b> node, udev will first check if it is your own usb key, defined with the serial number. But if you plug another key witch you don't know the serial number, it will create a node too, with a generic name "otherkey". That rule should be the last one your rules file.</div>81.63.69.182https://wiki.archlinux.org/index.php?title=GRUB_Legacy&diff=7100GRUB Legacy2005-12-17T23:06:29Z<p>81.63.69.182: remove spam</p>
<hr />
<div>[[Category:Boot Process]]<br />
Grand Unified Boot Loader (grub)<br />
<br />
= Installation into Master Boot Record = <br />
<br />
grub-install -root-directory ''Mount-Point'' (hdn) <br />
<br />
Installs grub into the MBR of a hard disc. The option gives the path to the kernel-image, if it is not in /, f.e. in /boot.<br><br />
(hdn) is a disc, where n is the number of the disc, starting with 0.<br />
<br />
Example:<br />
grub-install --root-directory=/boot '(hd0)'<br />
<br />
grub-install /dev/hda<br />
<br />
= Configuration =<br />
The grub configuration is done in this file:<br />
/boot/grub/menu.lst<br />
<br />
* <i>(hdn,m)</i> is the partition m on disc n, numbers starting with 0<br />
* <i>splashimage (hdn,m)/grub/Name.xpm.gz</i> is the splash-image-file<br />
* <i>default n</i> is the default boot entry, that is choosen after timout for user action<br />
* <i>timeout m</i> time m to wait in seconds for a user selection, before default is booted<br />
* <i>password -md5 str</i> encrypted boot password 'str'<br />
* <i>title str</i> title string 'str' for a boot entry<br />
* <i>root (hdn,m)</i> base partition, where the kernel is stored to<br />
* <i>kernel /path ro root=/dev/device initrd /initrd.img</i> use the root option, if the kernel not placed in /<br />
* <i>makeactive<br>chainloader +1</i> sets root active and gives booting procedure to its boot-loader (for Windows, f.e.)<br />
* <i>map (hd0) (hd1)<br>map (hd1) (hd0)</i> changes primary and secondary disc for a boot, necessary to boot Windows from a secondary disc<br />
* <i>root (hdn,m,z)<br>kernel /boot/loader</i> boots the FreeBSD-Partition x<br />
* <i>default saved</i> remebers each current boot selection and makes it the new default. Place "savedefault" at the end of each boot section, for that you want this feature shall be used.<br />
<br />
For those who like eye-candy, there is [[Graphical GRUB]].<br />
== LiLO and GRUB interaction ==<br />
If you once had used [[lilo]] Don't forget to remove it from master boot record with <br />
pacman -R lilo<br />
as some tasks (f.e. kernel compilation using <code>make all</code>) will make a lilo call, and then lilo is installed over grub.<br />
<br />
* Read also [[Grub configure examples]]<br />
<br />
==== Troubleshooting====<br />
<br />
* If you are having problems like grub freezing when you do a grub install, use the command abs to get the PKGBUILS of the arch base packages and then use the command as root:<br />
<br />
cd /var/abs/base/grub/<br />
./install-grub<br />
<br />
= External Resources =<br />
* [http://www.gnu.org/software/grub/ Grub Website]</div>81.63.69.182https://wiki.archlinux.org/index.php?title=Mutt&diff=7099Mutt2005-12-17T23:06:20Z<p>81.63.69.182: remove spam</p>
<hr />
<div>[[Category:Desktop]]<br />
Mutt is a text-based mail client renowned for its powerful features. Mutt, though over a decade old, remains the mail client of choice for great number of power-users. Unfortunately, a default mutt install is plagued by complex keybindings, and a daunting amount of documentation. This guide will help the average user get mutt up and running, and begin customizing it to his/her taste.<br />
<br />
== Quick Start ==<br />
<br />
=== What Mutt Does Not Do ===<br />
Mutt is a Mail User Agent (MUA), and was written to view mail. It was not written to retrieve, send, or sort mail. It relies on external programs to do those tasks. For this wiki, we will be using getmail to retrieve our mail, procmail to sort our mail, and msmtp to send our mail.<br />
<br />
==Setting up for POP mail==<br />
<br />
Because IMAP protocol does not cache your mail locally you can skip this section.<br />
<br />
=== Retrieving Mail ===<br />
First install [http://pyropus.ca/software/getmail/ getmail]. It is in the <code>[extra]</code> repository.<br />
pacman -S getmail<br />
Now create the directory <code>~/.getmail/</code>. Open the file <code>~/.getmail/getmailrc</code> in your favorite text editor.<br />
<br />
Here is an example <code>getmailrc</code> used with a gmail account.<br />
<pre><br />
[retriever]<br />
type = SimplePOP3SSLRetriever<br />
server = pop.gmail.com<br />
username = username@gmail.com<br />
port = 995<br />
password = password<br />
<br />
[destination]<br />
type = Maildir<br />
path = ~/mail<br />
</pre><br />
<br />
You can tweak this to your POP3 service's specification.<br />
<br />
For this guide we will be storing our mail in the <code>maildir</code> format. The two main mailbox formats are <code>mbox</code> and <code>maildir</code>. The main difference between the two is that <code>mbox</code> is one file, with all of your mails and their headers stored in it, whereas a <code>maildir</code> is a directory tree. Each mail is its own file, which will often speed things up.<br />
<br />
A <code>maildir</code> is just a folder with the folders <code>cur</code>, <code>new</code> and <code>tmp</code> in it.<br />
mkdir -p ~/mail/{cur,new,tmp}<br />
<br />
Now, run getmail. If it works fine, you can create a cronjob for getmail to run every n hours/minutes. Type <code>crontab -e</code> to edit cronjobs, and enter the following:<br />
/30 * * * * /usr/bin/getmail<br />
That will run <code>getmail</code> every 30 minutes.<br />
<br />
=== Sorting Mail ===<br />
<br />
[http://www.procmail.org/ Procmail] is an extremely powerful sorting tool. For the purposes of this wiki, we will do some primitive sorting to get started.<br />
<br />
First, install procmail. It is in the <code>[current]</code> repository.<br />
pacman -S procmail<br />
You must edit your getmailrc to pass retrieved mail to procmail.<br />
<pre><br />
[destination]<br />
type = MDA_external<br />
path = /usr/bin/procmail<br />
</pre><br />
<br />
Now, open up <code>.procmailrc</code> in your favorite editor. The following will sort all mail from the happy-kangaroos mailing list, and all mail from your lovey-dovey friend in their own maildirs.<br />
<pre><br />
MAILDIR=$HOME/mail<br />
DEFAULT=$MAILDIR/inbox/<br />
LOGFILE=$MAILDIR/log<br />
<br />
:0<br />
* ^TOhappy-kangaroos@nicehost.com<br />
happy-kangaroos/<br />
<br />
* ^FROMloveydovey@iheartyou.net<br />
lovey-dovey/<br />
</pre><br />
After you've saved your <code>.procmailrc</code>, run getmail and see if procmail succeeds in sorting your mail into the appropriate directories.<br />
<br />
==Setting up for SMTP==<br />
<br />
Whether you use POP or IMAP to recieve mail you will probably still send mail using SMTP.<br />
<br />
=== Sending Mail ===<br />
[http://msmtp.sourceforge.net/ Msmtp] is a very simple and easy to use smtp client. It is in the <code>[extra]</code> repository.<br />
pacman -S msmtp<br />
Open up <code>~/.msmtprc</code> in your favorite editor. The following is an example of an <code>.msmtprc</code> for a gmail account:<br />
<pre><br />
account default<br />
host smtp.gmail.com<br />
port 587<br />
protocol smtp<br />
auth on<br />
from username@gmail.com<br />
user username@gmail.com<br />
password mypassword<br />
tls on<br />
tls_starttls on<br />
</pre><br />
Now mutt must be configured to use msmtp. Make a directory <code>~/.mutt/</code>, and open up <code>~/.mutt/muttrc</code>. The following should get you started viewing and sending mail.<br />
<pre><br />
set realname='Disgruntled Kangaroo'<br />
<br />
set sendmail="/usr/bin/msmtp"<br />
<br />
set edit_headers=yes<br />
set folder=~/mail<br />
set mbox=+mbox<br />
set spoolfile=+inbox<br />
set record=+sent<br />
set postponed=+drafts<br />
set mbox_type=Maildir<br />
<br />
mailboxes +inbox +lovey-dovey +happy-kangaroos<br />
</pre><br />
<br />
Now, startup mutt. You should see all the mail in <code>~/mail/inbox</code>. Press <code>m</code> to compose mail (it will use the editor defined by your <code>EDITOR</code> environment variable. If this variable is not set, type <code>export EDITOR=/path/to/yourfavorite/editor</code>. For testing purposes, address the letter to yourself. After you have written the lovely letter, use your editor's save and exit command. You will return to mutt, which will show you information about your e-mail. Press <code>y</code> to send it. If everything works, congratulations! You can use mutt! However, realizing the true power of mutt comes with much customizing.<br />
<br />
== Customizing Mutt ==<br />
<br />
Coming Soon, but until then, you can view some sample mutt configs at the [http://wiki.mutt.org/?ConfigList Mutt Wiki]. <br />
<br />
[[User:Xterminus|xterminus]] is pretty active in the mutt community, so if you have any mutt specific questions, feel free to ask in [[ArchChannel|the irc channel]].</div>81.63.69.182