{"id":136,"date":"2005-06-09T01:58:49","date_gmt":"2005-06-08T22:58:49","guid":{"rendered":"https:\/\/void.gr\/kargig\/blog\/?p=136"},"modified":"2005-06-09T02:04:31","modified_gmt":"2005-06-08T23:04:31","slug":"the-right-way-to-enable-udev-in-gentoo","status":"publish","type":"post","link":"https:\/\/www.void.gr\/kargig\/blog\/2005\/06\/09\/the-right-way-to-enable-udev-in-gentoo\/","title":{"rendered":"the right way to enable udev in gentoo"},"content":{"rendered":"<p>I know there are numerous postings and wiki articles on the net on how to enable udev on a linux distribution and specifically for Gentoo. Because I did not find anything complete here&#8217;s my version on doing all that. The were 2 reasons I started looking around for udev support, first reason was to have a special device for my olympus c70z so I did not have to &#8220;fdisk -l&#8221; every time I wanted to check on what device it was, and secondly to improve the <a href=\"https:\/\/void.gr\/kargig\/blog\/2005\/04\/15\/more-fun-with-a-usb-key-pam_usb-hotplug-and-xlockmore\/\">usb_key+hotplug+xlockmore<\/a> stuff I had done earlier.<\/p>\n<p>BEWARE!!!<br \/>\nI am not writing this guide for complete newbies to linux and kernel stuff&#8230;I am not going to explain how to compile a kernel and where to put it and and and and&#8230;cause it would never end.<\/p>\n<p>First thing to do check your kernel settings!!<\/p>\n<p><code>Device Drivers -> USB Support<br \/>\n< *> Support for Host-side USB<br \/>\n[*]   USB device filesystem<br \/>\n< *> EHCI HCD (USB 2.0) support<br \/>\n< *> OHCI HCD support<\/code><\/p>\n<p><code><br \/>\nFor SCSI support<br \/>\nDevice Drivers -> SCSI device support<br \/>\n[*]   legacy \/proc\/scsi\/ support<br \/>\n< *>   SCSI disk support<br \/>\n< *>   SCSI generic support<br \/>\n<\/code><br \/>\n<code><br \/>\nFor vfat file system support<br \/>\nFile systems -> DOS\/FAT\/NT Filesystems<br \/>\n< *> MSDOS fs support<br \/>\n< *> VFAT (Windows-95) fs support<br \/>\n<\/code><\/p>\n<p><code><br \/>\nRemove devfs support (<em>If you want...<\/em>)<br \/>\nFile systems -> Pseudo filesystems<br \/>\n[ ] \/dev file system support (OBSOLETE)<br \/>\n<strong>BUT YOU MUST REMOVE !!!!<\/strong>  below devfs support.<br \/>\n[ ]   Automatically mount at boot    (<strong>SAY NO TO THIS!!!!<\/strong>)<br \/>\n<\/code><\/p>\n<p>Then emerge the proper packages:<br \/>\n<code>emerge -uDv udev hotplug baselayout<\/code><\/p>\n<p>Edit your <em>\/etc\/conf.d\/rc<\/em>:<br \/>\nYou <strong>must<\/strong> have settings like that:<br \/>\n<code>RC_DEVICES=\"udev\"<br \/>\nRC_DEVICE_TARBALL=\"yes\"<br \/>\nRC_DEVFSD_STARTUP=\"no\"<br \/>\n<\/code><\/p>\n<p>then:<br \/>\n<code>sysctl -w kernel.hotplug=\"\/sbin\/udev\"<br \/>\nrc-update add hotplug boot<\/code><\/p>\n<p>In lilo.conf change the append line of your kernel adding this:<br \/>\n<code>append=\"gentoo=nodevfs\"<\/code><br \/>\nand then type lilo to make the proper changes. <\/p>\n<p>If you rebooted now your system with the new kernel it should have been udev enabled.<\/p>\n<p>You might encounter mouse problems, because the old \/dev\/mouse symlink is lost with udev. Edit \/etc\/conf.d\/gpm and \/etc\/X11\/xorg.conf to replace \/dev\/mouse with \/dev\/input\/mouse0<\/p>\n<p>What&#8217;s next ? udev rules. You must make some rules for udev to properly find your devices.<br \/>\nI am going to explain how I wrote 3 simple rules for my digital camera, my usb stick and my usb-hdd.<br \/>\n1) DIGITAL CAMERA<br \/>\nWhen plugged in the usb port go check your dmesg. You should see something like:<br \/>\n<code>Attached scsi removable disk sdb at scsi7, channel 0, id 0, lun 0<br \/>\nAttached scsi generic <strong>sg1<\/strong> at scsi7, channel 0, id 0, lun 0,  type 0<br \/>\n<\/code><\/p>\n<p>now do this: udevinfo -a -p \/sys\/class\/scsi_generic\/<strong>sg1<\/strong><br \/>\nand a bunch of info like that will appear in front of you:<br \/>\n<code>  looking at the device chain at '\/sys\/devices\/pci0000:00\/0000:00:10.0\/usb2\/2-2':<br \/>\n<strong>    BUS=\"usb\"<\/strong><br \/>\n    ID=\"2-2\"<br \/>\n<em>    DRIVER=\"usb\"<\/em><br \/>\n    SYSFS{bConfigurationValue}=\"1\"<br \/>\n    SYSFS{bDeviceClass}=\"00\"<br \/>\n    SYSFS{bDeviceProtocol}=\"00\"<br \/>\n    SYSFS{bDeviceSubClass}=\"00\"<br \/>\n    SYSFS{bMaxPower}=\"  0mA\"<br \/>\n    SYSFS{bNumConfigurations}=\"1\"<br \/>\n    SYSFS{bNumInterfaces}=\" 1\"<br \/>\n    SYSFS{bcdDevice}=\"0100\"<br \/>\n    SYSFS{bmAttributes}=\"c0\"<br \/>\n    SYSFS{detach_state}=\"0\"<br \/>\n    SYSFS{devnum}=\"6\"<br \/>\n    SYSFS{idProduct}=\"0109\"<br \/>\n    SYSFS{idVendor}=\"07b4\"<br \/>\n<em><strong>    SYSFS{manufacturer}=\"OLYMPUS\"<\/strong><\/em><br \/>\n    SYSFS{maxchild}=\"0\"<br \/>\n<em><strong>    SYSFS{product}=\"C70Z,C7000Z\"<br \/>\n    SYSFS{serial}=\"1234567890\"<\/strong><\/em><br \/>\n    SYSFS{speed}=\"12\"<br \/>\n    SYSFS{version}=\" 2.00\"<br \/>\n<\/code><br \/>\nWe just need the italic ones.<br \/>\nedit \/etc\/udev\/rules.d\/10-local.rules<br \/>\nand add something like this:<br \/>\n<code>BUS=\"usb\", KERNEL=\"sd?1\", SYSFS{manufacturer}=\"OLYMPUS\", SYSFS{serial}=\"1234567890\", SYSFS{product}=\"C70Z,C7000Z\", NAME=\"%k\", SYMLINK=\"c70z\"<\/code><\/p>\n<p>YOUR VALUES WILL DEFER!!!<\/p>\n<p>now &#8220;mkdir -p \/mnt\/digicam&#8221; and add something like this in your \/etc\/fstab:<br \/>\n<code>\/dev\/c70z               \/mnt\/digicam    vfat            noatime,user,rw,sync,uid=1000      0 0<\/code><\/p>\n<p>mount \/mnt\/digicam and your camera is ready to extract the pictures from it!<\/p>\n<p>2) USB KEY<br \/>\nsame as above&#8230;but the rule and fstab entry will defer slightly:<br \/>\nudev rule:<br \/>\n<code>BUS=\"usb\", SYSFS{serial}=\"23DE746790310A9B\", NAME=\"%k\", SYMLINK=\"mykey\"<\/code><br \/>\nfstab entry:<br \/>\n<code>\/dev\/mykey              \/mnt\/usbkey     vfat            noatime,user,rw,sync,uid=1000      0 0<\/code><\/p>\n<p>3) USB HDD<br \/>\nudev rule:<br \/>\n<code>BUS=\"scsi\", SYSFS{model}=\"00JB-32EVA0\", <strong>NAME{all_partitions}=\"wd-usb\" <\/strong><\/code><br \/>\nfstab entry:<br \/>\n<code>\/dev\/wd-usb1            \/mnt\/usbdisk    ext3            noatime,users                   0 0<\/code><\/p>\n<p>Remember <a href=\"https:\/\/void.gr\/kargig\/blog\/2005\/04\/15\/more-fun-with-a-usb-key-pam_usb-hotplug-and-xlockmore\/\">my old post on pam_usb<\/a> ? It gets a lot better with udev!<br \/>\nedit \/etc\/pam.d\/login<br \/>\nand change the rule into something like this now:<br \/>\n<code>auth       sufficient   \/lib\/security\/pam_usb.so proc_basename=\/proc\/scsi\/usb-storage\/1 !check_device <em>force_device=\/dev\/mykey<\/em> allow_remote=1 fs=vfat debug=1 log_file=\/var\/log\/pam_usb.log<br \/>\n<\/code><br \/>\nwhere <em>\/dev\/mykey<\/em> is created by udev so it does not matter where the real device is&#8230;it will always symlink to <em>mykey<\/em>!<\/p>\n<p>You can&#8217;t make it work ? Read these links&#8230;they might help you:<br \/>\n<a href=\"http:\/\/www.gentoo.org\/doc\/en\/udev-guide.xml\">Gentoo udev Guide<\/a><br \/>\n<a href=\"http:\/\/gentoo-wiki.com\/index.php?title=HOWTO_Install_a_digital_camera\">Gentoo Wiki &#8211; HOWTO_Install_a_digital_camera<\/a><br \/>\n<a href=\"http:\/\/webpages.charter.net\/decibelshelp\/LinuxHelp_UDEVPrimer.html\">UDEV Primer<\/a><br \/>\n<a href=\"http:\/\/priyadi.net\/archives\/2004\/11\/06\/using-udev-for-static-device-naming\/\">Using udev for Static Device Naming<\/a><br \/>\n<a href=\"http:\/\/www.reactivated.net\/writing_udev_rules.html\">Writing UDEV rules<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I know there are numerous postings and wiki articles on the net on how to enable udev on a linux distribution and specifically for Gentoo. Because I did not find anything complete here&#8217;s my version on doing all that. The were 2 reasons I started looking around for udev support, first reason was to have [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ep_exclude_from_search":false,"footnotes":""},"categories":[1,3],"tags":[],"class_list":["post-136","post","type-post","status-publish","format-standard","hentry","category-general","category-linux"],"aioseo_notices":[],"views":8787,"_links":{"self":[{"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/posts\/136","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/comments?post=136"}],"version-history":[{"count":0,"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/posts\/136\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/media?parent=136"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/categories?post=136"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/tags?post=136"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}