May
9
A Root Shell On Ubuntu : The Right Way
Filed Under Ubuntu | 21 Comments
Just the other day we were having a discussion on using the root shell in Ubuntu. Now, remember, the root user account is disabled with no assigned password on a default Ubuntu system so administrative tasks need to be done using the sudo command. For nearly all of the administration you would need sudo will be adequate. There are occasionally those fringe cases where you might require a root shell. Below I have a few alternatives and then, if you must, the correct way of opening a root shell.
For more information please see the RootSudo page on the Ubuntu Community Wiki.
Alternatives To A Root Shell
One of the most common reasons that a user might need a root shell is due to output redirection not working as expecting while using sudo. This can be bypassed fairly easily. Let me outline an example:
sudo echo “foo” > /root/somefile
The above example will not work because the normal user does not have access to write to the root user home directory, and combining the redirection in the command we’ve lost sudo access.
An alternative that will work would look something like this:
echo "foo" | sudo tee /root/somefile
This will echo the output on the console but the tee command ('man tee‘ for more information) will also take that output and write it to the file as expected. Also note that 'tee -a' will work in the same fashion as >>, appending the data to the current file vs overwriting.
The Proper Way To A Root Shell
If you still need a root shell (perhaps you’ve come across a different scenario? perhaps you’re just lazy? perhaps you’re coming from another distribution?) let me outline the proper way to gain a root shell.
DISCLAIMER: This should be avoided if at all possible. It is not suggested to run a root shell on an Ubuntu system. Use at your own risk. See examples above, etc.
sudo -i
The command sudo -i is the equivalent to the 'su -' command. This will properly change to the root user, switch to the root user’s home directory, use his (her?) environment values, etc.
sudo -s
The command sudo -s is the equivalent to the 'su' command. This will change to the root user but will not properly use his (her?) environment values, etc.
The WRONG Way To A Root Shell
Please DO NOT use the following methods to gain root access:
sudo bash, sudo sh, sudo su -, sudo su, sudo -i -u root
If you currently do use these methods this post was written for you!
UPDATE: Based on the feedback in the comments for this post I’ll try to expand the reasoning on *why* the right way is the preferred way.
First of all we need to understand some background information. When a user creates a session there are a number of environment values that are set. To have a look at some of these try this command:
env
This will output a number of details about the current working environment. These environment values may be different for different users. Some of the values are generated by way of the .bashrc file (assuming a bash shell, of course), the .bash_profile, etc. Take a look at the .bashrc in your users home directory and compare it with the .bashrc in root’s home directory.
diff -u ~/.bashrc /root/.bashrc
You should see some differences, and this is just from one of the multiple files that are read during a proper login.
When creating a root shell by using ‘sudo bash‘ you are not incorporating the root environment properly. You are creating a shell with root privileges but the env output is still that of your user. Each user, whether unprivileged or root, should have unique environment settings to truly be that user. This will be the case for ‘sudo bash‘, ‘sudo su‘ and ‘sudo sh‘.
I post tutorials very regularly on this site. You may want to consider subscribing to the RSS feed. Or if you'd prefer these tips sent to your inbox you can use Email Subscriptions.
Apr
23
Upgrade Ubuntu 6.06 to Ubuntu 8.04
Filed Under Randomness, Ubuntu | 3 Comments
With Ubuntu 8.04 being the second LTS (Long Term Support) release it is also possible to upgrade from LTS to LTS releases. This means upgrading Ubuntu 6.06 to Ubuntu 8.04. I have tested this in a previous post, “Dapper 6.06 to Hardy 8.04 Direct Server Upgrade“, which you might also be interested in (that post is regarding the Server and not the Desktop release.)
Upgrading via Update Manager
Step 1: It is suggested that you make sure your BIOS is up-to-date before you try such an upgrade. This is based on some changes in the latest kernel releases which can conflict with older BIOS firmware.
Step 2: You’ll need to make sure that the dapper-updates software channel is activated. (See my previous post linked above for an example of which repositories can/should be enabled.)
Step 3: Press Alt-F2 and type
gksu "update-manager -d"Step 4: Click the Check button to check for new updates.
Step 5: A message will appear informing you of the availability of the new release.
Step 6: Click Upgrade
Step 7: Follow the instructions as the Update Manager utility will walk you through each step of the upgrade. You will still have a chance to back out after clicking Upgrade if you feel you’re not yet ready.
For more information and other information from the Wiki see: Upgrade Notes
Apr
18
The Ubuntu team is pleased to announce the Release Candidate for Ubuntu 8.04 LTS (Long-Term Support) on desktop and server. Codenamed “Hardy Heron”, 8.04 LTS continues Ubuntu’s proud tradition of integrating the latest and greatest open source technologies into a high-quality, easy-to-use Linux distribution.
We consider this release candidate to be complete, stable, and suitable for testing by any user.
Ubuntu 8.04 LTS Desktop Edition features incremental improvements to familiar applications, with an emphasis on stability for this second Ubuntu long-term support release, and is easier than ever to try out with the new Wubi installer.
Ubuntu 8.04 LTS Server Edition follows in the footsteps of Ubuntu 7.10 with even more virtualization support and security enhancements - enabling AppArmor for more applications by default, improving protection of kernel memory against attacks, and supporting KVM and iSCSI technologies out of the box.
The Ubuntu 8.04 LTS family of variants, Kubuntu, Xubuntu, UbuntuStudio, and Mythbuntu, also reach RC status today.
The final release of Ubuntu 8.04 LTS is scheduled for 24 April 2008 and will be supported for three years on the desktop and five years on the server.
Before installing or upgrading to Ubuntu 8.04 LTS please read http://www.ubuntu.com/getubuntu/releasenotes/804
About The Release Candidate
—————————
The purpose of the Release Candidate is to solicit one last round of testing before the final release. Here are ways that you can help:
- Upgrade from Ubuntu, Kubuntu, or Edubuntu 7.10 to the Release Candidate by following the instructions given above.
- Participate in installation testing using the Release Candidate CD images, by following the testing and reporting instructions at http://wiki.ubuntu.com/Testing/ISO
Desktop Features
—————-
Improved application selection: the GNOME desktop sports a number of improvements to the default applications, including more feature-full clients for BitTorrent and VNC, as well as an advanced UI for mastering CDs and DVDs.
File browsing: an enhanced filesystem layer brings greater performance and flexibility to Nautilus, the GNOME file browser.
Pluggable audio and video output: the PulseAudio sound server is integrated in the GNOME desktop for more flexible sound output, and a new Screen Resolution utility allows easier configuration of multiple video displays.
Wubi installer: a new Windows-based installer option makes it easier than ever to try out Ubuntu, letting users install a full desktop on Windows systems without needing to partition their hard drive.
Server Features
—————
AppArmor profiles: a greater number of server applications are now protected by default with AppArmor, a kernel technology that limits the resources an application is allowed to access, providing added protection against undiscovered security vulnerabilities.
Memory protection: additional protection now prevents direct access to system memory through /dev/mem and /dev/kmem, and the lower 64K of system memory is no longer addressable by default, changes which help to defend against malicious code. The kernel now also loads Position Independent
Executables at randomized addresses, making it harder for application security vulnerabilities to be exploited.
Virtualization and iSCSI: KVM is now an officially maintained option, which combined with libvirt (CLI) and virt-manager (GUI) management tools allows for a simple and efficient virtualization option on hardware that supports virtualization extensions (AMD-V or Intel-VT). Mounting iSCSI targets is
now supported (including in the installer), allowing Ubuntu to interoperate with this class of cost-efficient Storage Area Network solutions.
Ubuntu Education Edition
————————
Add-on configuration: Edubuntu is now provided as an add-on to Ubuntu rather than a separate stand-alone flavor, permitting even greater reuse of Ubuntu technologies.
Kubuntu Features
—————-
Kubuntu comes with the rock solid KDE 3 for those who want a commercially supported desktop.
For those who want something more exciting, a KDE 4 Remix is available bringing this cutting edge new version to you first.
Please see https://wiki.kubuntu.org/HardyHeron/RC/Kubuntu for details.
Xubuntu Features
—————-
Xubuntu comes with the light-weight Xfce 4.4.2 desktop environment for those who want to a desktop that is easy to use, but places particular emphasis on conserving system resources.
New Additions To The Family
—————————
Two new variants join us for this Ubuntu release. UbuntuStudio and Mythbuntu have done releases separately in the past, and with Hardy Heron we’re happy to be able to welcome these fine community projects into the main Ubuntu release process.
For a more in-depth tour of the features new in 8.04 LTS, see http://www.ubuntu.com/testing/804rc
About Ubuntu
————
Ubuntu is a full-featured Linux distribution for desktops, laptops, and servers, with a fast and easy install and regular releases. A tightly-integrated selection of excellent applications is included, and
an incredible variety of add-on software is just a few clicks away.
Professional technical support is available from Canonical Limited and hundreds of other companies around the world. For more information about support, visit http://www.ubuntu.com/support
To Get the Ubuntu 8.04 LTS Release Candidate CD
——————————
http://ftp.belnet.be/mirror/ubuntu.com/releases/8.04 (Belgium)
http://ubuntu.linux-bg.org/releases/8.04 (Bulgaria)
http://hr.releases.ubuntu.com/8.04 (Croatia)
http://mirror.u-soft.dk/ubuntu-releases/8.04 (Denmark)
http://ftp.crihan.fr/releases/8.04 (France)
http://gb.releases.ubuntu.com/8.04 (Great Britain)
http://ftp.ntua.gr/pub/linux/ubuntu-releases/8.04 (Greece)
http://ie.releases.ubuntu.com/8.04 (Ireland)
http://it.releases.ubuntu.com/8.04 (Italy)
http://nl.releases.ubuntu.com/8.04 (The Netherlands)
http://ftp.snt.utwente.nl/pub/linux/ubuntu-releases/8.04 (The Netherlands)
http://no.releases.ubuntu.com/8.04 (Norway)
http://neacm.fe.up.pt/pub/ubuntu-releases/8.04 (Portugal)
http://es.releases.ubuntu.com/8.04 (Spain)
http://se.releases.ubuntu.com/8.04 (Sweden)
Asia/Pacific:
http://tw.releases.ubuntu.com/8.04 (Taiwan)
http://ubuntu-releases.optus.net/8.04 (Australia)
http://nz.releases.ubuntu.com/8.04 (New Zealand)
Africa:
http://za.releases.ubuntu.com/8.04 (South Africa)
North America:
http://us.releases.ubuntu.com/8.04 (United States)
South America:
http://br.releases.ubuntu.com/8.04 (Brazil)
Rest of the world:
http://releases.ubuntu.com/8.04 (Great Britain)
Please download using Bittorrent if possible. See https://help.ubuntu.com/community/BitTorrent for more information about using Bittorrent.
Upgrading from Ubuntu 7.10 and Ubuntu 6.06 LTS
———————————————-
To upgrade to Ubuntu 8.04 LTS Release Candidate from Ubuntu 7.10 or Ubuntu 6.06 LTS, follow these instructions:
https://help.ubuntu.com/community/HardyUpgrades
Feedback and Helping
——————–
If you would like to help shape Ubuntu, take a look at the list of ways you can participate at http://www.ubuntu.com/community/participate/
Your comments, bug reports, patches, and suggestions will help turn this release into the best release of Ubuntu ever. Please report bugs through the Launchpad bug tracker: https://bugs.launchpad.net/ubuntu/+bugs
If you have a question, or if you think you may have found a bug but aren’t sure, first try asking on the #ubuntu IRC channel on FreeNode, on the Ubuntu Users mailing list, or on the Ubuntu forums:
More Information
—————-
Apr
10
Ehh, What The Hell
Filed Under Ubuntu | 6 Comments
I figure I’d join the band-wagon too, but I’ll use *readable* $() vs the absolutely unreadable-horrible-habit `. (Yes, that is a `. What? You can’t tell what character that is? Yeah, neither can I when you use it in your code! Its a back-tick and shouldn’t be used because its unreadable!)
christer@007:~$ history | awk $({a[$2]++ } END{for(i in a){print a[i] ” ” i}})|sort -rn|head
96 ls
87 vim
70 cd
60 bzr
25 sudo
16 rm
14 ssh
13 grep
13 cat
11 scp
Apr
3
Dapper To Hardy Direct Server Upgrade Works!
Filed Under Ubuntu | 10 Comments
The other day I thought I’d give the Ubuntu 6.06 LTS to 8.04 LTS direct upgrade path a try on my Ubuntu 6.06 server. It ran smoothly (over ssh no less), until I ran into one bug at the end. I reported it, with a reply back the next day. Two days later it has been fixed and I tried an upgrade again. I’m happy to say that the direct upgrade path worked perfectly on a fresh install of Ubuntu 6.06 Server. Here is how I did it:
Ubuntu 6.06 to Ubuntu 8.04 Upgrade (Server)
I verified that my current install was completely up to date:
sudo aptitude update
sudo aptitude upgrade
sudo aptitude dist-upgrade
Also, to be thorough, this is what my sources.list looked like (each ‘deb’ entry should be one single line):
deb http://archive.ubuntu.com/ubuntu dapper main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu dapper-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu dapper-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu dapper-proposed main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu dapper-backports main restricted universe multiverse
Once I had applied all updates (if you’re already up to date, you don’t need a reboot) I then installed the server-based update utility:
sudo aptitude install update-manager-core
Once this is installed you’re ready to begin the upgrade process. You can start the upgrade using:
sudo do-release-upgrade -d
note: once Ubuntu 8.04 final is released the -d option will no longer be needed.
At this point it’ll do some checking, verify and update the newer repository and ask you a few questions along the lines of “There is no going back from here, are you sure you want to upgrade?” After that its smooth sailing.
If you do run into any issues during the upgrade please report them against the update-manager-core package in Launchpad.
Apr
1
April Fools Reminder
Filed Under Ubuntu | 3 Comments
After going through my feeds for the morning I thought I’d post a reminder about April Fool’s. Geek’s love April Fools. Don’t believe anything you read today! The way I see it, if the news is still around tomorrow and the next its likely valid, otherwise its an April Fool’s joke.
I’ve seen some pretty tasteless jokes today too. Shame on you, you know who you are.
Mar
28
Plan and Announce Your Release Party!
Filed Under Community, Ubuntu | Leave a Comment
The release of the next Ubuntu LTS (8.04 “Hardy Heron”) is just around the corner and as a community of Ubuntu members its our responsibility–nay, our obligation– to celebrate! What are you planning to do for the greatest release to date?
If you’re part of a LoCo Team (you know who you are!) you need to have a release party. If you’re not party of a LoCo Team you really should be! Fill a room with geeks, add good food and drinks and toss in a reason to celebrate and who knows what might happen!
I want to remind everyone (particularly those in US Teams) to get cracking and post your release party details online here.
“What can we do for a release party?” you might ask. Well, anything! It can be as simple as meeting in a coffee shop with a few of your in-real-life buddies and celebrating Ubuntu’s latest achievement. Perhaps meet up with your LoCo in a pub and have a toast to Ubuntu. Maybe even go all out and have a big install fest in cooperation with your local university or LUG. It doesn’t matter. What does matter is that you’re celebrating the release and having a good time after six months of hard work!
It would be great if you could take pictures while you’re there and post them on blogs (and subsequent planets), flickr–even use twitter to share the fun. Get the word out about where you’ll be, who can come and what’s involved. Let’s really make it a big day and make sure the whole interweb hears about it!
If you’re looking for a local release party, or wondering if there is already one being planned, see the hardy release party list.
Mar
26
My Pet Bug
Filed Under Ubuntu | 5 Comments
I’m generally not one to advertise bugs but this has been my pet bug since upgrading to hardy and using Firefox 3b. I have been putting up with the issue, but I’d *really* like to figure out a fix for it.
I’d be very interested in any feedback the rest of the community can suggest. Please see my pet bug for details.
Jan
21
The Ubuntu team is proud to announce the release of Ubuntu 6.06.2 LTS, the second maintenance release of “Dapper Drake”. This release includes updated Server installation CDs for the i386 and amd64 architectures.
About Ubuntu
————
Ubuntu is a full-featured Linux distribution for desktops, laptops, and servers, with a fast and easy install and regular releases. A tightly-integrated selection of excellent applications is included, and an incredible variety of add-on software is available from a global network of mirrors with just a few clicks.
Professional technical support is available from Canonical Limited and hundreds of other companies around the world. For more information about support, visit http://www.ubuntu.com/support
To Get Ubuntu 6.06.2 LTS
————————
Download it here:
About Ubuntu 6.06.2 LTS
———————–
This is the second maintenance release of Ubuntu 6.06 LTS, which continues to be supported with maintenance updates and security fixes until June 2009 on desktops and June 2011 on servers. This maintenance release focuses on improving hardware support for popular server platforms, including updated server installation media.
Over 600 post-release updates have been integrated, so that fewer updates will need to be downloaded after installation, and a number of bugs in the installation system have been corrected. These include security updates and corrections for other high-impact bugs, with a focus on maintaining stability and compatibility with Ubuntu 6.06 LTS.
See http://www.ubuntu.com/usn for a list of Ubuntu security updates. As of 2008-01-10, all updates affecting packages on the CD have been applied.
A summary of notable updates follows. See https://bugs.launchpad.net
Server updates
————–
Hardware-independent installer fixes:
- Configuring LVM with using RAID partitions as physical volumes works now. (#22899)
- An occasional indefinite hang during installation on multiprocessor systems has been fixed. (#62986)
Installation on HP ProLiant DL3xx server platforms:
- Detection of the DAC960 RAID controller (#31035)
- Detection of HP Virtual Keyboard (#55495)
- Detection of Broadcom NetXtreme II BCM5708 (#73647)
- Installation of Lilo with the HP/Compaq SmartArray RAID controller (#103291)
Installation on Dell PowerEdge server platforms:
- Detection of I2O-based hardware RAID controllers, such as the Adaptec 2xxx series (#22220)
- Detection and handling of PERC/MegaRaid controllers (#32752, #55138, #56854)
Desktop Updates
—————
- Fix polling of CD-ROMs which previously caused problems like failed hibernation, failed hotswapping CD drives, and lockups. (#58953)
- Fix the Gnome printer notification icon and other printing client programs getting stuck in an endless loop, consuming 100% CPU resources. (#44196)
General Updates
—————
- Handling of proxy disabling (Acquire::http::Proxy “false”) in apt configuration (#47044)
- NFS mounts on 64 bit platforms (#89801)
- Printing of documents with certain international characters in the title (#57445)
Helping Shape Ubuntu
——————–
If you would like to help shape Ubuntu, take a look at the list of ways you can participate at
If you have a question, or if you think you may have found a bug but aren’t sure, try asking on the #ubuntu channel on IRC.FreeNode.net, on the Ubuntu Users mailing list, or on the Ubuntu forums:
http://lists.ubuntu.com
/mailman/listinfo/ubuntu-users
http://www.ubuntuforums.org/
More Information
—————-
You can find out more about Ubuntu on our website:
Jan
20
There was some discussion the other day in #ubuntu-us about some people having issues using the default repository for fetching updates. I mentioned that they might want to use a local repository mirror instead. I’m lucky enough to have an ISP that mirrors Ubuntu repositories (Xmission ftw!!). You may not be so lucky, but there is an option to try and select a closer, faster repository.
Software Source Location
Just the other day I blogged about enabling or disabling repository components with the Software Sources tool. This tool also allows us to select the closest, fastest responding mirror. Open that tool again via “System > Admin > Software Sources”. To select an alternate repository location we’ll select the button just below the repository components that says “Download From:”, and select “Other”.
From this point we have two options. We can manually select a different repository mirror location or we can have it “Select Best Server”. It should be noted that manually selecting a local repository may not mean it is actually the fastest repository. “Select Best Server” will try communicating with each available repository mirror and automagically select the fastest one for you.
If you ever have trouble with that mirror in the future, simply try that option again and see if it offers you something different.
You might also reference Tombuntu for a similar outline written last fall including screenshots.

