]> pere.pagekite.me Git - homepage.git/blob - blog/tags/sysadmin/sysadmin.rss
4159bb856b366fa83784f7abd2540eb9198c96dc
[homepage.git] / blog / tags / sysadmin / sysadmin.rss
1 <?xml version="1.0" encoding="utf-8"?>
2 <rss version='2.0' xmlns:lj='http://www.livejournal.org/rss/lj/1.0/'>
3 <channel>
4 <title>Petter Reinholdtsen - Entries tagged sysadmin</title>
5 <description>Entries tagged sysadmin</description>
6 <link>http://people.skolelinux.org/pere/blog/</link>
7
8
9 <item>
10 <title>Debian Jessie, PXE and automatic firmware installation</title>
11 <link>http://people.skolelinux.org/pere/blog/Debian_Jessie__PXE_and_automatic_firmware_installation.html</link>
12 <guid isPermaLink="true">http://people.skolelinux.org/pere/blog/Debian_Jessie__PXE_and_automatic_firmware_installation.html</guid>
13 <pubDate>Fri, 17 Oct 2014 14:10:00 +0200</pubDate>
14 <description>&lt;p&gt;When PXE installing laptops with Debian, I often run into the
15 problem that the WiFi card require some firmware to work properly.
16 And it has been a pain to fix this using preseeding in Debian.
17 Normally something more is needed. But thanks to
18 &lt;a href=&quot;https://packages.qa.debian.org/i/isenkram.html&quot;&gt;my isenkram
19 package&lt;/a&gt; and its recent tasksel extension, it has now become easy
20 to do this using simple preseeding.&lt;/p&gt;
21
22 &lt;p&gt;The isenkram-cli package provide tasksel tasks which will install
23 firmware for the hardware found in the machine (actually, requested by
24 the kernel modules for the hardware). (It can also install user space
25 programs supporting the hardware detected, but that is not the focus
26 of this story.)&lt;/p&gt;
27
28 &lt;p&gt;To get this working in the default installation, two preeseding
29 values are needed. First, the isenkram-cli package must be installed
30 into the target chroot (aka the hard drive) before tasksel is executed
31 in the pkgsel step of the debian-installer system. This is done by
32 preseeding the base-installer/includes debconf value to include the
33 isenkram-cli package. The package name is next passed to debootstrap
34 for installation. With the isenkram-cli package in place, tasksel
35 will automatically use the isenkram tasks to detect hardware specific
36 packages for the machine being installed and install them, because
37 isenkram-cli contain tasksel tasks.&lt;/p&gt;
38
39 &lt;p&gt;Second, one need to enable the non-free APT repository, because
40 most firmware unfortunately is non-free. This is done by preseeding
41 the apt-mirror-setup step. This is unfortunate, but for a lot of
42 hardware it is the only option in Debian.&lt;/p&gt;
43
44 &lt;p&gt;The end result is two lines needed in your preseeding file to get
45 firmware installed automatically by the installer:&lt;/p&gt;
46
47 &lt;p&gt;&lt;blockquote&gt;&lt;pre&gt;
48 base-installer base-installer/includes string isenkram-cli
49 apt-mirror-setup apt-setup/non-free boolean true
50 &lt;/pre&gt;&lt;/blockquote&gt;&lt;/p&gt;
51
52 &lt;p&gt;The current version of isenkram-cli in testing/jessie will install
53 both firmware and user space packages when using this method. It also
54 do not work well, so use version 0.15 or later. Installing both
55 firmware and user space packages might give you a bit more than you
56 want, so I decided to split the tasksel task in two, one for firmware
57 and one for user space programs. The firmware task is enabled by
58 default, while the one for user space programs is not. This split is
59 implemented in the package currently in unstable.&lt;/p&gt;
60
61 &lt;p&gt;If you decide to give this a go, please let me know (via email) how
62 this recipe work for you if you decide to give it a go. :)&lt;/p&gt;
63
64 &lt;p&gt;So, I bet you are wondering, how can this work. First and
65 foremost, it work because tasksel is modular, and driven by whatever
66 files it find in /usr/lib/tasksel/ and /usr/share/tasksel/. So the
67 isenkram-cli package place two files for tasksel to find. First there
68 is the task description file (/usr/share/tasksel/descs/isenkram.desc):&lt;/p&gt;
69
70 &lt;p&gt;&lt;blockquote&gt;&lt;pre&gt;
71 Task: isenkram-packages
72 Section: hardware
73 Description: Hardware specific packages (autodetected by isenkram)
74 Based on the detected hardware various hardware specific packages are
75 proposed.
76 Test-new-install: show show
77 Relevance: 8
78 Packages: for-current-hardware
79
80 Task: isenkram-firmware
81 Section: hardware
82 Description: Hardware specific firmware packages (autodetected by isenkram)
83 Based on the detected hardware various hardware specific firmware
84 packages are proposed.
85 Test-new-install: mark show
86 Relevance: 8
87 Packages: for-current-hardware-firmware
88 &lt;/pre&gt;&lt;/blockquote&gt;&lt;/p&gt;
89
90 &lt;p&gt;The key parts are Test-new-install which indicate how the task
91 should be handled and the Packages line referencing to a script in
92 /usr/lib/tasksel/packages/. The scripts use other scripts to get a
93 list of packages to install. The for-current-hardware-firmware script
94 look like this to list relevant firmware for the machine:
95
96 &lt;p&gt;&lt;blockquote&gt;&lt;pre&gt;
97 #!/bin/sh
98 #
99 PATH=/usr/sbin:$PATH
100 export PATH
101 isenkram-autoinstall-firmware -l
102 &lt;/pre&gt;&lt;/blockquote&gt;&lt;/p&gt;
103
104 &lt;p&gt;With those two pieces in place, the firmware is installed by
105 tasksel during the normal d-i run. :)&lt;/p&gt;
106
107 &lt;p&gt;If you want to test what tasksel will install when isenkram-cli is
108 installed, run &lt;tt&gt;DEBIAN_PRIORITY=critical tasksel --test
109 --new-install&lt;/tt&gt; to get the list of packages that tasksel would
110 install.&lt;/p&gt;
111
112 &lt;p&gt;&lt;a href=&quot;https://wiki.debian.org/DebianEdu/&quot;&gt;Debian Edu&lt;/a&gt; will be
113 pilots in testing this feature, as isenkram is used to install
114 firmware now.&lt;/p&gt;
115 </description>
116 </item>
117
118 <item>
119 <title>Scripting the Cerebrum/bofhd user administration system using XML-RPC</title>
120 <link>http://people.skolelinux.org/pere/blog/Scripting_the_Cerebrum_bofhd_user_administration_system_using_XML_RPC.html</link>
121 <guid isPermaLink="true">http://people.skolelinux.org/pere/blog/Scripting_the_Cerebrum_bofhd_user_administration_system_using_XML_RPC.html</guid>
122 <pubDate>Thu, 6 Dec 2012 10:30:00 +0100</pubDate>
123 <description>&lt;p&gt;Where I work at the &lt;a href=&quot;http://www.uio.no/&quot;&gt;University of
124 Oslo&lt;/a&gt;, we use the
125 &lt;a href=&quot;http://sourceforge.net/projects/cerebrum/&quot;&gt;Cerebrum user
126 administration system&lt;/a&gt; to maintain users, groups, DNS, DHCP, etc.
127 I&#39;ve known since the system was written that the server is providing
128 an &lt;a href=&quot;http://en.wikipedia.org/wiki/XML-RPC&quot;&gt;XML-RPC&lt;/a&gt; API, but
129 I have never spent time to try to figure out how to use it, as we
130 always use the bofh command line client at work. Until today. I want
131 to script the updating of DNS and DHCP to make it easier to set up
132 virtual machines. Here are a few notes on how to use it with
133 Python.&lt;/p&gt;
134
135 &lt;p&gt;I started by looking at the source of the Java
136 &lt;a href=&quot;http://cerebrum.svn.sourceforge.net/viewvc/cerebrum/trunk/cerebrum/clients/jbofh/&quot;&gt;bofh
137 client&lt;/a&gt;, to figure out how it connected to the API server. I also
138 googled for python examples on how to use XML-RPC, and found
139 &lt;a href=&quot;http://tldp.org/HOWTO/XML-RPC-HOWTO/xmlrpc-howto-python.html&quot;&gt;a
140 simple example in&lt;/a&gt; the XML-RPC howto.&lt;/p&gt;
141
142 &lt;p&gt;This simple example code show how to connect, get the list of
143 commands (as a JSON dump), and how to get the information about the
144 user currently logged in:&lt;/p&gt;
145
146 &lt;blockquote&gt;&lt;pre&gt;
147 #!/usr/bin/env python
148 import getpass
149 import xmlrpclib
150 server_url = &#39;https://cerebrum-uio.uio.no:8000&#39;;
151 username = getpass.getuser()
152 password = getpass.getpass()
153 server = xmlrpclib.Server(server_url);
154 #print server.get_commands(sessionid)
155 sessionid = server.login(username, password)
156 print server.run_command(sessionid, &quot;user_info&quot;, username)
157 result = server.logout(sessionid)
158 print result
159 &lt;/pre&gt;&lt;/blockquote&gt;
160
161 &lt;p&gt;Armed with this knowledge I can now move forward and script the DNS
162 and DHCP updates I wanted to do.&lt;/p&gt;
163 </description>
164 </item>
165
166 </channel>
167 </rss>